SlideShare a Scribd company logo
1 of 23
Techniques for Password Hashing
and Cracking
The good guys need to be right all the
time. The bad guys just need to be
right once…
Industry best
practices on
password security
Few high profile breaches from 2012
What happens with a leak
Site is compromised.
Data is extracted.
Hackers use data maliciously.
Data is posted on pastebins.
Everyone swarms to see who can crack the most passwords.
Why the surge in leaks
Legacy systems are showing their age.
Frameworks are now ubiquitous.
High availability of network penetration and data extraction tools.
Growing technical debt due to fast development times.
Highly coordinated attacks.
Vulnerabilities
Failing to follow basic security
processes while coding, e.g. SQL
Injection.
Passwords (and other sensitive
information) aren’t handled properly.
SQLMap
SQL Injection exploit tool.
Automatically identifies multiple types of vulnerabilities.
Easy to use.
Can give you the entire contents of a database, including
the schema!
Post leak hazards
If even after all the preventive
measures the leak happens?
You should’ve hashed the
passwords… correctly.
What is Hashing…
Algorithm that generates a fixed-length “digest”
for a given “key”. The digest is:
Reproducible
Fixed-length.
Cannot be “un-hashed” back to the source.
Cannot find “collisions” mathematically.
Birth of Hash
Hashing comes from cryptography.
MD5 (128 bit) – Very broken and too
small.
SHA-1 (160 bit)
SHA-2 (224, 256, 384, 512 bit)
SHA-3 (in development)
Some Cryptographic Hash families
Very fast
Use little memory
Hardware implementable
So use cryptographic hashing?
Password Cracking
Brute Force - Run all possible combinations in a key space through the
algorithm to see what matches. 3 billion guesses per second with a
moderate video card.
Mask Attack
• Common Pattern:
UllllllNS
U = Uppercase
L = Lowercase
N = Number
S = Special Character
• Mimic languages.
• Mimic names.
• Use 1337 speak.
• Mimic password
requirements.
Dictionary Attack -
Huge lists of:
• Popular passwords
• Every word in a particular language
• Names
• Combinations
A truly scary piece of software.
What we have so far…
I can get hit with a zero-day exploit and lose my
hashes.
Hashcat can brute-force most of my hashes in a
few minutes…
Goal of Hashing
To make it prohibitively expensive for
ANYONE to brute-force a hashed
password. Even you.
Prohibitively expensive = It requires a
lot of time and resources to guess a
single password.
How to achieve the goal?
Stop using cryptographic hashing
algorithms!
Use a salt. (Really important!)
Use password hashing algorithm with key
stretching.
Salt
Defends against dictionary attacks and rainbow tables
Slows down brute-force attacks.
Without salt, the entire list can be attacked at once. With salt, every password must be attacked individually.
Randomly generated bytes to combine with a password
before hashing.
Key Stretching
10 LET digest = HASH password
20 LET digest = HASH digest
30 GOTO 20
Two important password hashing algorithms
bcrypt
•Expensive key setup that uses salt & password.
•Implicitly requires a salt.
•Uses more memory.
•Runs slowly on GPUs and FPGAs.
•Widely used and vetted.
•Work factor increases exponentially.
•Example hash string: $2a$05$vUOkFKPjgL1IvXt.8ptmE.FSvdTrW7VqC8b7.Fxbld3LPO1TR08Vi
PBKDF2
•Uses SHA-256.
•Uses little memory.
•Runs faster on GPUs, but still costly with a proper work factor.
•Work factor increases linearly.
Time comparison
• The numbers…
Hashing Best Practices
Use a standard vetted library. Don’t add customizations.
Make the work factor configurable.
Be able to re-hash a password when the work factor changes after a
successful login.
Be able to reset/lock accounts in bulk.
Unit test for known hash keys & values to ensure it’s doing what you think
it’s doing.
Measures
As an organization:
• Guard against hacks.
• Detect leaks – install trip wires.
• Plan for leaks.
• Ask hard questions before a leak happens.
As a user:
• Use KeePass to store your passwords.
• Enable two-factor auth everywhere.
• Use unique high-entropy passwords.
• Use at least 15 characters.
Thank You!
• With appropriate hashing, the good guys need to
be right just once but the bad guys need to be
right all the time!

More Related Content

Viewers also liked

Viewers also liked (20)

ATU Fairfax County Bus Takeover Release
ATU Fairfax County Bus Takeover ReleaseATU Fairfax County Bus Takeover Release
ATU Fairfax County Bus Takeover Release
 
cần mua đồng hồ casio chính hãng
cần mua đồng hồ casio chính hãngcần mua đồng hồ casio chính hãng
cần mua đồng hồ casio chính hãng
 
