0Pricing
Cryptology Academy · Lesson

Rate Limiting and Account Lockout Defenses

Examine server-side and protocol-level defenses that make brute force attacks impractical in practice.

Rate Limiting and Account Lockout Defenses is a free Cryptology Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Online vs Offline Brute Force

Online brute force attacks authenticate against live systems over a network. Each attempt takes at least one round-trip (typically 50-500ms), limiting an attacker to a few thousand attempts per minute at best. This is vastly slower than offline hash cracking. Rate limiting and account lockout exploit this limitation to make online brute force practically impossible within any realistic time frame.

Account Lockout After N Failed Attempts

The simplest defence against online brute force is locking an account after a defined number of consecutive failed login attempts, typically 5 to 10. The account can be locked for a fixed duration (15 minutes) or until an administrator manually unlocks it. Lockout turns an online brute force attack from a password cracking exercise into an exhaustion attack against account availability.

Denial of Service Risk from Lockout

Account lockout creates a denial of service vulnerability: an attacker who knows valid usernames can lock out all accounts by sending 5 failed attempts for each. This is a trade-off inherent in lockout policies. Some systems use temporary lockout (5 minutes) rather than permanent lockout to reduce DoS impact. Others do not lock accounts at all but instead use exponential backoff to slow attackers without enabling DoS.

CAPTCHA as Bot Deterrent

CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) requires solving a visual or audio challenge that is easy for humans but difficult for automated bots. Google reCAPTCHA v3 uses behavioural analysis instead of explicit challenges, assigning a risk score based on mouse movements, timing, and browsing history. CAPTCHA slows automated brute force significantly without locking accounts.

Exponential Backoff for Failed Attempts

Exponential backoff increases the wait time between allowed login attempts after each failure: 1 second after the first failure, 2 seconds after the second, 4 seconds after the third, and so on. After 10 failures the wait is over 17 minutes. This makes brute force extremely slow without locking the account entirely, avoiding the denial of service risk while still deterring automated attacks.

IP-Based Rate Limiting

IP-based rate limiting blocks or challenges login attempts from IP addresses that exceed a threshold of failures per unit time. If an IP submits 50 failed logins in one minute, subsequent attempts from that IP are blocked for an hour. Distributed attacks that use botnets with thousands of different IP addresses can evade simple per-IP limits, requiring more sophisticated velocity detection across multiple signals.

TOTP as a Brute Force Defeater

Time-based One-Time Passwords (TOTP, used in Google Authenticator and similar apps) generate a 6-digit code valid for 30 seconds. Even if an attacker brute forces the correct password, they also need the current TOTP code. With only 1 million possible 6-digit codes and a 30-second window, the practical window for TOTP brute force is tiny. MFA effectively eliminates password brute force as a viable attack vector.

bcrypt Work Factor Slows Hash Computation

bcrypt is a password hashing function with a configurable cost factor. At cost 10, bcrypt takes about 100ms to hash a single password. At cost 12, it takes about 400ms. This means an attacker cracking bcrypt hashes offline can test at most a few hundred passwords per second on a GPU, compared to billions per second for MD5. The work factor can be increased as hardware improves to maintain constant cracking difficulty.

Argon2 Memory Hardness

Argon2 won the Password Hashing Competition in 2015 and is the current recommendation for new systems. Its key property is memory hardness: it requires a configurable amount of RAM (typically 64MB to 1GB) to compute. This prevents GPU and ASIC acceleration because these devices have limited memory bandwidth. An attacker with a GPU that can run thousands of parallel bcrypt computations can only run a handful of Argon2 computations due to memory constraints.

WAF Rules for Credential Stuffing

Web Application Firewalls can detect credential stuffing by identifying patterns in failed login traffic: high volumes from single IPs, attempts using common username lists, anomalous geographic distribution of login attempts, and time patterns consistent with automated tools. WAF rules can block, challenge, or slow down suspicious traffic before it reaches the application. Modern WAFs integrate threat intelligence feeds for known botnet IP ranges.

HIBP API for Known-Breached Passwords

Integrating the Have I Been Pwned API into password change flows prevents users from setting passwords that appear in known breach databases. The API uses k-anonymity: only the first 5 hex characters of the SHA-1 hash are sent, protecting user privacy while allowing matching against 850 million known-breached passwords. Blocking breached passwords at registration eliminates a significant fraction of credential stuffing vulnerability.

Account Lockout

What is the main security risk created by strict account lockout policies that permanently lock accounts?

Rate Limiting and Account Lockout: Key Takeaways

Online brute force is limited by network latency; rate limiting and lockout exploit this. Account lockout stops brute force but enables denial of service attacks. Exponential backoff and CAPTCHA mitigate both risks. IP-based rate limiting catches single-source attacks. TOTP MFA effectively defeats password brute force. bcrypt and Argon2 slow offline hash cracking. HIBP API blocks known-breached passwords at registration.

Frequently asked questions

Is the “Rate Limiting and Account Lockout Defenses” lesson free?

Yes — the full text of “Rate Limiting and Account Lockout Defenses” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.

What will I learn in “Rate Limiting and Account Lockout Defenses”?

Examine server-side and protocol-level defenses that make brute force attacks impractical in practice. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cryptology Academy?

No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Rate Limiting and Account Lockout Defenses” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cryptology Academy lesson?

Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. How Brute Force Attacks Work
  2. Dictionary Attacks and Rainbow Tables
  3. Why Cryptographic Key Length Matters
  4. Rate Limiting and Account Lockout Defenses
← Back to Cryptology Academy