Skip to content
Account takeover Write-up Beginner

OTP bypass via logic flaw

The server issued a valid JWT token immediately after password entry even when OTP was enabled, so the token could be used to access account data without completing the second factor. An attacker who obtained a password could bypass OTP entirely by using the token.

medium.com

Published on medium.com

Bug hunting is often like detective work — you see something small, and your “inner hacker” whispers: “What if…?”

Mohamed Abdelmoatie (3at3ot), 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

Likely the authentication flow issued the session token before verifying the second factor, so the OTP check was not enforced before granting access.

Impact

An attacker who stole or guessed a password could bypass OTP and access the account using the token.

What the attacker needed

Valid username and password; OTP enabled on the account

The fix

The server should only issue a session token after the OTP step has been successfully completed.

How it was found

  1. Log in with username and password and observe the server returning a JWT token.
  2. Enable OTP (2FA) on the account.
  3. Log in again and observe that a valid JWT token is still returned before OTP verification.
  4. Use the token to make an authenticated request, such as fetching profile data.

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, like a one-time code (OTP), after your password. Here, the website gave out a login token (JWT) right after the password, before the code was checked. Anyone with the password could use that token to get into the account without ever entering the code.

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.