Valor Agregado Agosto 22
Valor Agregado Agosto 22Valor Agregado Agosto 22
Valor Agregado Agosto 22
 
A Levels Main
A Levels MainA Levels Main
A Levels Main
 
0a) Resume
0a) Resume0a) Resume
0a) Resume
 
TUTOR A DISTANCIA
TUTOR A DISTANCIA TUTOR A DISTANCIA
TUTOR A DISTANCIA
 
Cairo From The Air
Cairo From The AirCairo From The Air
Cairo From The Air
 
Introduccion
IntroduccionIntroduccion
Introduccion
 
Stou02.08.52
Stou02.08.52Stou02.08.52
Stou02.08.52
 
“Access DuPage: Dick Endress”
“Access DuPage: Dick Endress”“Access DuPage: Dick Endress”
“Access DuPage: Dick Endress”
 
1c) Fp And Elevations
1c) Fp And Elevations1c) Fp And Elevations
1c) Fp And Elevations
 
Diego Castellanos Los Valores
Diego Castellanos   Los ValoresDiego Castellanos   Los Valores
Diego Castellanos Los Valores
 
Cover
CoverCover
Cover
 
Front Page
Front PageFront Page
Front Page
 
ESTEBAN
ESTEBANESTEBAN
ESTEBAN
 
Giảm mỡ trắng, mỡ thừa bằng cách áp dụng khoa học đúng đắn
Giảm mỡ trắng, mỡ thừa bằng cách áp dụng khoa học đúng đắnGiảm mỡ trắng, mỡ thừa bằng cách áp dụng khoa học đúng đắn
Giảm mỡ trắng, mỡ thừa bằng cách áp dụng khoa học đúng đắn
 
UC Newsreel Awards Release
UC Newsreel Awards ReleaseUC Newsreel Awards Release
UC Newsreel Awards Release
 
Two Coveroc1
Two Coveroc1Two Coveroc1
Two Coveroc1
 
1a) Paintings And Renderings
1a) Paintings And Renderings1a) Paintings And Renderings
1a) Paintings And Renderings
 
Freedom Advisory Overview
Freedom Advisory OverviewFreedom Advisory Overview
Freedom Advisory Overview
 

Similar to Techniques for password hashing and cracking

Using Cryptography Properly in Applications
Using Cryptography Properly in ApplicationsUsing Cryptography Properly in Applications
Using Cryptography Properly in ApplicationsGreat Wide Open
 
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...How to Use Cryptography Properly: The Common Mistakes People Make When Using ...
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...POSSCON
 
Kieon secure passwords theory and practice 2011
Kieon secure passwords theory and practice 2011Kieon secure passwords theory and practice 2011
Kieon secure passwords theory and practice 2011Kieon
 
Password Storage Sucks!
Password Storage Sucks!Password Storage Sucks!
Password Storage Sucks!nerdybeardo
 
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
How-to crack 43kk passwords  while drinking your  juice/smoozie in the HoodHow-to crack 43kk passwords  while drinking your  juice/smoozie in the Hood
How-to crack 43kk passwords while drinking your juice/smoozie in the HoodYurii Bilyk
 
A Survey of Password Attacks and Safe Hashing Algorithms
A Survey of Password Attacks and Safe Hashing AlgorithmsA Survey of Password Attacks and Safe Hashing Algorithms
A Survey of Password Attacks and Safe Hashing AlgorithmsIRJET Journal
 
Passwords good badugly181212-2
Passwords good badugly181212-2Passwords good badugly181212-2
Passwords good badugly181212-2Iftach Ian Amit
 
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...
How to Use Cryptography Properly:  Common Mistakes People Make When Using Cry...How to Use Cryptography Properly:  Common Mistakes People Make When Using Cry...
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...All Things Open
 
Password (in)security
Password (in)securityPassword (in)security
Password (in)securityEnrico Zimuel
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoidOwaspCzech
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoidFilip Šebesta
 
Open source security
Open source securityOpen source security
Open source securitylrigknat
 
Password cracking and brute force tools
Password cracking and brute force toolsPassword cracking and brute force tools
Password cracking and brute force toolszeus7856
 
Applied cryptanalysis - everything else
Applied cryptanalysis - everything elseApplied cryptanalysis - everything else
Applied cryptanalysis - everything elseVlad Garbuz
 
All Your Password Are Belong To Us
All Your Password Are Belong To UsAll Your Password Are Belong To Us
All Your Password Are Belong To UsCharles Southerland
 
Chapter 4 access control fundamental ii
Chapter 4   access control fundamental iiChapter 4   access control fundamental ii
Chapter 4 access control fundamental iiSyaiful Ahdan
 
Information and network security 28 blowfish
Information and network security 28 blowfishInformation and network security 28 blowfish
Information and network security 28 blowfishVaibhav Khanna
 

