Authentication

Implement Account Lockout and Login Throttling Carefully

Reduce credential-stuffing risk without creating an easy denial-of-service mechanism against legitimate users.

Login throttling limits repeated authentication attempts. A naive permanent lockout after a few failures can let attackers deny service to targeted accounts. A safer design combines rate limits, progressive delays, monitoring and recovery controls.

Apply multiple rate-limit dimensions

Limit attempts by account identifier and network source, while considering shared networks such as offices and mobile carriers. Normalize account identifiers consistently before counting. Avoid exposing whether an account exists through different error messages or timing.

Prefer progressive controls

Use short delays, temporary throttling or additional verification after repeated failures. Permanent account lockout should require a secure recovery path and careful abuse analysis. A per-IP-only limit is weak against distributed attacks, while a per-account-only lockout can be abused to block victims.

Store counters safely

Use atomic database updates or a dedicated rate-limit store so simultaneous requests cannot bypass counters. Define decay windows and cleanup policies. Do not trust client-supplied counters or hidden form fields.

Monitor and respond

Track suspicious patterns without logging passwords or sensitive authentication payloads. Alert on unusual spikes and credential-stuffing indicators. Ensure support staff have a documented process for helping legitimate users regain access.

Checklist

  • Rate-limit by account and source signals.
  • Avoid permanent lockout as the only defense.
  • Use atomic counters and defined decay windows.
  • Keep error messages consistent.
  • Monitor abuse and test recovery workflows.
Share this page Help other developers discover this resource.