Rate Limiting and Account Lockout Policies
What you'll learn: How to defend against brute force, dictionary, credential stuffing, and password spraying attacks without locking out legitimate users.
The Core Defense Mechanism
When attackers try to guess passwords through brute force or dictionary attacks, they need to make many login attempts. Rate limiting and account lockout policies act like bouncers at a club—they restrict how many failed attempts are allowed before taking defensive action.
Rate limiting restricts the speed of login attempts (e.g., "only 5 attempts per minute from this IP address"). Account lockout temporarily disables an account after a threshold of failed attempts (e.g., "lock account for 15 minutes after 5 wrong passwords").
The Balance Challenge
Think of it like a spam filter: too strict and legitimate emails get blocked; too lenient and spam floods through.
Too strict lockout policies create problems:
- Attackers can intentionally lock out legitimate users (denial of service)
- Users forget passwords and get frustrated
- Support teams get overwhelmed with unlock requests
Too lenient policies allow:
- Brute force attacks to continue unchecked
- Credential stuffing campaigns to succeed
- Password spraying to test common passwords across many accounts
Effective Implementation Strategies
Combine multiple layers:
- Progressive delays: First failure = instant retry, third = 5 seconds, fifth = 30 seconds
- IP-based rate limiting: Limit attempts per IP address to catch distributed attacks
- Account-based throttling: Slow down after several failures, but don't completely lock
- CAPTCHA challenges: After 3-5 failures, require human verification instead of full lockout
- Monitoring and alerting: Log suspicious patterns for security team review
Key Takeaway: Effective rate limiting uses progressive delays and multiple detection layers to stop automated attacks while minimizing impact on legitimate users who simply mistyped their password.