Skip to content
Account takeover Write-up Intermediate

I Logged Into Any Account Without an OTP — Here’s How I F

The OTP verification endpoint accepted a client-supplied user_id and did not bind the OTP to the session or user, so an attacker could log in as any user by sending an invalid or brute-forced OTP with an enumerated user_id. The backend created an authenticated session and redirected to the victim's dashboard without properly validating OTP ownership.

Sumit Raj Follow

Published on medium.com

OTP-based authentication is supposed to be the final boss of login security. If you don’t have the code, you don’t get in.

Sumit Raj, 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

The application trusted a client-supplied user identifier and created an authenticated session before properly verifying that the OTP belonged to that user and session.

Impact

An attacker could take over any user account, access sensitive personal data, modify account settings, and perform actions as the victim, with no valid OTP and no victim interaction required.

What the attacker needed

A guessable user_id; no valid OTP needed; no victim interaction

How it was found

  1. Intercept the OTP verification request after submitting an OTP.
  2. Notice the request contains both an otp parameter and a user_id parameter.
  3. Change the OTP to an invalid value and observe that the response is not an error.
  4. Use Burp Intruder to brute-force OTP values and increment user IDs, watching for 302 redirects.
  5. View a 302 response in the browser and see that it opens another user's dashboard.

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 (OTP), the server should check that the code belongs to you and your login attempt. Here, the server let the browser say which user the code was for, and it started a logged-in session even when the code was wrong. That meant anyone could pretend to be another user just by changing a number in the request.

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.