Skip to content
Account takeover Write-up Intermediate

I Bypassed 2FA Using an Old Secret Key — Here’s How I Earned $500

The application allowed a user to re-enable two-factor authentication using an old secret key from a previous setup instead of generating a new one. An attacker who had previously obtained the secret key could re-enable 2FA without the user's knowledge.

whitehat29 Follow

Published on medium.com

As a bug bounty hunter, you’re always on the lookout for fresh targets and unexplored attack surfaces. Recently, I was testing a new application and stumbled upon a pretty standard feature — 2FA (Two-Factor Authentication).

Tanishx0h, 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 application did not invalidate the previous 2FA secret when 2FA was disabled, allowing it to be reused when re-enabling.

Impact

An attacker who had access to the user's 2FA setup code at any point could re-enable 2FA without the user's knowledge.

What the attacker needed

Attacker has previously obtained the 2FA secret key

The fix

The application should invalidate the previous secret key when 2FA is disabled and generate a new secret when re-enabling.

How it was found

  1. Log in to the website.
  2. Enable 2FA using a mobile authenticator app.
  3. Disable 2FA from the account settings.
  4. Log out of the application.
  5. Log back in and go to re-enable 2FA.
  6. Instead of scanning the new QR code, reuse the old secret key and enter a valid OTP from the old setup.

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 to logging in, often a code from a phone app. The app here let someone set up 2FA again using the same old secret code that was used before, instead of making a fresh one. If a bad person had seen that old code earlier, they could turn 2FA back on without the real user knowing.

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 whitehat29

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.