Skip to content
Account takeover Write-up Intermediate

2FA Bypass via Switching Between Email OTP and TOTP During Authen

The application allowed users to switch their two-factor authentication method during an active login challenge without verifying the currently configured second factor. An attacker who already knew a victim's email and password could replace the victim's second factor with their own authenticator and complete login, bypassing 2FA.

Mahmoud Magdy Follow

Published on medium.com

Back again with another interesting authentication flaw that resulted in a complete Two-Factor Authentication bypass.

Mahmoud Magdy, 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 permitted changing the active 2FA method during an ongoing authentication challenge without first verifying the user's currently configured second factor.

Impact

An attacker with valid credentials could bypass Email OTP, replace the victim's configured TOTP, register their own authenticator, and fully take over the victim's account.

What the attacker needed

Attacker knows victim's email and password; victim has 2FA enabled

The fix

Changing the authentication method should never be allowed until the currently configured second factor has been successfully verified.

How it was found

  1. Log in with valid credentials.
  2. Reach the OTP verification page.
  3. Switch the authentication method to TOTP.
  4. Scan the newly generated QR code.
  5. Generate a valid TOTP.
  6. Submit the code and login succeeds without verifying the victim's original second factor.

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.

Two-factor authentication (2FA) adds a second step after your password, like a code sent to your email or generated by an app. This site let someone change which second step is used while logging in, without proving they had the original one. So an attacker who already had the password could set up their own code generator and get in.

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 Mahmoud Magdy

View all

1 more disclosed report, 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.