Hard lockout-after-N is the simplest defense. Three more techniques are worth knowing for when the threat model warrants more sophistication.
1. Exponential backoff — slow down, don't lock out
Instead of "5 strikes, you're out", make each successive failure cost more time. The user barely notices; the attacker hits a wall.
2. Jitter — defeat timing side channels
The 0.5-second constant-time delay (Track 5) prevents response time from leaking info. Adding random jitter (e.g. 0.4–0.6s instead of exactly 0.5s) further muddies any statistical attack on timing.
3. Honeypot endpoints — spot reconnaissance
Add a fake endpoint like /wp-admin or /.env that always returns 404 but logs a "scanner detected" event and (optionally) blacklists the source IP.
What NOT to do
- Don't return different errors for "wrong PIN" vs "no such user" — it leaks user enumeration. Always the same response.
- Don't lock out on the username only in multi-user systems — attackers can DOS by trying many wrong PINs for one user. Per-IP lockout is correct.
- Don't show the attempt counter publicly ("3 attempts remaining") — that's free intel for the attacker. Show only "Invalid PIN".