Password Attacks
How attackers get passwords: reused leaks, guessing, default credentials, and cracking stolen hashes with brute force, dictionaries, and rainbow tables.
1Why passwords are such a target
If an adversary gets a legitimate user's password and the organization has not enabled MFA or other protections, the adversary can act inside that organization with all the access and rights of that user: read their email, open their files, approve their requests. That is why so many attacks aim at passwords first.
2Online and offline attacks
Password attacks are classified as online or offline:
- Online attacks try username and password combinations on an active login page or service.
- Offline attacks work on a captured database of usernames and password hashes, running guesses on the attacker's own computer. This bypasses any account lockout protections.
3Reused and leaked passwords
Many people reuse the same password, or small variations of it, everywhere, despite warnings. When an organization's user database is stolen, the usernames, emails, and passwords are sold to adversaries or posted online. Adversaries often begin an attack on a person by trying their stolen or leaked credentials on other services.
4Guessing and spraying
Many people choose easy-to-guess passwords, and adversaries try common passwords against accounts. Password spraying tries one common password (like Summer2024!) against many different accounts. Because each account sees only one or two failures, account lockout rules rarely trigger.
5Default credentials and credential stuffing
Some devices and services, such as switches, routers, and IoT devices, come preconfigured with a default administrator username and password, often printed in the manual and published online (admin / admin). Credential stuffing is an attack that tries to log in using common default credentials or stolen account credentials, often automatically, across many devices or sites.
6Cracking stolen hashes
Hashes cannot be reversed, but an attacker with stolen hashes can use automated hash-cracking tools: hash a possible password, compare it with the captured hash, and repeat. A match means the attacker has found a password that produces that hash, which they can use to log in.
- Brute force: test every possible password. Even all 6-letter lowercase passwords is 266 = 308,915,776 guesses; longer passwords quickly become impractical.
- Dictionary attack: test a list of common passwords. Weak passwords fall almost instantly.
7Rainbow tables
A rainbow table attack does the hashing ahead of time. The attacker takes a list of common passwords, computes each one's hash, and builds a table of password and hash pairs, sorted by hash. With a stolen hash, an automated tool looks it up in the table instead of hashing guesses on the spot. A match gives a password that will log in.
1c8bfe8f801d79745c46… letmein 323725e8eff4df0a4974… Summer2024! 5e884898da28047151d0… password 6382deaf1f5dc6e792b7… football 65e84be33532fb784c48… qwerty 8d969eef6ecad3c29a3a… 123456
Salt defeats rainbow tables. The table was built from plain passwords. A salted hash, hash(salt + password), will not appear in it, so the attacker would need a new table for every salt.
| Attack | Online or offline | What it exploits | Main defense |
|---|---|---|---|
| Password spraying | Online | Common passwords across many accounts | Ban common passwords; watch for many-account failures; MFA |
| Credential stuffing | Online | Default credentials, or credentials leaked elsewhere | Change defaults; unique passwords; MFA |
| Brute force | Usually offline | Short passwords | Long passwords |
| Dictionary attack | Usually offline | Common or predictable passwords | Random, uncommon passwords |
| Rainbow table | Offline | Unsalted hashes of common passwords | Salt every hash |
Online attacks guess at the login page and can be slowed by lockouts and MFA. Offline attacks crack stolen hashes on the attacker's own computer, where only strong passwords and salt slow them down.
8Worked examples
Five scenarios
Name each attack: (a) one password, Welcome1!, tried once against 3,000 employee accounts; (b) a home router still using admin/admin is logged into; (c) a stolen hash file is run against a list of 10 million common passwords on the attacker's laptop; (d) a precomputed table of hashes is searched for a stolen hash; (e) a person's leaked password from a game site is tried on their email.
- 1(a) One common password, many accounts: password spraying (online).
- 2(b) Logging in with default credentials: credential stuffing.
- 3(c) Testing a list of common passwords against stolen hashes: an offline dictionary attack.
- 4(d) Looking up the hash in a precomputed table: a rainbow table attack.
- 5(e) Trying leaked credentials on another service: using reused, stolen credentials (credential stuffing).
Why the lockout didn't help
A company locks accounts after 5 failed logins. Attackers stole the password-hash database last month, and several accounts were later accessed with correct passwords and no failed attempts. How?
- 1With the hash database, the attackers ran an offline attack on their own computers.
- 2Offline guesses never touch the login page, so the 5-attempt lockout never triggered.
- 3Once cracked, the correct passwords were used directly, with no failures to notice.
The seventh guess
An attacker has the unsalted SHA-256 hash of a user's password and the word list in Figure 2. Explain how the password is found.
- 1The tool hashes
123456and compares: no match. - 2It continues through
password,qwerty,letmein,dragon,football: no match. - 3It hashes
sunshine: the hash matches the stolen hash.
The table that stopped working
An attacker has a rainbow table built from common passwords. The site stores hash(salt + password) with a random salt per user. Why does the table fail?
- 1The table contains hashes of plain passwords, like hash("sunshine").
- 2The stored value is hash("9be41f" + "sunshine"), a different input, so a completely different hash.
- 3To use a table, the attacker would need one built for each user's salt, which defeats the point of precomputing.
9Common mistakes
Lockouts slow online guessing. Offline attacks on stolen hashes never touch the login page.
Cracking does not reverse a hash. It guesses passwords, hashes them, and compares.
Brute force tries every possibility; a dictionary attack tries a list of likely ones. Rainbow tables precompute hashes for a list.
Default credentials are public. Routers, switches, and IoT devices need their admin password changed on setup.
“This is an offline dictionary attack: the adversary stole the database of password hashes, then used a tool to hash each word in a list of common passwords and compare it to the stolen hashes. Because it runs on the adversary's own computer, the site's account lockout never triggers.”
Name the attack, say whether it is online or offline, and explain what it exploits.