Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Credential stuffing attacks on your consumer login are growing every year. What long-term programme would you set beyond strong password hashing?

Strong hashing only protects passwords if our database leaks; credential stuffing uses passwords leaked from other sites, so the attacker logs in with a correct password. The long-term programme layers bot detection, rate limits per account and per source, and checks against known breached passwords, then reduces reliance on passwords with MFA and passkeys. Login monitoring with clear response procedures catches what gets through, and the account takeover rate tells us where to invest next.

Why this question is asked

Credential stuffing is the most common attack on consumer logins, and it grows every year because every new breach elsewhere adds to the attackers' lists. Interviewers ask this question to see whether a senior engineer understands the threat precisely, and can plan a programme over several years rather than reaching for one more tool. In this answer, we will see why hashing does not help here, then build the programme layer by layer: slowing the attackers down, making stolen passwords useless, detecting takeovers, and measuring the results.

1What Credential Stuffing Actually Is

In a credential stuffing attack, someone takes a list of email and password pairs leaked from another website and tries them on our login form, usually with automated tools and many IP addresses. Because people reuse passwords, a small share works. A hit rate of 0.1 to 2 percent sounds small, but a list of 10 million pairs at 0.5 percent is 50,000 accounts taken over.

Notice what this means for our defences. The attacker is not guessing; they are typing a correct password. Our password hash, however strong, plays no part, because hashing protects the passwords we store, and these passwords came from somewhere else. That is the first thing to say clearly to the people funding the programme.

2Layer 1: Make Automated Attempts Expensive

Stuffing works because it is cheap to try millions of logins. The first layer raises that cost. Rate limits apply on two axes: per account (for example five failed attempts in 15 minutes before a slowdown) and per source (IP address, network range, device fingerprint). Per-account limits alone fail because attackers try each account only once; per-IP limits alone fail because attackers rotate through thousands of residential proxies. Together they catch much more.

Bot detection adds signals that a script struggles to fake: browser integrity checks, the timing of keystrokes, whether the client ran our JavaScript. Most companies buy this from a specialist provider or their CDN, because attackers adapt quickly and keeping up is a full-time job. A challenge is shown only when risk is high, so normal users rarely see one.

Java
// Simplified per-account and per-source limit check in a Spring filter or login service
boolean allowed = limiter.tryAcquire("acct:" + email, 5, Duration.ofMinutes(15)) // per account
&& limiter.tryAcquire("ip:" + clientIp, 50, Duration.ofMinutes(5)); // per source
if (!allowed) {
return challengeOrDelay(); // show a challenge, never reveal whether the account exists
}

Notice that the response must not reveal whether the email exists. Different messages for unknown accounts and wrong passwords give attackers a free way to clean their lists.

3Layer 2: Refuse Known Breached Passwords

If attackers use leaked passwords, we can check passwords against large lists of known leaked ones at sign-up, at password change, and, carefully, at login. Services exist that allow this check without sending the password: the client sends only the first few characters of its SHA-1 hash and compares the returned candidates locally. In Spring Security, recent versions provide a CompromisedPasswordChecker for this (check your version).

At sign-up and password change we simply refuse a breached password. At login, a match is a strong signal: the password is valid but known to attackers, so we ask for a second factor or a reset instead of letting the login through.

4Layer 3: Depend Less on Passwords

The lasting fix is to make a correct password insufficient. Multi-factor authentication (MFA) asks for a second proof, such as a code from an app. Passkeys go further: they replace the password with a key pair held on the user's device, bound to our domain, so there is nothing to reuse or phish.

For a consumer product, forcing MFA on everyone usually costs too many customers, so we encourage it: offer passkeys at sign-up and after login, require a second factor for risky logins (new device, unusual country, breached password), and require it for sensitive actions. Each percentage point of active users on passkeys removes that share of accounts from the attacker's reach.

Step throughDefence layers against credential stuffing
  1. Bot detection and challengesstop scripted traffic before it reaches login
  2. Rate limits per account and per sourcemake each attempt expensive
  3. Breached password checksrefuse or step up on known leaked passwords
  4. MFA and passkeysa correct password is no longer enough
  5. Monitoring and responsedetect takeovers that get through, act quickly

5 layers, from the top down. Step through them one at a time.

5Layer 4: Detect Takeovers and Respond

Some attacks will get through, so we need to see them. We monitor login failure rates per minute, the ratio of failures to successes, logins from new devices followed by changes of email, phone or payout details, and many accounts logging in from one device. A sudden spike in failures across many accounts is the classic signature of a stuffing run.

Detection is only useful with a procedure behind it. We write down what happens when an alert fires: who is on call, how we raise challenge levels, how we lock and notify affected accounts, how we reset sessions, and how we contact customers. We practise it, because the first real attack is the wrong time to discover that nobody can change the bot rules at 3 a.m.

6Measuring and Adjusting Investment

The programme needs one outcome measure that leadership understands: confirmed account takeovers per million active accounts per month, with the money lost and the support cost attached. Supporting measures are the share of logins blocked as bots, the false-positive rate (real customers challenged or blocked), MFA and passkey adoption, and time to respond to an alert.

Each year we look at where takeovers still come from. If most now arrive through the mobile API, which lacks the web's bot protection, that is where the next investment goes. If takeovers are low but customers complain about challenges, we tune for experience. The measures turn a security budget into a decision we can explain.

7Follow-up questions

Why not just add a CAPTCHA to every login?

Because modern CAPTCHAs are solved by paid services and AI for a fraction of a cent, and they annoy every real customer. A challenge is useful as one tool, shown when risk is high, but it is not a programme on its own.

Do we need to protect the mobile and API logins separately?

Yes. Attackers move to the weakest entry point, often an old API used by the mobile app that has no bot detection. All login paths need the same limits and checks, ideally by routing them through one login service.

Should we force a reset when a user's password appears in a breach list?

At login, stepping up with a second factor or a reset is usually right for a known breached password. For accounts whose password has not been used since it appeared in a breach, an email asking them to change it, with a forced reset at next login, balances safety and annoyance.

8Conclusion

In this answer, we saw that credential stuffing uses correct passwords leaked elsewhere, so strong hashing does not stop it. The long-term programme layers bot detection and rate limits on two axes, breached-password checks, encouragement of MFA and passkeys, and monitoring with practised response procedures, and it is steered by the account takeover rate and the cost of false positives.

What to say in the interviewAbout 80 seconds aloud

Open with

First I would be clear that hashing does not help here: strong hashing protects our stored passwords if we leak, but stuffing uses passwords leaked from other sites, so the attacker submits a correct password.

Then, if they want more

The programme then has layers. The first makes automation expensive: bot detection, usually from a specialist provider, and rate limits on two axes, per account and per source, because attackers spread attempts across accounts and rotate IPs. Responses never reveal whether an account exists.

The second refuses known breached passwords at sign-up and password change, and treats a breached password at login as a reason to step up. The third reduces reliance on passwords: we offer and encourage MFA and passkeys, require a second factor for risky logins and sensitive actions, and track adoption.

The fourth is detection and response: monitoring failure spikes, new-device logins followed by changes to contact or payout details, and a written, practised runbook for raising challenge levels, locking accounts and notifying customers.

Finally I would measure confirmed account takeovers per million accounts, money lost and false positives, and each year move investment to wherever takeovers still come from, for example an unprotected mobile API.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring Security reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Credential stuffing attacks on your consumer login are growing every year. What...": https://scrivio-interview-library.netlify.app/spring-boot/authentication/1bc3012a69/