Title: How a Simple Header Lets Attackers Bypass OTP Rate Limits
The OTP endpoint trusted the client-supplied X-Forwarded-For header to identify the requester's IP address, so rotating that header reset the per-IP rate limit. An attacker could therefore send unlimited OTP requests, enabling brute-force guessing of codes and service flooding.
Published on medium.com
Imagine a nightclub bouncer checking IDs — but accepting any scribbled note as valid. That’s essentially what happens when web applications enforce rate limits based on client-provided headers like X-Forwarded-For.
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 application used the client-controlled X-Forwarded-For header for rate limiting without validating it or restricting it to a trusted proxy.
Impact
Attackers could brute-force OTP codes for account takeover, flood the service to degrade performance or cause downtime, and automate abuse such as harassing users.
What the attacker needed
Access to the OTP endpoint; ability to set request headers
The fix
The application should stop trusting client-supplied headers for rate limiting, derive the client IP from the TCP connection or a trusted proxy, and combine IP limits with account-based limits, backoff, CAPTCHA and anomaly monitoring.
How it was found
- Send a normal OTP request to the registration endpoint.
- Repeat until the server returns a 429 Too Many Requests error after about 60 requests.
- Add a fake X-Forwarded-For header and change its value for each request.
- Observe that the rate limit counter resets for each new claimed IP, allowing unlimited OTP requests.
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.
A one-time password (OTP) is a short code sent to your phone or email to prove it is you. Websites often limit how many codes one IP address (a computer's network address) can request, to stop guessing. Here the site believed a fake address the attacker wrote in the request itself, so it thought every request came from a different computer and never blocked them.
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.