Breached passwords and credential stuffing
A password reused from another site will be tried on yours. The control is a breach check, a slow hash, rate limits, and a second factor that does not depend on the password.
Diagram
From a reused password to a login you can slow down
Step 1 of 4
Reuse
People reuse passwords. Lists from other breaches get tried against your login.
# The person chose a password. # You store a slow hash, not the password.
A fast hash, or a hash with no unique salt.
Unlimited tries, no breach check.
A reused password is enough.
The example on the open step is one illustration, or the fix you can paste into an application you own.
What this page is made of
4 pieces. Each one says what fails, who is affected, what you would notice, and what you change.
Stuffing versus guessing one account
- What fails
- Credential stuffing tries many accounts with passwords those people used elsewhere. Spraying tries one weak password across many names. The logs look different. Both need a limit and a better factor.
- Who is affected
- The account holders whose reused or weak passwords succeed.
- What you would notice
- Successes spread across many accounts, or one password failing across many names, from many addresses.
- What you change
- Alert on both shapes. Do not only lock the single account that failed five times.
The breach check
- What fails
- A password that is already in a public breach corpus should not be accepted when it is set, and a login with one should demand a reset or a stronger factor.
- Who is affected
- The person whose other breach became a session on your site.
- What you would notice
- A set-password form with no check, and a login that never consults a breach list.
- What you change
- Use a k-anonymous range query or a similar privacy-preserving lookup against a corpus you trust. Do not send the raw password to an arbitrary log.
Slow hashes
- What fails
- A fast hash makes a stolen database a password list for the rest of the internet. The salt stops identical passwords from looking identical. It does not make guessing expensive.
- Who is affected
- Everyone in the database if it is copied.
- What you would notice
- SHA-1, unsalted MD5, or a single round of a general-purpose hash in the user table.
- What you change
- Store Argon2id, bcrypt, or scrypt with parameters you can name. Rehash on next login.
The limit that does not become the outage
- What fails
- A lockout that disables the account after a few failures lets someone else shut the person out. Slow down and add a factor instead of a hard disable where you can.
- Who is affected
- The person who can be locked out of their own account.
- What you would notice
- A counter that sets enabled=false and has no operator override.
- What you change
- Rate-limit the tries, keep the account able to recover, and require the second factor rather than a permanent lock.
Two shapes in the login log
Credential stuffing uses passwords people already chose on other sites, tried against the same email or username on yours. The log is many accounts, many passwords, a higher success rate than pure guessing, often from a cloud provider’s address space. Password spraying is one or two common passwords against many names, tuned to stay under a lockout. If you only alert on one account failing ten times, you will miss both.
The person affected is the account holder, and then everyone whose data that account can read. A successful stuff is not a vulnerability in the password field’s HTML. It is a missing control around a secret humans reuse. Write the finding that way so the fix is not “add a captcha and call it done,” unless the captcha is part of a larger change.
Refuse passwords that are already public
On set and on change, check the candidate against a breach corpus. The usual privacy-preserving method is a range lookup: you send a prefix of a hash, not the password, and you compare the rest locally. Follow the current documentation of the corpus you use. Log that a password was rejected. Do not log the password.
On login, a match should not be a silent success. Step the person up to a reset or to a factor they already enrolled. Do this in a lab tenant with passwords you created for the test, not with a real customer’s password pasted into a ticket.
Make a copied database expensive
Store Argon2id, bcrypt, or scrypt. Record the parameters. A unique salt per password is required and is not the same as slowness. If you still have a fast hash, rehash on the next successful login and invalidate sessions you cannot explain. A stolen table of fast hashes is a credential list for every other site those people reused a password on.
Rate-limit by account and by a broader key so spraying has a ceiling too. Prefer slowing and a second factor over a lockout that lets an outsider disable the account. Recovery has to exist, and it has to be the passkey or support flow you designed, not an email of the current password.
What you change
Sensitive accounts — admins, finance, anyone who can export data — should not be reachable with a password alone. A phishing-resistant factor, described on the passkey pages, is the control that still works when the password is in a breach. App-based one-time codes help against stuffing and still fail against a real-time relay. Say which one you deployed.
The review items are the hash algorithm, the breach check on the set-password path, the alert for stuffing and spraying shapes, and the factor policy. A block list of addresses is a temporary operational response. It is not the design, because the next try comes from somewhere else.
Check yourself
Recognition and the fix. Nothing here is a procedure.
Many accounts log in successfully from new addresses, each with a different password, in a short window. There is no breach check. What are you looking at?
Sibling techniques
Pages at the same depth, plus a lab and a glossary card for this one.