Skip to content
Account takeover Write-up Beginner

Bypassing OTP Verification: Exposing a Critical Authentication Flaw

The login API returned the one-time password in its own JSON response when a mobile number was submitted. An attacker could request an OTP for any victim's number, read it from the response, and log in as that user without access to their phone.

amanba13.ab Follow

Published on medium.com

As we know authentication mechanisms using OTPs (One-Time Passwords) are widely adopted to secure user accounts. However, improper implementation can lead to severe vulnerabilities, potentially allowing an attacker to bypass authentication and gain unauthorized access to any account.

Amandeep Singh, 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-generation endpoint included the generated code in its JSON response instead of only delivering it out-of-band via SMS.

Impact

Any account linked to a mobile number could be taken over, leading to data exposure and possibly fraudulent transactions.

What the attacker needed

Knowledge of victim's mobile number; ability to intercept HTTP responses

The fix

The OTP should never be included in API responses and should only be delivered via SMS or email, with server-side verification and rate limiting.

How it was found

  1. Capture the request where the user submits their mobile number for OTP verification.
  2. Inspect the server response and observe the OTP returned in plain text.
  3. Submit a victim's mobile number, extract the OTP from the response, and enter it on the login page.

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 is you. Here the server sent that code to the phone but also put it in the reply to the web page, so anyone who could see that reply could read the code. That let an attacker log in as any user whose phone number they knew.

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.