Skip to content
Account takeover Write-up Beginner

When “One‑Time” Isn’t One‑Time: How a Simple OTP bypass

The OTP login flow allowed the same 4-digit code to be reused multiple times within its 30-minute lifespan and had no rate limiting, so an attacker could brute-force the code and obtain a valid authentication token. This affected multiple branded apps sharing the same backend, enabling full account takeover.

Ali Mezar Follow

Published on medium.com

It started with a single login request. A 4-digit SMS code, a mobile number, and a “Login successful” message.

Ali Mezar, 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 backend failed to invalidate OTPs after first use and lacked rate limiting or attempt throttling on the OTP verification endpoint.

Impact

An attacker could brute-force the OTP and obtain a valid token, leading to full account takeover across multiple apps sharing the same backend.

What the attacker needed

Access to the login endpoint; victim's mobile number

How it was found

  1. Send a login request with a mobile number and a 4-digit OTP code.
  2. Observe that the same OTP code can be reused multiple times within its 30-minute lifespan.
  3. Use a different mobile number and send an OTP code from your end.
  4. Run a multi-threaded script to try every 4-digit combination from 0000 to 9999.
  5. Find a valid OTP in under 5 minutes and obtain a user token.
  6. Use the token in the X-Authorization-Token header to access authenticated API endpoints.

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 to prove it's you. Here, the server did not invalidate the code after it was used and did not limit how many times someone could guess, so an attacker could try all 10,000 possible 4-digit codes and log in as any user.

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.

More by Ali Mezar

View all

1 more disclosed report, best first.

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.