Similar to Techniques for password hashing and cracking (20)

Using Cryptography Properly in Applications
Using Cryptography Properly in ApplicationsUsing Cryptography Properly in Applications
Using Cryptography Properly in Applications
 
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...How to Use Cryptography Properly: The Common Mistakes People Make When Using ...
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...
 
Kieon secure passwords theory and practice 2011
Kieon secure passwords theory and practice 2011Kieon secure passwords theory and practice 2011
Kieon secure passwords theory and practice 2011
 
Password Storage Sucks!
Password Storage Sucks!Password Storage Sucks!
Password Storage Sucks!
 
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
How-to crack 43kk passwords  while drinking your  juice/smoozie in the HoodHow-to crack 43kk passwords  while drinking your  juice/smoozie in the Hood
How-to crack 43kk passwords while drinking your juice/smoozie in the Hood
 
A Survey of Password Attacks and Safe Hashing Algorithms
A Survey of Password Attacks and Safe Hashing AlgorithmsA Survey of Password Attacks and Safe Hashing Algorithms
A Survey of Password Attacks and Safe Hashing Algorithms
 
Passwords good badugly181212-2
Passwords good badugly181212-2Passwords good badugly181212-2
Passwords good badugly181212-2
 
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...
How to Use Cryptography Properly:  Common Mistakes People Make When Using Cry...How to Use Cryptography Properly:  Common Mistakes People Make When Using Cry...
How to Use Cryptography Properly: Common Mistakes People Make When Using Cry...
 
Password (in)security
Password (in)securityPassword (in)security
Password (in)security
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoid
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoid
 
Open source security
Open source securityOpen source security
Open source security
 
Password cracking and brute force tools
Password cracking and brute force toolsPassword cracking and brute force tools
Password cracking and brute force tools
 
Iam r31 a (2)
Iam r31 a (2)Iam r31 a (2)
Iam r31 a (2)
 
Applied cryptanalysis - everything else
Applied cryptanalysis - everything elseApplied cryptanalysis - everything else
Applied cryptanalysis - everything else
 
Stu r33 b (2)
Stu r33 b (2)Stu r33 b (2)
Stu r33 b (2)
 
Ceh v5 module 05 system hacking
Ceh v5 module 05 system hackingCeh v5 module 05 system hacking
Ceh v5 module 05 system hacking
 
All Your Password Are Belong To Us
All Your Password Are Belong To UsAll Your Password Are Belong To Us
All Your Password Are Belong To Us
 
Chapter 4 access control fundamental ii
Chapter 4   access control fundamental iiChapter 4   access control fundamental ii
Chapter 4 access control fundamental ii
 
Information and network security 28 blowfish
Information and network security 28 blowfishInformation and network security 28 blowfish
Information and network security 28 blowfish
 

