When Rate Limits Lie: A Quiet Path to Account Takeover
The OTP verification endpoint allowed 2000 requests per minute and enforced its rate limit using the client-supplied X-Forwarded-For header, so changing that header reset the counter. An attacker could therefore make unlimited OTP guesses against any account and potentially take it over.
medium.com
Published on medium.com
Yesterday, it was a great evening after spending time with school friends with the crazy vibe,with a coffee in my hand I started looking at a private program which looked so attractive, very modern and at first glance, nothing looked vulnerable.
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
The server used the client-controlled X-Forwarded-For header to identify the client for rate limiting instead of the real source IP.
Impact
An attacker could make unlimited OTP attempts and in the worst case take over user accounts, though the author stopped testing and no accounts were actually compromised.
What the attacker needed
Victim's mobile number known; no account needed to hit OTP endpoint
The fix
The server should enforce rate limits and lockouts using the real source IP seen at the network layer, not a header the client can set.
How it was found
- Observe the rate limit headers on the OTP verify endpoint showing 2000 requests per 60 seconds.
- Send repeated requests to the OTP verify endpoint and note that no meaningful lockout is enforced.
- Change the X-Forwarded-For header value on each request and observe the rate limit resetting each time.
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 sent to your phone, the site should only let you try a few codes before blocking you. This site counted attempts per IP address, but it read the address from a value the visitor's own browser sends, so a visitor could simply claim a new address each time and never be blocked. That means someone could keep guessing codes until they got into another person's account.
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.