Security Playbook
14 · Authentication & sessionsOWASP A07:20256 min read

Brute force and credential stuffing: rate limiting logins

Attackers don't need to crack your hashes if your login form lets them guess forever. Online brute force, credential stuffing with leaked passwords, and the layered limits that stop them without locking out real users.

In one sentence

Limit guesses per IP and per account, slow down rather than lock out, block known breached passwords, and require MFA so a correct guess still isn't enough.

The idea

Brute force tries many passwords against one account. Password spraying tries one common password against many accounts. Credential stuffing replays email/password pairs leaked from other sites, betting that people reuse them. All three go through your normal login form.

Brute force vs rate limiting (simulated time)

The password is #4,812 in a leaked wordlist.

Guessing… ~0.1 h
Guesses tried
0
Guesses / hour
36,000
Simulated time
0 h
Status
…
Per-IP limits stop one machine; botnets spread the guesses across thousands of IPs. Limit per account too (with backoff, not permanent lockout), check passwords against breach lists, and add MFA.
One real second is two simulated hours. Turn on the botnet and see why per-IP limits alone aren't enough.

Layered limits

ControlStopsWatch out
Rate limit per IPA single machine hammering the formBotnets and proxies rotate IPs
Backoff per accountDistributed guessing on one accountHard lockouts let attackers lock out your users
Global anomaly alertsSpraying and stuffing across accountsNeeds a baseline of normal failure rates
Breached-password checkThe passwords attackers try firstRun it at sign-up and password change
MFA / passkeysCorrect guesses becoming takeoversPush MFA needs number matching against fatigue attacks
CAPTCHA after failuresCheap automated attemptsAccessibility cost; use as a step-up, not always

Key takeaways

  • 01Credential stuffing with leaked passwords is the most common login attack.
  • 02Rate-limit per IP and per account, with backoff instead of hard lockout.
  • 03Reject breached passwords and alert on unusual failure rates.
  • 04MFA means a correct password alone doesn't give access.

Check your understanding

1 of 3

What is the most common login attack today?

Related concepts