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.
-
Enforce server-side rate limiting, attempt limits and lockout on every OTP verification endpoint.
Seen in 8 reports
-
Make the OTP success decision on the server and issue a verified session only on success.
Seen in 6 reports
-
Expire OTPs after a short period and invalidate all previous codes when a new one is issued.
Seen in 5 reports
-
Bind each OTP to the specific email, phone number and session it was issued for.
Seen in 3 reports
-
Key rate limits on trusted server-side identity rather than client IP or client-supplied headers.
Seen in 3 reports
-
Generate OTP length and value server-side, never from a client-supplied parameter.
Seen in 2 reports
-
Disable default test phone numbers and test accounts in production.
Seen in 1 report
-
Normalise email addresses for case and reject duplicates at registration.
Seen in 1 report
-
Never return the OTP value in the network response.
-
Invalidate reset tokens after use and enforce retry limits per account rather than per token.
Seen in 1 report
-
Base lockout timers on server time rather than the device clock.
Seen in 1 report
-
High
-
-
Draw backup codes from a large character set and limit regeneration.
Seen in 1 report