Securing Devices · 4.2

🔓 Password Attacks & Hashing

How attackers crack passwords — and why the vulnerability is always in the password⏱ ~2 min

📖A hash is a one-way shredder for passwords

When you shred a document, you can't un-shred it. A cryptographic hash is similar: you put a password in, get a fixed-length string out, and it's computationally infeasible to reverse. When you log in, the system hashes your input and compares it to the stored hash — it never stores or compares your actual password. The problem: if your password is weak, attackers can hash candidate passwords and compare until they find a match. The vulnerability is always the password choice, not the hashing itself.

Password Attack Types — The Full Taxonomy

AttackHow It WorksExploits This VulnerabilityStopped By
Dictionary AttackTry every word in a list of common passwords, known passwords, and variationsUser chose a common or predictable passwordLong, random passphrases; rate limiting; account lockout
Brute ForceTry every possible combination of characters systematicallyShort password length — combinations are small enough to enumeratePassword length; account lockout; slow hash algorithms (bcrypt)
Credential StuffingUse username/password pairs from previous breaches on other servicesPassword reuse across multiple accountsUnique password per service (password manager); MFA
Password SprayingTry a small set of common passwords (e.g., 'Password1!') against many accountsCommon weak passwords; avoids per-account lockout thresholdsBan common passwords; MFA
Rainbow Table AttackPrecomputed table mapping common passwords to their hashes; fast lookupWeak/common password stored with no saltPassword salting (random value added before hashing)
Offline CrackingSteal the hash database; crack offline with unlimited attempts (no lockout)Short or common passwords; unsalted hashesSlow hash algorithms; salting; MFA so cracked passwords still don't work

The Role of Hashing in Password Storage

Password databases should never store plaintext passwords — if the database is breached, all passwords are immediately compromised. Instead, the system stores the hash. When you log in, your input is hashed and compared. Good hash algorithms for passwords: bcrypt, Argon2, scrypt. Bad: MD5, SHA-1 (too fast — allows billions of guesses per second on modern hardware).

Password Vulnerability Scenarios

PasswordVulnerable ToWhy
passwordDictionary attackLiterally the most common password — every dictionary list starts here
p@ssw0rdDictionary attackKnown substitution pattern; all major wordlists include common substitutions
abc123Brute force + dictionaryShort, sequential; in every list; brute-forced in seconds
Jennifer1987!Dictionary + pattern attackName + birth year + symbol — very common structure even if personalized
correct-horse-battery-stapleNone practical4 random common words = 44+ bits of entropy; brute-forcing in years
Xk9#mP2@qL7!nB4None practical15 random characters = enormous entropy; decades to brute-force even offline

Online vs Offline Attacks — A Critical Distinction

Online Attack (live system)
  • Attacker interacts with the real login interface
  • Account lockout applies after N failures
  • Rate limiting slows attempts to 1-2/second
  • IP blocking stops high-volume attacks
  • Easy to detect and block with basic controls
  • Even weak passwords are partially protected
Offline Attack (stolen hash database)
  • Attacker has a copy of the password hash database
  • No lockout — unlimited attempts on local hardware
  • GPU clusters: billions of MD5 hashes per second
  • A 6-character password cracked in seconds
  • No detection — all activity is local
  • Only defense: strong passwords + slow hash algorithms
🧠Quick Checkfirst try = +5 XP

A company stores all employee passwords hashed with MD5 (no salt). An attacker breaches the database and steals 50,000 password hashes. They run the hashes through a rainbow table lookup. Within an hour, 35,000 (70%) of the passwords are cracked. Why specifically did the rainbow table work so effectively, and what two changes would have prevented this?

0 XP🔥 0 days