Credential stuffing and password spraying: layered defenses for your login
Compare credential stuffing, password spraying and brute force, then plan layered login defenses and appropriate MFA controls.
- MFA first
- OWASP calls MFA by far the best defence against most password-related attacks; passkeys (FIDO2) make it attainable for most uses.
- No MFA? Layer up
- None of the alternatives matches MFA alone, but layers give reasonable protection - the source's words, and the bar to remember.
- Plan to fail
- Plan for any single defence failing; every defence should produce metrics, both detected and mitigated attack volume.
All wording checked against the OWASP Credential Stuffing Prevention Cheat Sheet linked in Sources.
Attackers do not always guess passwords for one account. OWASP's Credential Stuffing Prevention Cheat Sheet separates three attacks. We read it in full on 15 November 2026. We did not read the NIST and ASVS documents it references.
| Attack | What it is (OWASP) |
|---|---|
| Brute force | Many passwords against a single account |
| Credential stuffing | Username and password pairs from another site's breach |
| Password spraying | One weak password against many accounts |
OWASP says the defences are largely the same for all three.
Start with MFA
OWASP calls MFA by far the best defence against most password-related attacks, cites a Microsoft analysis (we did not read it and do not repeat its figure), and says passkeys (FIDO2) and other forms make MFA attainable for most uses. Risk-based prompting is one option for balancing usability and security, not a reason to weaken a mandatory MFA policy. Signals that can trigger additional checks include: new browser or device or IP; unusual country; an untrusted country or an IP on denylists or tied to proxy and VPN services; an IP that has tried many accounts; or scripted, bot-like volume. A "step-up" check can also guard high-risk actions such as large transactions or admin changes, and enterprise apps can allow-list trusted IP ranges. If you cannot require MFA for everyone, OWASP suggests requiring it for administrators. See our MFA article.
When MFA is not possible
OWASP says none of the alternatives matches MFA alone, but layers give reasonable protection. Its list:
- Do not use security questions as an extra challenge. If you use a secondary secret, ask for all of it, not selected characters, and note that a second knowledge factor is not MFA.
- CAPTCHA: can slow automation but can be defeated by tools and services. Watch solve rates for harm to real users or abnormally high rates that may suggest automated solving. Consider showing it only for risky logins.
- IP mitigation: blocking is easy to get around and should not be the main defence. Use graduated responses; do not rely on a single predictable volume limit; look at burst and long periods, and at low but steady traffic spread over many addresses. Consider address type (residential or hosting) and location. Block temporarily and have a way to lift blocks. OWASP notes toolkits can spread requests over proxy networks, which can defeat blocklists and per-IP rate limits, and that correlating with proxy and hosting-provider ranges can help. Consider storing each account's IP history.
- Device fingerprinting (OS, browser, language, and via JavaScript screen size, fonts, plugins): compare with known devices for the account and prompt for more checks on mismatch. It can be spoofed, and users have several devices, so it is a signal and not a block. Let users view and manage remembered devices.
- Connection fingerprinting (for example JA3, HTTP/2 and header order): focuses on how a connection is made. Example: a mobile user agent but a Python-like connection is suspect.
- Unpredictable usernames: many sites use email as username, which makes breached lists reusable. Letting users choose a username makes it harder; generated usernames help more but are unfriendly and must not be predictable (sequential IDs, names).
- Multi-step login: entering username and password in separate steps, or fetching a token first, adds work for off-the-shelf tools. Do not let it enable user enumeration.
- Require JavaScript and block headless browsers: forces attackers to use real or headless browsers. Blocking users without JavaScript can exclude legitimate users; assess accessibility and applicable law rather than assuming that screen readers all disable JavaScript.
- Degradation: slowing the attack with heavier JavaScript, proof-of-work puzzles, long waits, large responses or randomised errors. It needs a context-specific risk assessment and weighing of user impact.
- Check for leaked passwords: screen new passwords against breached datasets; OWASP names Pwned Passwords, which you can host yourself or call by API.
Security questions
Do not use them as an extra challenge.
Secondary secret
Ask for all of it, not selected characters - and a second knowledge factor is not MFA.
CAPTCHA
Can slow automation but can be defeated by tools and services; watch solve rates for harm to real users.
Defence in depth and metrics
Plan for any single defence failing: client-side defences can be spoofed. Each defence should produce metrics, both detected and mitigated attack volume, filterable by IP, to reveal failures and unknown attacks. If different teams run different defences, coordinate changes.
Telling users
Warn about unusual events without flooding them. OWASP's example: do not notify about an ordinary wrong password, but do notify when a correct password was followed by a failed MFA check. If someone requests multiple resets from different devices or IPs, consider holding access pending further verification. Consider the user's email may also be compromised. Show details of recent logins (previous login time and place) and let users list and end active sessions.
Questions for your team
- Do we offer or require MFA, and for whom?
- What happens if one IP, or a thousand, try many accounts?
- Do we check new passwords against breached lists?
- Can we see attack and mitigation volumes?
Limits
One OWASP page, read in full. It gives no thresholds, rates or numbers, and neither do we. Fingerprinting and IP intelligence raise privacy questions that need your own review. Tools it names (Sentry MBA, fingerprintjs2) were not examined.
By Omnistu.