SlideShare a Scribd company logo
Crypto: Attacks & Applications
Wednesday, September 14, 2011
Outline
● Homework Solutions
● Attacks How-To
○ Vigenere Cipher
○ Homebrew Crypto
● Password Cracking
● Homework Assignment
Homework 2
Too easy...
Homework Problem 1
● How could you simultaneously ensure privacy and
authenticity using public key crypto?
● Solution:
○ Assume Alice --> Bob
○ We have PubKey_A, PrivKey_A, PubKey_B, PrivKey_B
○ Enc(Message,PubKey_B) - Ensures that only Bob can
read the message
○ Enc(Message,PrivKey_A) - Ensures that Alice sent the
message
Homework Problem 1
● How could you simultaneously ensure privacy and
authenticity using public key crypto?
●
● Answer:
○ Enc(Enc(Message,PrivKey_A),PubKey_B)
■ Bob receives this message, decrypts with his private
key and then with Alice's public key.
● Why not Enc(Enc(Message,PubKey_B),PrivKey_A)?
○ Anyone can strip off the outer encryption using Alice's
public key (And replace it with their own)
■ Consider using this technique to submit homework
■ A MITM attack could intercept someone else's
homework, strip off their sig, resign it, and submit it
as their own
Homework Problem 2
Find the security flaw in the following server/client authentication
protocol:
1) Client sends Challenge C1 to server
2) Server proves it’s identity by
replying Enc(C1, SS)
3) User verifies server by encrypting
C1 and comparing with message
4) Server sends C2 to client
5) client authenticates by replying
Encrypt(C2, SS)
6) Server verifies user by encrypting
C2 and comparing message
Homework Problem 2
● To defeat this protocol, a client
can open a new session and
present the challenge C2 to the
server.
● The response will be the
Encryption of C2
● The client responds to the original
challenge with this message
● How can you plug this security
hole?
○ User authenticates first
Attack #1: Man in the Middle SSL
Credit: SSLStrip by Moxie Marlinspike (http://www.thoughtcrime.
org/software/sslstrip/)
Credit: YouTube Demo Video by bonniekwacha (http://youtu.be/Q1hnHbBb_bA)
Attack #1: MITM SSL Review
Overview:
1. Trudy enables packet forwarding
2. Trudy creates IPTable rule to redirect packets to SSLSTRIP
3. Trudy identifies Victim Host IP and Gateway/Router IP
4. Trudy spoofs the Gateway IP and advertises to the Victim IP
5. Trudy starts SSLSTRIP
6. Bob generates SSL traffic (tries to use secure socket service)
7. Trudy reviews logs generated by SSLSTRIP
8. Trudy obtains user credentials (usernames, passwords, etc)
Attacking A Substitution Cipher
Taken from DEFCON 18:
"AUJKKUHNTPYMJKKHYTGKHMESELM
PFKDUJUSGFPEPVAFROPRERHOBAGY
JRAHWHLFVKWYBLZGBQHZZVUWKHM
MWRLAERQPAEREORAVLARALSLMMW
RLAEROPRERLUQAKPUQAZTTMBRXLF
TSRLMBLKAUJKKKBNSTUMBFOGLPMK
DVMDKORBJKMEPEKIRZGYKMUZPGTSSGL"
Given hint: this problem was created by GMARK,
and he loves Vigenere ciphers
Attacking A Substitution Cipher
Frequency analysis reveals that
four of the five most occuring
letters spell out "MARK"
Knowing that GMARK created
this challenge, let's try to
decipher using these letters
Unfortunately, this doesn't work
out. Using GMARK as a key in a
Vigenere cipher just results in
gibberish. Any other ideas?
Attacking A Substitution Cipher
What if each letter in GMARK was
an offset for five different alphabets?
What if it were Vigenere, we just had
different keys for each letter?
Success!
Decoded:
"THISZNUMBERZISZALSOZAZDATEZONZWHICH
ZSOMEONEZDIEDZWHOZONCEZPLAYEDZPLATO
ZOPPOSITEZAZLEGENDZFINDZTHEZDATEZTHEZ
LEGENDZDIEDZANDZSENDZHIMZAZMESSAGEZAT
ZTHISZDOMAINZANDZYOUZWILLZHEARZFROMZ
BEYONDZTHEZGRAVE"
Replace Z's with spaces:
"THIS NUMBER IS ALSO A DATE ON WHICH SOMEONE
DIED WHO ONCE PLAYED PLATO OPPOSITE A LEGEND
FIND THE DATE THE LEGEND DIED AND SEND HIM A
MESSAGE AT THIS DOMAIN AND YOU WILL HEAR FROM
BEYOND THE GRAVE"
Problem 3 - Attacking Home Brew
CryptoDecrypt This:
xc0x92x29x63x1ax50x2cxbdx1ax61xfax75xebxa6xcax95x85xcexf9x39xc4x5fx1b
x42x50xe1x4exf8x5fxaexe6x53x2bx3bx81xb7x93x1ex85x44x94xdfxb8xbdx3bx22
x1ex05x73x22xe8x75x5fx69x3dxd6x4cx62xb5xb1x5fxe5x5bx51x91xa3x6ex5dx2a
x52x6fx5ex3dx20x2bx96xa7xfax3cxbfxebx79x94x5fx85xd0x60x8cxdcx21xb7x2c
xdaxb6x62x6cx5cxfexb8xc4x2bx75xf8xe5x5fx08x3bx2dx4fx14x62xf5xeax2bx93
x39xf5x25x95xbbx08x13x5bx11xa4x2dx52xffx80x91x5fx6bx1exf0x1cxe1xcfx39
x1fxdbx2ax65xc4x16x5fxcex3exffxeax1cx4dxa6x57xdax82xd0x29x9cx74xb9x4c
xbex5fx76xa2xabxe8xa8x1ex33x30xe3x4dx3fx09x20x5fx08x4ex3ex3bxbfx74x17
x5ex16x6fx84x2bx62x74xffx5cx6axa4x2dx70x34xc3xc7xb5xebx4cx48x09x84x94
x96x93xafxd7xafxd6xf4x5cx09x4fxa7xc5x7fxadx9dxa4x3ex50xa9x73x05x1exe8
x07xbfx5ex4dxc5xf8x3ax87x83x5bx3ax24x1dx74x34x81x8fxebx4dx52xcbxd3xe0
x5fx46x2dx7bxd6x32x7fx53x5ex5fx35x5fx7dx61xc5xe8xf7x5fx2ex5fx3fxe8x5a
x70x1bx74xdex82xc3x0ax92x5cx88x1ex23x5dx3exb7x33x5fxaaxd8xe8xc5x56x51
xbcx93xd9x4dx8cx5fx22x72xf6xb4x18x1bx02xa5xe6xc9x76xc5x52x4dx42x4exdf
xe7x71x09x14x8fx71x19x16x2ax2cxfexa5xd9xcdxd8x88x4cx53xd6x76x1ax15xa4
x25xc5xf1x8axb2x61x3exc6x4bx2fx17x73xfbxa6x3ex3ax35xa4x1cxa4x88x6fx8e
x1exeexe8x99x54x4bxc1xccxf7x5dx19x1bx60x28xfcxfax1ex42x70xd1xc6xc6x3c
x1bx60xadx09x50x93xcdx30xa0xc4x5ax09xfax1fx23x2ax63x94x65xb5x56x09xd5
xc6xd6xb3x5e
x03x07x70x2cx28x33xe8x23xe6xbax83x15x2cx74x30xd5x1ax9ax73x6cx2cx58xc3
x25xfax5fx8fx3cx81x74x1bxcex93x8ax80xf8x2fx99x2bx06xebx29x52xb1x70x14
xb7xacx82x52x83x9dx4exc9xc3xdcx51xa7x3ex5dx1ex98x1exbfx82x1cx61x60x74
xb9x60xddx92x1fxa4xacx4dx15xb2x44
The algorithm is never secret
● Hint 1: Here is the Decryption algorithm (See source file)
def decrypt(msg,key):
ks = len(key)
k2 = key
if(ks%2==1):
k2 += chr(10)
ks=ks+1
cpt = ""
buff = ""
done = 0
cnt = 0
while(done==0):
i=0
nk = ""
if(len(msg)>=cnt+ks):
buff = msg[cnt:cnt+ks]
else:
buff = msg[cnt:]
tcnt = len(buff)
cnt = cnt + tcnt
if tcnt % 2 == 1:
tcnt = tcnt - 1
for i in range(0,tcnt,2):
c1 = chr((((ord(buff[i])- 31) *
-15) ^ (3 * ord(k2[i]))) % 256)
c2 = chr(((((ord(buff[i+1])+17)^
(7*ord(k2[i+1])))+27*ord(k2[i]))*27) % 256)
while c1 < 0:
c1 += 256
while c2 < 0:
c2 += 256
nk = nk + c1 + c2
cpt = cpt + c1 + c2
i = tcnt
if tcnt != len(buff):
c1 = chr((ord(buff[i])-ord(k2[i]))%
256)
while c1 < 0:
c1 += 256
nk = nk + c1
cpt = cpt + c1
k2 = nk
if cnt == len(msg):
done = 1
return cpt
Still need the key!!
● Hint 2: The key and
plaintext are both made
up of printable ASCII
characters
Can we brute force it?
● Hint 3: The key is between 1 and 20 characters long.
○ Brute forcing a 20 character password of letters,
numbers, and symbols?
○ 95 printable ASCII chars (127-32)
○ 95^20 = 3,584,859,224,085,422,343,574,104,404,449,462,890,625
○ No way we can brute force this...
Be Smart!
● Hint 4: How can we turn the problem of 95^20 into
something more like 95 + 20 * 95 + 10 * 95 + ...
● Look closely at the decryption algorithm... Why should you
never implement your own home brew crypto?
Attack Exercise - Password Cracking
Required Tools:
BackTrack Linux (http://www.backtrack-linux.org/)
John the Ripper (http://www.openwall.com/john/)*
*already installed in BackTrack Linux (/pentest/passwords/john)
Provided Files:
http://www.utdallas.edu/~dst071000/CSG/HW3/pwdlist
Questions:
● Obtain as many passwords as possible from the provided password file
● Determine which hash algorithm was used to hash the passwords
● Locate the name of the system library that is used for hashing
● Identify expired accounts
● Identify passwords that were changed yesterday (09/13/2011)
● BONUS: Write a script that generates or verifies salted passwords
Hints:
JTR Options (http://www.openwall.com/john/doc/OPTIONS.shtml)
JTR Examples (http://www.openwall.com/john/doc/EXAMPLES.shtml)
Attack Exercise - Password Format
Linux
/etc/passwd
username:password:uid:gid:info:home:shell
/etc/shadow
username:password:last:min:max:warn:inactive:expire
password
$number$salt$hash
unshadow
unshadow /etc/passwd /etc/shadow > combined.lst
Attack Exercise - Password Cracking
Review
Wordlists (Dictionaries):
/pentest/passwords/wordlists/darkc0de.lst (12 out of 20)
/pentest/passwords/john/password.lst (11 out of 20)
(14 out of 20)
Command (Modes):
john -single /path/to/password/file
john -wordfile:/path/to/wordlist /path/to/password/file
john -incremental /path/to/password/file
...
Command (Results):
john -show /path/to/password/file
rm john.pot
Attack Exercise - Password Cracking
ReviewAnswer Key:
● Obtain as many passwords as possible from the provided password file
○ user1=123456, user2 = 12345, user3=123456789, user4=Password,
user5=iloveyou, user6=princess, user7=rockyou, user8=1234567,
user9=12345678, user10=abc123, user11=monkey, user12=Qwerty,
user13=Love, user14=Secret, user15=Xes, user16=God,
user17=c0deb0Ok, user18=CrYpToGrApHy, user19=l337sp34k,
user20=Supercalifragilisticexpialidocious
● Determine which hash algorithm was used to hash the passwords
○ $1 indicates the MD5 hashing algorithm was used
● Locate the name of the system library that is used for hashing
○ crypt library
● Identify expired accounts
○ user6 and user15 are disabled accounts (expire < today)
(today=15232)
● Identify passwords that were changed yesterday (09/13/2011)
○ user3 and user13 passwords (days since 01/01/1970 = 15231)
● BONUS: Write script to generate or verify salted password hash
○ Congratulations you get a Gold Star!!!
Advanced Password Cracking
Future:
SSD Accelerated Rainbow Tables
GPU Frameworks (Nvidia CUDA, ATI Stream, OpenCL, et. al.)
Alternate Tools:
Cain & Abel (http://www.oxid.it/cain.html)
RainbowCrack (http://project-rainbowcrack.com/)
Online Lookup (http://www.onlinehashcrack.com)
Hashcat / oclHashcat (http://hashcat.net/hashcat/)
Mitigation:
● STRONG.......passphrases
○ long, case sensitive, numerals, special characters, encoded
● Use Windows 7 or Vista (NT hash > LM hash)
● Use SHA family, Avoid MD5 family
● Never store in plaintext
● Never authenticate over plaintext
● Use multi-factor authentication (two+)
● Everything tastes better with a little.......
This Week's Homework
Download problems 1 & 2 from
www.tinyurl.com/solveus
Problem 1: Find the key!
Problem 2: Decrypt the message
and find the secret word!

More Related Content

PPTX
Cryptography and network security
PPT
Public key cryptography and RSA
PPT
13 asymmetric key cryptography
PPT
introduction to cryptography
PPTX
Public Key Cryptography
PPT
Introduction to cryptography
PPT
12 symmetric key cryptography
Cryptography and network security
Public key cryptography and RSA
13 asymmetric key cryptography
introduction to cryptography
Public Key Cryptography
Introduction to cryptography
12 symmetric key cryptography

What's hot (20)

PPT
Rsa and diffie hellman algorithms
PPT
public-key cryptography Shamir
PPT
Rsa diffi-network security-itt
PPTX
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
PPTX
Information and data security public key cryptography and rsa
PPT
What is Encryption
PPTX
Cryptography & Network Security By, Er. Swapnil Kaware
PDF
CRYPTOGRAPHY AND NETWORK SECURITY
PPTX
Public key algorithm
PDF
Public key cryptography
PPTX
Cryptography using rsa cryptosystem
PPT
PPTX
Cryptography and RSA algorithm
PDF
Network security cs9 10
PDF
Computer Security Lecture 7: RSA
PPT
Kleptography
DOCX
RSA - ENCRYPTION ALGORITHM CRYPTOGRAPHY
PPT
PPT
Cryptography
PPTX
Rsa cryptosystem
Rsa and diffie hellman algorithms
public-key cryptography Shamir
Rsa diffi-network security-itt
RSA - ALGORITHM by Muthugomathy and Meenakshi Shetti of GIT COLLEGE
Information and data security public key cryptography and rsa
What is Encryption
Cryptography & Network Security By, Er. Swapnil Kaware
CRYPTOGRAPHY AND NETWORK SECURITY
Public key algorithm
Public key cryptography
Cryptography using rsa cryptosystem
Cryptography and RSA algorithm
Network security cs9 10
Computer Security Lecture 7: RSA
Kleptography
RSA - ENCRYPTION ALGORITHM CRYPTOGRAPHY
Cryptography
Rsa cryptosystem
Ad

Similar to Cryptography Attacks and Applications (20)

PDF
Classic Cryptography
PDF
amani_rwc_password
PPTX
Cryptanalysis Lecture
PDF
Basic presentation of cryptography mechanisms
PDF
Classical Cryptography and Digital Encryption
PPT
amer-network-sihubconferances-security.ppt
PPTX
Django cryptography
PDF
פתרון חידת המוסד
PPT
CISSP EXAM PREPARATION FOR A PASSED SCORE
PPTX
Cryptography-101
PPTX
PPTX
Ethical hacking Chapter 12 - Encryption - Eric Vanderburg
PPTX
Lecture 2
PPTX
Don't Pick the lock
PDF
Cryp Essay
PPTX
Technology, Process, and Strategy
PPTX
Hacs workshop
PPT
Crypt
PDF
Intro to Cryptography
PDF
Cryptography Crash Course
Classic Cryptography
amani_rwc_password
Cryptanalysis Lecture
Basic presentation of cryptography mechanisms
Classical Cryptography and Digital Encryption
amer-network-sihubconferances-security.ppt
Django cryptography
פתרון חידת המוסד
CISSP EXAM PREPARATION FOR A PASSED SCORE
Cryptography-101
Ethical hacking Chapter 12 - Encryption - Eric Vanderburg
Lecture 2
Don't Pick the lock
Cryp Essay
Technology, Process, and Strategy
Hacs workshop
Crypt
Intro to Cryptography
Cryptography Crash Course
Ad

More from UTD Computer Security Group (20)

PDF
22S kickoff 2.0 (kickoff + anonymity talk)
PPTX
UTD Computer Security Group - Cracking the domain
PPTX
Forensics audio and video
PPTX
Computer networks and network security
PPTX
PPTX
Powershell crash course
PPTX
Intro to cybersecurity
PPTX
PDF
Web Exploitation
PDF
Network Exploitation
PDF
Penetration Testing: Celestial
PDF
Introduction to Exploitation
PDF
Fuzzing - Part 2
PDF
Exploitation Crash Course
PDF
Fuzzing - Part 1
PDF
Protostar VM - Heap3
PDF
Heap Base Exploitation
PDF
Return Oriented Programming
22S kickoff 2.0 (kickoff + anonymity talk)
UTD Computer Security Group - Cracking the domain
Forensics audio and video
Computer networks and network security
Powershell crash course
Intro to cybersecurity
Web Exploitation
Network Exploitation
Penetration Testing: Celestial
Introduction to Exploitation
Fuzzing - Part 2
Exploitation Crash Course
Fuzzing - Part 1
Protostar VM - Heap3
Heap Base Exploitation
Return Oriented Programming

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
KodekX | Application Modernization Development
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Electronic commerce courselecture one. Pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Encapsulation theory and applications.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KodekX | Application Modernization Development
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
sap open course for s4hana steps from ECC to s4
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Approach and Philosophy of On baking technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Electronic commerce courselecture one. Pdf
20250228 LYD VKU AI Blended-Learning.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Reach Out and Touch Someone: Haptics and Empathic Computing
The AUB Centre for AI in Media Proposal.docx
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Understanding_Digital_Forensics_Presentation.pptx
Encapsulation theory and applications.pdf

Cryptography Attacks and Applications

  • 1. Crypto: Attacks & Applications Wednesday, September 14, 2011
  • 2. Outline ● Homework Solutions ● Attacks How-To ○ Vigenere Cipher ○ Homebrew Crypto ● Password Cracking ● Homework Assignment
  • 4. Homework Problem 1 ● How could you simultaneously ensure privacy and authenticity using public key crypto? ● Solution: ○ Assume Alice --> Bob ○ We have PubKey_A, PrivKey_A, PubKey_B, PrivKey_B ○ Enc(Message,PubKey_B) - Ensures that only Bob can read the message ○ Enc(Message,PrivKey_A) - Ensures that Alice sent the message
  • 5. Homework Problem 1 ● How could you simultaneously ensure privacy and authenticity using public key crypto? ● ● Answer: ○ Enc(Enc(Message,PrivKey_A),PubKey_B) ■ Bob receives this message, decrypts with his private key and then with Alice's public key. ● Why not Enc(Enc(Message,PubKey_B),PrivKey_A)? ○ Anyone can strip off the outer encryption using Alice's public key (And replace it with their own) ■ Consider using this technique to submit homework ■ A MITM attack could intercept someone else's homework, strip off their sig, resign it, and submit it as their own
  • 6. Homework Problem 2 Find the security flaw in the following server/client authentication protocol: 1) Client sends Challenge C1 to server 2) Server proves it’s identity by replying Enc(C1, SS) 3) User verifies server by encrypting C1 and comparing with message 4) Server sends C2 to client 5) client authenticates by replying Encrypt(C2, SS) 6) Server verifies user by encrypting C2 and comparing message
  • 7. Homework Problem 2 ● To defeat this protocol, a client can open a new session and present the challenge C2 to the server. ● The response will be the Encryption of C2 ● The client responds to the original challenge with this message ● How can you plug this security hole? ○ User authenticates first
  • 8. Attack #1: Man in the Middle SSL Credit: SSLStrip by Moxie Marlinspike (http://www.thoughtcrime. org/software/sslstrip/) Credit: YouTube Demo Video by bonniekwacha (http://youtu.be/Q1hnHbBb_bA)
  • 9. Attack #1: MITM SSL Review Overview: 1. Trudy enables packet forwarding 2. Trudy creates IPTable rule to redirect packets to SSLSTRIP 3. Trudy identifies Victim Host IP and Gateway/Router IP 4. Trudy spoofs the Gateway IP and advertises to the Victim IP 5. Trudy starts SSLSTRIP 6. Bob generates SSL traffic (tries to use secure socket service) 7. Trudy reviews logs generated by SSLSTRIP 8. Trudy obtains user credentials (usernames, passwords, etc)
  • 10. Attacking A Substitution Cipher Taken from DEFCON 18: "AUJKKUHNTPYMJKKHYTGKHMESELM PFKDUJUSGFPEPVAFROPRERHOBAGY JRAHWHLFVKWYBLZGBQHZZVUWKHM MWRLAERQPAEREORAVLARALSLMMW RLAEROPRERLUQAKPUQAZTTMBRXLF TSRLMBLKAUJKKKBNSTUMBFOGLPMK DVMDKORBJKMEPEKIRZGYKMUZPGTSSGL" Given hint: this problem was created by GMARK, and he loves Vigenere ciphers
  • 11. Attacking A Substitution Cipher Frequency analysis reveals that four of the five most occuring letters spell out "MARK" Knowing that GMARK created this challenge, let's try to decipher using these letters Unfortunately, this doesn't work out. Using GMARK as a key in a Vigenere cipher just results in gibberish. Any other ideas?
  • 12. Attacking A Substitution Cipher What if each letter in GMARK was an offset for five different alphabets? What if it were Vigenere, we just had different keys for each letter?
  • 13. Success! Decoded: "THISZNUMBERZISZALSOZAZDATEZONZWHICH ZSOMEONEZDIEDZWHOZONCEZPLAYEDZPLATO ZOPPOSITEZAZLEGENDZFINDZTHEZDATEZTHEZ LEGENDZDIEDZANDZSENDZHIMZAZMESSAGEZAT ZTHISZDOMAINZANDZYOUZWILLZHEARZFROMZ BEYONDZTHEZGRAVE" Replace Z's with spaces: "THIS NUMBER IS ALSO A DATE ON WHICH SOMEONE DIED WHO ONCE PLAYED PLATO OPPOSITE A LEGEND FIND THE DATE THE LEGEND DIED AND SEND HIM A MESSAGE AT THIS DOMAIN AND YOU WILL HEAR FROM BEYOND THE GRAVE"
  • 14. Problem 3 - Attacking Home Brew CryptoDecrypt This: xc0x92x29x63x1ax50x2cxbdx1ax61xfax75xebxa6xcax95x85xcexf9x39xc4x5fx1b x42x50xe1x4exf8x5fxaexe6x53x2bx3bx81xb7x93x1ex85x44x94xdfxb8xbdx3bx22 x1ex05x73x22xe8x75x5fx69x3dxd6x4cx62xb5xb1x5fxe5x5bx51x91xa3x6ex5dx2a x52x6fx5ex3dx20x2bx96xa7xfax3cxbfxebx79x94x5fx85xd0x60x8cxdcx21xb7x2c xdaxb6x62x6cx5cxfexb8xc4x2bx75xf8xe5x5fx08x3bx2dx4fx14x62xf5xeax2bx93 x39xf5x25x95xbbx08x13x5bx11xa4x2dx52xffx80x91x5fx6bx1exf0x1cxe1xcfx39 x1fxdbx2ax65xc4x16x5fxcex3exffxeax1cx4dxa6x57xdax82xd0x29x9cx74xb9x4c xbex5fx76xa2xabxe8xa8x1ex33x30xe3x4dx3fx09x20x5fx08x4ex3ex3bxbfx74x17 x5ex16x6fx84x2bx62x74xffx5cx6axa4x2dx70x34xc3xc7xb5xebx4cx48x09x84x94 x96x93xafxd7xafxd6xf4x5cx09x4fxa7xc5x7fxadx9dxa4x3ex50xa9x73x05x1exe8 x07xbfx5ex4dxc5xf8x3ax87x83x5bx3ax24x1dx74x34x81x8fxebx4dx52xcbxd3xe0 x5fx46x2dx7bxd6x32x7fx53x5ex5fx35x5fx7dx61xc5xe8xf7x5fx2ex5fx3fxe8x5a x70x1bx74xdex82xc3x0ax92x5cx88x1ex23x5dx3exb7x33x5fxaaxd8xe8xc5x56x51 xbcx93xd9x4dx8cx5fx22x72xf6xb4x18x1bx02xa5xe6xc9x76xc5x52x4dx42x4exdf xe7x71x09x14x8fx71x19x16x2ax2cxfexa5xd9xcdxd8x88x4cx53xd6x76x1ax15xa4 x25xc5xf1x8axb2x61x3exc6x4bx2fx17x73xfbxa6x3ex3ax35xa4x1cxa4x88x6fx8e x1exeexe8x99x54x4bxc1xccxf7x5dx19x1bx60x28xfcxfax1ex42x70xd1xc6xc6x3c x1bx60xadx09x50x93xcdx30xa0xc4x5ax09xfax1fx23x2ax63x94x65xb5x56x09xd5 xc6xd6xb3x5e x03x07x70x2cx28x33xe8x23xe6xbax83x15x2cx74x30xd5x1ax9ax73x6cx2cx58xc3 x25xfax5fx8fx3cx81x74x1bxcex93x8ax80xf8x2fx99x2bx06xebx29x52xb1x70x14 xb7xacx82x52x83x9dx4exc9xc3xdcx51xa7x3ex5dx1ex98x1exbfx82x1cx61x60x74 xb9x60xddx92x1fxa4xacx4dx15xb2x44
  • 15. The algorithm is never secret ● Hint 1: Here is the Decryption algorithm (See source file) def decrypt(msg,key): ks = len(key) k2 = key if(ks%2==1): k2 += chr(10) ks=ks+1 cpt = "" buff = "" done = 0 cnt = 0 while(done==0): i=0 nk = "" if(len(msg)>=cnt+ks): buff = msg[cnt:cnt+ks] else: buff = msg[cnt:] tcnt = len(buff) cnt = cnt + tcnt if tcnt % 2 == 1: tcnt = tcnt - 1 for i in range(0,tcnt,2): c1 = chr((((ord(buff[i])- 31) * -15) ^ (3 * ord(k2[i]))) % 256) c2 = chr(((((ord(buff[i+1])+17)^ (7*ord(k2[i+1])))+27*ord(k2[i]))*27) % 256) while c1 < 0: c1 += 256 while c2 < 0: c2 += 256 nk = nk + c1 + c2 cpt = cpt + c1 + c2 i = tcnt if tcnt != len(buff): c1 = chr((ord(buff[i])-ord(k2[i]))% 256) while c1 < 0: c1 += 256 nk = nk + c1 cpt = cpt + c1 k2 = nk if cnt == len(msg): done = 1 return cpt
  • 16. Still need the key!! ● Hint 2: The key and plaintext are both made up of printable ASCII characters
  • 17. Can we brute force it? ● Hint 3: The key is between 1 and 20 characters long. ○ Brute forcing a 20 character password of letters, numbers, and symbols? ○ 95 printable ASCII chars (127-32) ○ 95^20 = 3,584,859,224,085,422,343,574,104,404,449,462,890,625 ○ No way we can brute force this...
  • 18. Be Smart! ● Hint 4: How can we turn the problem of 95^20 into something more like 95 + 20 * 95 + 10 * 95 + ... ● Look closely at the decryption algorithm... Why should you never implement your own home brew crypto?
  • 19. Attack Exercise - Password Cracking Required Tools: BackTrack Linux (http://www.backtrack-linux.org/) John the Ripper (http://www.openwall.com/john/)* *already installed in BackTrack Linux (/pentest/passwords/john) Provided Files: http://www.utdallas.edu/~dst071000/CSG/HW3/pwdlist Questions: ● Obtain as many passwords as possible from the provided password file ● Determine which hash algorithm was used to hash the passwords ● Locate the name of the system library that is used for hashing ● Identify expired accounts ● Identify passwords that were changed yesterday (09/13/2011) ● BONUS: Write a script that generates or verifies salted passwords Hints: JTR Options (http://www.openwall.com/john/doc/OPTIONS.shtml) JTR Examples (http://www.openwall.com/john/doc/EXAMPLES.shtml)
  • 20. Attack Exercise - Password Format Linux /etc/passwd username:password:uid:gid:info:home:shell /etc/shadow username:password:last:min:max:warn:inactive:expire password $number$salt$hash unshadow unshadow /etc/passwd /etc/shadow > combined.lst
  • 21. Attack Exercise - Password Cracking Review Wordlists (Dictionaries): /pentest/passwords/wordlists/darkc0de.lst (12 out of 20) /pentest/passwords/john/password.lst (11 out of 20) (14 out of 20) Command (Modes): john -single /path/to/password/file john -wordfile:/path/to/wordlist /path/to/password/file john -incremental /path/to/password/file ... Command (Results): john -show /path/to/password/file rm john.pot
  • 22. Attack Exercise - Password Cracking ReviewAnswer Key: ● Obtain as many passwords as possible from the provided password file ○ user1=123456, user2 = 12345, user3=123456789, user4=Password, user5=iloveyou, user6=princess, user7=rockyou, user8=1234567, user9=12345678, user10=abc123, user11=monkey, user12=Qwerty, user13=Love, user14=Secret, user15=Xes, user16=God, user17=c0deb0Ok, user18=CrYpToGrApHy, user19=l337sp34k, user20=Supercalifragilisticexpialidocious ● Determine which hash algorithm was used to hash the passwords ○ $1 indicates the MD5 hashing algorithm was used ● Locate the name of the system library that is used for hashing ○ crypt library ● Identify expired accounts ○ user6 and user15 are disabled accounts (expire < today) (today=15232) ● Identify passwords that were changed yesterday (09/13/2011) ○ user3 and user13 passwords (days since 01/01/1970 = 15231) ● BONUS: Write script to generate or verify salted password hash ○ Congratulations you get a Gold Star!!!
  • 23. Advanced Password Cracking Future: SSD Accelerated Rainbow Tables GPU Frameworks (Nvidia CUDA, ATI Stream, OpenCL, et. al.) Alternate Tools: Cain & Abel (http://www.oxid.it/cain.html) RainbowCrack (http://project-rainbowcrack.com/) Online Lookup (http://www.onlinehashcrack.com) Hashcat / oclHashcat (http://hashcat.net/hashcat/) Mitigation: ● STRONG.......passphrases ○ long, case sensitive, numerals, special characters, encoded ● Use Windows 7 or Vista (NT hash > LM hash) ● Use SHA family, Avoid MD5 family ● Never store in plaintext ● Never authenticate over plaintext ● Use multi-factor authentication (two+) ● Everything tastes better with a little.......
  • 24. This Week's Homework Download problems 1 & 2 from www.tinyurl.com/solveus Problem 1: Find the key! Problem 2: Decrypt the message and find the secret word!