Skip to content
Account takeover Write-up Intermediate

OTP Is Not Always Secure: From a Simple Email Input to Account Co

The application accepted an email field containing a victim address plus an injected cc/bcc recipient, so OTP codes were delivered to the attacker's inbox as well. By combining this with an email-change flow that validated only the primary address and a manipulated response, the attacker could bind their account to the victim's email and share the victim's session until the OTP expired.

Kanishkakhandelwal Follow

Published on cyber-tech-by-kk.medium.com

Hi, let me introduce myself — I’m Kanishka Khandelwal, currently working as an Associate Security Engineer, and apart from my day job, I spend most of my time doing bug bounty.

Kanishkakhandelwal, on cyber-tech-by-kk.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 email parameter was passed unsanitised into the mail delivery layer, and different code paths parsed the same value inconsistently (registration treated the whole string as one identity, while validation extracted only the first address).

Impact

The attacker could gain unauthorised access to the victim's account data and functionality, though the shared session only lasted until the OTP session expired.

What the attacker needed

OTP-only authentication (no password); Attacker can register an account; Victim has an account on the target

How it was found

  1. Register with an email value that appends a cc or bcc recipient to the victim's address.
  2. Observe that the OTP is delivered to both the victim and the attacker inbox.
  3. Log in to the attacker-controlled account and open the email change function.
  4. Submit the victim's address with an appended bcc recipient; the app replies that the email is already in use.
  5. Intercept the response and change the error status to a success status.
  6. Use the OTP received in the attacker inbox to complete the email change to the victim's address.

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 sign up with an email address, the site sends a one-time code (OTP) to prove you own that inbox. Here the site passed the email field straight to its mail system, so adding a second address after a comma made the code go to the attacker too. The attacker then used that code to attach their own account to the victim's email address.

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 Kanishkakhandelwal

View all

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