Skip to content
Account takeover Write-up Intermediate

A 10 000 Bug One Json Field Every Account On The Platform

The OTP validation endpoint accepted the phone number from the client's JSON body and used it to decide which account to authenticate, without binding the OTP to a server-side session for that number. An attacker with any valid OTP could swap in a victim's phone number and receive full access and refresh tokens for the victim's account.

LordofHeaven Follow

Published on infosecwriteups.com

Standard scope. Phone number login, OTP over SMS, the kind of flow that runs on hundreds of apps right now.

LordofHeaven, on infosecwriteups.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 step validated the code in isolation but did not bind it to a server-side session recording the phone number the code was issued for, then trusted the client-supplied phone number to select the account.

Impact

An attacker with any valid OTP for their own account could take over any other account on the platform, gaining access to order history, saved addresses, stored payment method details, active orders, loyalty credits and personal information.

What the attacker needed

A phone number registered on the platform; ability to intercept the OTP validation request; knowledge of the victim's phone number

The fix

The server should bind the OTP to a server-side session that records the phone number it was issued for, and validate the submitted code against that stored number rather than a client-supplied phone field.

How it was found

  1. Initiate login with the attacker's own phone number and receive a valid OTP by SMS.
  2. Intercept the OTP validation request before it is forwarded.
  3. Change the phone number in the JSON request body to the victim's number while keeping the attacker's valid OTP.
  4. Forward the request; the server returns access and refresh tokens for the victim's account.

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 sent by SMS, the server should remember which phone number it sent that code to. Here, the server instead believed the phone number the app sent back in the request. So someone could use their own real code but claim it was for someone else's number, and the server would log them into that other person's account.

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 LordofHeaven

View all

9 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.