Skip to content
Account takeover Write-up Beginner

Insecure OTP Mechanism: How I Discovered a Replay Attack Vulnerability

The application allowed the same one-time password to be reused multiple times, each time returning a new session identifier. An attacker who obtained a valid OTP could replay it to gain repeated access and potentially take over the account.

gowthami09027 Follow

Published on medium.com

Recently, while auditing an application’s authentication mechanisms, I unearthed a subtle but serious flaw in the way it handled One-Time Passwords (OTPs). Let me walk you through what I found, why it matters, and how we should fix it.

Blue_eye, 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 server did not mark OTPs as used after a successful validation, and the OTP validity window was too long.

Impact

An attacker who intercepts or otherwise acquires a valid OTP could replay it to gain fresh access repeatedly, potentially leading to session hijacking and full account takeover for as long as the OTP remains valid.

What the attacker needed

A valid OTP; ability to submit OTP requests

The fix

The application should invalidate OTPs after a single successful use, enforce a short expiry window, add anti-replay controls, rate limiting, secure storage, and audit logging.

How it was found

  1. Request an OTP for login or transaction.
  2. Use the OTP as intended and note the response.
  3. Replay the exact same OTP request multiple times, sometimes from different sessions or devices, within the validity window.
  4. Observe that each replay results in successful authentication with a new session identifier.

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 is meant to be used once and then stop working. Here, the system kept accepting the same code again and again, so anyone who saw or intercepted that code could keep logging in as the 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 gowthami09027

View all

4 more disclosed reports, 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.