Skip to content
Account takeover Write-up Beginner

OTP Bypass in Email Verification via Response Manipulation During 2FA Setup Leading to Pre-Account Takeover !

The application allowed a user to register with an unverified email address and then enable two-factor authentication by intercepting and altering the server's response to mark the email as verified. An attacker could enable 2FA on an account with an email they do not control, potentially locking out the legitimate owner and leading to pre-account takeover.

Yahya Hammam Follow

Published on 1yz02.medium.com

While testing the Two-Factor Authentication (2FA) implementation of a web application, I discovered that i can bypass the email-based OTP verification through response manipulation

Yahya Hammam, on 1yz02.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 application relied on a client-side response flag to decide whether email verification succeeded, instead of validating the OTP on the server and enforcing that result server-side.

Impact

Attackers could enable 2FA on accounts with unverified or non-existent emails, which could lead to account lockout and pre-account takeover.

What the attacker needed

Ability to intercept and modify HTTP responses; registration without email verification

The fix

The server should validate the OTP itself and enforce the verification result server-side, never trusting a client-supplied flag.

How it was found

  1. Create a new account using an email address that you do not own; no email verification is required and the account is activated immediately.
  2. Attempt to enable two-factor authentication; the application requests email verification and sends an OTP to the provided email address.
  3. Enter an invalid OTP value.
  4. Intercept the verification request and then intercept the server response.
  5. Change the server-side verification flag in the response from false to true.
  6. Observe that the application accepts the invalid OTP, marks the email as verified, and continues the 2FA setup, displaying the authenticator app QR code.

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, the app should check that you really own the email address you gave. Here, the app asked for a code sent to that email, but the tester changed the app's own reply from 'wrong code' to 'correct code' using a tool that lets you edit network traffic. Because the app trusted its own reply instead of checking on the server, it let the tester turn on two-factor authentication for an email they did not own.

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 Yahya Hammam

View all

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