Skip to content
Account takeover Write-up Beginner

API Broken Authentication leads to account take-over

The password reset flow used a four-digit one-time password with no rate limiting on the OTP parameter. An attacker who knew a victim's email address could brute-force the OTP and set a new password for that account.

medium.com

Published on medium.com

Authentication is a crucial element of web API security. Web APIs employ different authentication mechanisms to ensure data confidentiality.

Tanmay Bhattacharjee, on medium.com

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 accepted unlimited attempts, so a four-digit code could be brute-forced.

Impact

An attacker who knows a victim's email address could take over the account by resetting its password.

What the attacker needed

Victim's email address known; no rate limit on OTP check; four-digit OTP

The fix

Rate limiting should be added to the OTP verification endpoint, and the current password should be required alongside the new one.

How it was found

  1. Request an email OTP for another user's account.
  2. Observe the response from the OTP request.
  3. Brute-force the four-digit OTP using a tool such as ffuf or Burp Suite.
  4. Use the recovered OTP to reset the other user's password.

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 reset a password, the site sends a short code to prove the account is yours. If the site lets someone guess that code over and over without slowing them down, a short code can be found quickly. Here the code was only four digits, so guessing every possibility was practical.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.