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.
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).
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
- Log in to the website.
- Enable 2FA using a mobile authenticator app.
- Disable 2FA from the account settings.
- Log out of the application.
- Log back in and go to re-enable 2FA.
- 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.