How I could Takeover any Account by Bypassing OTP Rate Limits
The OTP verification endpoint lacked rate limiting and did not invalidate previous OTPs when new ones were requested, allowing multiple valid codes to exist simultaneously. An attacker who knows a victim's email or phone number could request many OTPs and brute-force them to take over the account.
medium.com
Published on medium.com
Every penetration tester dreams of finding that one flaw that flips a security model upside down. In my recent assessment, I stumbled upon a surprisingly simple, yet devastating vulnerability in a Single Sign-In OTP flow.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the OTP verification endpoint lacked rate limiting and did not invalidate old OTPs upon issuing new ones, and OTP logic was not centralised across endpoints.
Impact
An attacker who knows a victim's email or phone number could collect many valid OTPs and brute-force the verification to take over the account.
What the attacker needed
Know victim's email or phone number; access to login flow
The fix
The vulnerability was fixed by enforcing strict rate limits, invalidating previous OTPs immediately, and centralising OTP logic.
How it was found
- Restart the login flow to get a new ticket_id.
- Duplicate the 'Send OTP' request 10–20 times in parallel.
- Observe that each request returns HTTP 200 and generates a unique valid OTP.
- Test multiple OTPs (first, last, random) and confirm all are valid until global expiry.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you log in with a one-time code (OTP), the server should only accept the most recent code and should block repeated guesses. Here, the server kept every code valid and allowed unlimited guesses, so an attacker could try many codes until one worked.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.