Skip to content
Account takeover Write-up Intermediate

2FA Bypass via redirect uri manipulation

The application decided whether two-factor authentication had succeeded by reading a redirect instruction in the HTTP response, rather than checking the OTP state on the server. An attacker who already knew the victim's email and password could change that redirect value in their proxy and land on the dashboard without a valid OTP.

ahmadfaizabdilla Follow

Published on medium.com

saya menemukan kerentanan pada publik bug bounty. Ini adalah kerentanan kritis pada mekanisme Two-Factor Authentication (2FA) aplikasi.

Ahmadfaizabdillah, 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 server issued a usable session before OTP verification and relied on a client-side redirect to gate access, instead of enforcing OTP state server-side on every request.

Impact

Full account takeover: the second factor becomes completely ineffective for anyone who already holds the victim's credentials.

What the attacker needed

Victim's valid email and password; a proxy tool such as Burp Suite; ability to intercept responses

The fix

The server should issue only a short-lived pre-auth token after the password step, verify the OTP entirely server-side, issue a separate full session only on success, and re-check the 2FA state on every sensitive request.

How it was found

  1. Log in with the victim's valid email and password so the 2FA prompt appears.
  2. Turn on interception in the proxy and submit an arbitrary OTP code.
  3. Switch the proxy to intercept the response to that request and forward the request.
  4. In the response body, change the redirect value from the failure path to the dashboard path.
  5. Forward the modified response so the browser navigates to the dashboard.
  6. Refresh the page and confirm the session stays valid.

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) is a second check after the password, usually a short code from a phone app. Here the server sent back a message saying 'go to the login page, the code was wrong', and the browser simply obeyed it. By editing that message in a proxy tool (software that sits between browser and server and lets you change traffic), the tester told the browser to go to the dashboard instead, and the site let them 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.

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.