Skip to content

In-depth lesson · OTP brute force

Typical fixes

Every point the OTP brute force reports back under this heading, best-backed first, each with the reports it is seen in.

Back to the lesson 1 to 12 of 12
  1. Enforce server-side rate limiting, attempt limits and lockout on every OTP verification endpoint.

    Seen in 8 reports
  2. Make the OTP success decision on the server and issue a verified session only on success.

    Seen in 6 reports
  3. Expire OTPs after a short period and invalidate all previous codes when a new one is issued.

    Seen in 5 reports
  4. Bind each OTP to the specific email, phone number and session it was issued for.

    Seen in 3 reports
  5. Key rate limits on trusted server-side identity rather than client IP or client-supplied headers.

    Seen in 3 reports
  6. Generate OTP length and value server-side, never from a client-supplied parameter.

    Seen in 2 reports
  7. Disable default test phone numbers and test accounts in production.

    Seen in 1 report
  8. Normalise email addresses for case and reject duplicates at registration.

    Seen in 1 report
  9. Never return the OTP value in the network response.

    Seen in 1 report
  10. Invalidate reset tokens after use and enforce retry limits per account rather than per token.

    Seen in 1 report
  11. Base lockout timers on server time rather than the device clock.

    Seen in 1 report
  12. Draw backup codes from a large character set and limit regeneration.

    Seen in 1 report