CloudFlare Rate Limit Bypass — OTP Bruteforce using probabilistics leads to ATO
The OTP authentication system allowed up to four valid codes to exist simultaneously and had a rate limit that could be bypassed by accessing the origin IP directly, reducing the block time from 90 minutes to 50 seconds. An attacker could brute-force OTPs starting with '00' at a controlled rate, giving a 3.94% chance per attempt to take over an account without knowing the password.
Published on medium.com
The interesting functionallity is a OTP code as unique factor of authentication on
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 failed to invalidate previous OTPs upon issuing new ones and the rate limiting was enforced inconsistently between the CDN and the origin server, allowing bypass via direct IP access.
Impact
An attacker could take over any account by knowing only the victim's email address, with a 3.94% chance per attempt and a 50% chance after about 18 attempts (roughly 3 hours).
What the attacker needed
Victim's email address; ability to send OTP requests; origin IP discovery
The fix
The application should invalidate all previous OTPs when a new one is issued and enforce consistent rate limiting on the origin server, not just at the CDN.
How it was found
- Send four OTP codes to the victim's email address.
- Discover the origin server's IP address through an out-of-band request.
- Access the OTP validation endpoint directly via the origin IP to get a shorter block time.
- Brute-force OTPs starting with '00' at a medium request rate to stay under the rate limit.
- Repeat the process until the correct OTP is guessed and the account is taken over.
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 email, the system should only accept the most recent code and limit how many guesses someone can make. Here, the system kept several old codes valid at once and the guess limit could be dodged by connecting directly to the server instead of through the protective service. This let an attacker repeatedly guess codes until they got lucky and accessed someone else'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.