Techniques for password hashing and cracking

  • 1. Techniques for Password Hashing and Cracking The good guys need to be right all the time. The bad guys just need to be right once…
  • 3. Few high profile breaches from 2012
  • 4. What happens with a leak Site is compromised. Data is extracted. Hackers use data maliciously. Data is posted on pastebins. Everyone swarms to see who can crack the most passwords.
  • 5. Why the surge in leaks Legacy systems are showing their age. Frameworks are now ubiquitous. High availability of network penetration and data extraction tools. Growing technical debt due to fast development times. Highly coordinated attacks.
  • 6. Vulnerabilities Failing to follow basic security processes while coding, e.g. SQL Injection. Passwords (and other sensitive information) aren’t handled properly.
  • 7. SQLMap SQL Injection exploit tool. Automatically identifies multiple types of vulnerabilities. Easy to use. Can give you the entire contents of a database, including the schema!
  • 8. Post leak hazards If even after all the preventive measures the leak happens? You should’ve hashed the passwords… correctly.
  • 9. What is Hashing… Algorithm that generates a fixed-length “digest” for a given “key”. The digest is: Reproducible Fixed-length. Cannot be “un-hashed” back to the source. Cannot find “collisions” mathematically.
  • 10. Birth of Hash Hashing comes from cryptography. MD5 (128 bit) – Very broken and too small. SHA-1 (160 bit) SHA-2 (224, 256, 384, 512 bit) SHA-3 (in development) Some Cryptographic Hash families Very fast Use little memory Hardware implementable
  • 12. Password Cracking Brute Force - Run all possible combinations in a key space through the algorithm to see what matches. 3 billion guesses per second with a moderate video card. Mask Attack • Common Pattern: UllllllNS U = Uppercase L = Lowercase N = Number S = Special Character • Mimic languages. • Mimic names. • Use 1337 speak. • Mimic password requirements. Dictionary Attack - Huge lists of: • Popular passwords • Every word in a particular language • Names • Combinations
  • 13. A truly scary piece of software.
  • 14. What we have so far… I can get hit with a zero-day exploit and lose my hashes. Hashcat can brute-force most of my hashes in a few minutes…
  • 15. Goal of Hashing To make it prohibitively expensive for ANYONE to brute-force a hashed password. Even you. Prohibitively expensive = It requires a lot of time and resources to guess a single password.
  • 16. How to achieve the goal? Stop using cryptographic hashing algorithms! Use a salt. (Really important!) Use password hashing algorithm with key stretching.
  • 17. Salt Defends against dictionary attacks and rainbow tables Slows down brute-force attacks. Without salt, the entire list can be attacked at once. With salt, every password must be attacked individually. Randomly generated bytes to combine with a password before hashing.
  • 18. Key Stretching 10 LET digest = HASH password 20 LET digest = HASH digest 30 GOTO 20
  • 19. Two important password hashing algorithms bcrypt •Expensive key setup that uses salt & password. •Implicitly requires a salt. •Uses more memory. •Runs slowly on GPUs and FPGAs. •Widely used and vetted. •Work factor increases exponentially. •Example hash string: $2a$05$vUOkFKPjgL1IvXt.8ptmE.FSvdTrW7VqC8b7.Fxbld3LPO1TR08Vi PBKDF2 •Uses SHA-256. •Uses little memory. •Runs faster on GPUs, but still costly with a proper work factor. •Work factor increases linearly.
  • 21. Hashing Best Practices Use a standard vetted library. Don’t add customizations. Make the work factor configurable. Be able to re-hash a password when the work factor changes after a successful login. Be able to reset/lock accounts in bulk. Unit test for known hash keys & values to ensure it’s doing what you think it’s doing.
  • 22. Measures As an organization: • Guard against hacks. • Detect leaks – install trip wires. • Plan for leaks. • Ask hard questions before a leak happens. As a user: • Use KeePass to store your passwords. • Enable two-factor auth everywhere. • Use unique high-entropy passwords. • Use at least 15 characters.
  • 23. Thank You! • With appropriate hashing, the good guys need to be right just once but the bad guys need to be right all the time!

Editor's Notes

  1. Lots (LOTS) of high-profile password leaks in 2012. (Twitter too..) LinkedIn link was one of the biggest (and high profile) at 6.4M.
  2. Cracked passwords are usually posted to pastebin. People use the same IDs and passwords repeatedly, so once an ID/pass is compromised, hackers try other sites.
  3. Yahoo, AOL, etc., can’t just up and change their entire auth system. If lots of people are using a specific framwork (e.g. Ruby on Rails) and a vulnerability is found, …. Presto!
  4. Every company should have people in charge of security, not just at an engineering level, but at a product level. Even if you are up to date with everything, you can still get hacked due to other issues, zero-day exploits, etc. There are always bugs.
  5. SQLMap is a sql injection scanner. Use this for auditing your web apps. Metasploit w3af Grabber Watcher
  6. These algorithms make it easier for attackers to brute-force passwords because they use so few resources.
  7. These algorithms make it easier for attackers to brute-force passwords because they use so few resources.
  8. At zero day exploit, everyone picks the hashes and starts attempting to brute-force them.
  9. As much as it would take me to buy a Lamborghini atleast… It should be difficult for anyone to brute-force a password no matter how much inside information they have, including: The hashing algorithm The salt The hash Related account information
  10. Salts defeat pre-computed tables by changing the output hash. Two users with the same password will have different hash, because the salt is different. Should be unique each time a password is hashed. Never re-use a salt. Doesn’t need to be huge. 8-12 bytes if fine.
  11. Work Factor = Amount of key stretching done By cycling the output back into the hash function, we can determine how much computational power is required to compute the digest.
  12. A bcrypt hash string contains all the information required to check a password. $2a$05$vUOkFKPjgL1IvXt.8ptmE.FSvdTrW7VqC8b7.Fxbld3LPO1TR08Vi $2a  version of bcrypt $05  work factor vUOkFKPjgL1IvXt.8ptmE.  Salt FSvdTrW7VqC8b7.Fxbld3LPO1TR08Vi  Hash PBKDF2 is an official standard because it’s based on an official standard.
  13. Even if you know the salt, a predictable patterned password containing 9 characters will take many years to brute-force. Salt – Stop bulk attacks. Key stretching – slows down attacks.
  14. Hard Questions: How do you detect a leak? At the engineering level? Database level? Application level? Play a war game where there was a leak. How do you handle it? How do you determine which accounts were impacted? How do you communicate that information? How do you lock those accounts or monitor them for suspicious activity? Can you put your app in a read-only mode, no changes to the db? Can you lock out especially sensitive parts of your application? How do you fix the vulnerability?