How I Got $150 on HackerOne for My First Bug
Old 2FA recovery codes remained valid after a user disabled and re-enabled two-factor authentication, allowing an attacker with those codes to bypass 2FA and access the account.
Published on medium.com
{{media:0}}
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.
Context
This is the story of my first bug bounty finding, a 2FA recovery code issue in a private program on HackerOne. The affected feature is the two-factor authentication recovery code mechanism: when a user sets up 2FA, the system generates recovery codes that can be used to sign in if the second factor is unavailable. The report does not name the program, the product or the underlying technology stack.

Setup
I came across the issue in June 2024 in a private HackerOne program. No specific tools, versions or roles are described in the report.
Finding it
While testing the 2FA functionality, I looked at what happens to recovery codes when 2FA is turned off and then turned back on. The system kept accepting recovery codes that had been generated before 2FA was re-enabled. In other words, disabling and re-enabling 2FA did not invalidate the old set of recovery codes, so a code that should have been retired still satisfied the second factor.
Exploitation
Step 1: Enable 2FA
Set up 2FA on the account and generate recovery codes.
Step 2: Save the codes
Store the generated recovery codes securely so they can be used later.
Step 3: Disable 2FA
Turn 2FA off on the account.
Step 4: Re-enable 2FA
Reactivate 2FA on the same account.
Step 5: Sign out
Log out of the account.
Step 6: Log in with an old recovery code
Attempt to log back in using one of the recovery codes saved in step 2. Despite 2FA having been re-enabled, the old recovery code still worked.
The report does not include the raw HTTP requests or responses for any of these steps.
Root cause
The recovery codes were not invalidated when 2FA was disabled and re-enabled. The system appears to treat the previously issued codes as still valid after the new 2FA setup, rather than regenerating or revoking them. The report does not describe the implementation, so the exact mechanism is not stated; The report does not describe the implementation, so the exact mechanism is not stated.
Impact
An attacker holding old recovery codes could bypass the 2FA requirement and gain unauthorised access to user accounts. The report frames the consequences as data breaches, loss of sensitive information and unauthorised actions taken on behalf of users.
Fix
Variants to test
- Change the account password and then try old recovery codes. A positive result is a code still working after the credential change.
- Reset 2FA through account recovery and try codes from the previous enrolment. A positive result is an old code being accepted after the reset.
- Re-enrol the authenticator app without disabling 2FA and try old recovery codes. A positive result is a code from before re-enrolment still being accepted.
What happened, in plain words
This is the story of my first bug bounty finding. A bug bounty is a scheme where companies invite people to look for security weaknesses in their systems and pay for the ones that are reported responsibly. I found a weakness in how a website handled its two-factor authentication recovery codes, reported it, and was paid $150.
Two-factor authentication, usually shortened to 2FA, is a second proof of identity on top of your password. After typing your password, you also type a short code, often from a phone app. The idea is that a stolen password alone is not enough to get into the account. Recovery codes are a backup: a list of one-time codes you can use instead of the phone app if you lose your phone. Because they are a backup key to the account, they need to be handled carefully.
The problem was that when a user turned 2FA off and then turned it back on, the website kept accepting the recovery codes from the earlier setup. Old backup keys that should have stopped working still opened the door. Someone who had got hold of those old codes could get past 2FA and into the account.
I came across this in June 2024 in a private program on HackerOne. HackerOne is a platform where companies list their programs and researchers send in reports. A private program is one you can only see and test if you have been invited. The report does not name the program, the product or the technology behind it.

The setup
I did the testing in June 2024 against a private HackerOne program. The report does not describe any particular tools, software versions or user roles.
If you are new to this, the important idea is that you do not need special software to test a behaviour like this. The skill is in noticing that a security setting, once changed, should leave no old keys behind.
Finding it
While testing the 2FA feature, I asked a simple question: what happens to the recovery codes when 2FA is turned off and then turned back on? Turning a security feature off and on again is a normal thing users do, for example when they change phones. A well-built system should treat the second setup as a fresh start and retire everything from the first one.
This system did not. It kept accepting recovery codes that had been generated before 2FA was re-enabled. In plain terms, switching 2FA off and on again did not cancel the old set of backup codes. A code that should have been thrown away still counted as the second factor at login.
That is the whole weakness: a stale key that was never revoked. It is not a complicated attack. It is a housekeeping failure, and housekeeping failures around authentication are serious because authentication is the gate to everything else in the account.
Walking through the steps
These are the steps I followed to show the behaviour. Each one is something any user could do in a browser, and each one exists to set up the next observation.
Step 1: Enable 2FA
Set up 2FA on the account and generate recovery codes.
Why: this creates the first set of recovery codes, the ones that will later become the old codes. Without a first set there is nothing to test.
Step 2: Save the codes
Store the generated recovery codes securely so they can be used later.
Why: the test depends on having the old codes available after 2FA has been switched off and on. If you lose them, you cannot check whether the system still honours them. In real life an attacker who has stolen a copy of the codes is in exactly this position.
Step 3: Disable 2FA
Turn 2FA off on the account.
Why: this is the moment where a careful system should throw away the recovery codes, because the security setup they belong to no longer exists.
Step 4: Re-enable 2FA
Reactivate 2FA on the same account.
Why: this creates a new security setup. A careful system should generate a new set of recovery codes here and make sure the previous set can never be used again.
Step 5: Sign out
Log out of the account.
Why: logging out forces the next login to go through the full authentication flow, including the 2FA step. If you stayed signed in, you would never be asked for the second factor and the test would prove nothing.
Step 6: Log in with an old recovery code
Attempt to log back in using one of the recovery codes saved in step 2. Despite 2FA having been re-enabled, the old recovery code still worked.
Why: this is the actual test. The expected, safe result is that the old code is rejected. The result I saw was that it was accepted, which means the old backup key still opened the account after the security settings had been reset.
The report does not include the raw HTTP requests or responses for any of these steps. HTTP is the language a browser and a website use to exchange pages and form submissions; a request is what the browser sends, and a response is what the server sends back. Seeing those messages can help a reader repeat a test exactly, but here the steps are described in words only.
Why it happens
Recovery codes were not invalidated when 2FA was disabled and re-enabled. The system appears to treat the previously issued codes as still valid after the new 2FA setup, instead of regenerating them or revoking them.
A useful comparison is a hotel. When a guest checks out, the front desk should cancel their key card. If the same room is booked again and the old card still opens the door, then anyone who kept that card can walk in. Disabling 2FA is like checking out, and re-enabling it is like a new booking. The old card should never work again.
What an attacker could do with it
The impact is that an attacker holding old recovery codes could bypass the 2FA requirement and gain unauthorised access to user accounts. The report describes the possible consequences as data breaches, loss of sensitive information and unauthorised actions taken on behalf of users.
That limits who can exploit it, but it does not make it harmless. Recovery codes are often written on paper, saved in a notes app or stored in a password manager, and copies can leak. The whole point of 2FA is that a password alone is not enough; a recovery code that outlives its setup undermines that promise.
The fix
In the hotel comparison, the old key card must stop working the moment the guest checks out.
Other versions of the same idea to test
Once you understand the pattern, a stale key that is never revoked, you can look for it in other places. These are variations worth trying on a program that allows this kind of testing:
- Change the account password and then try old recovery codes. A positive result is a code still working after the credential change.
- Reset 2FA through account recovery and try codes from the previous setup. A positive result is an old code being accepted after the reset.
- Re-enrol the authenticator app without disabling 2FA and try old recovery codes. A positive result is a code from before re-enrolment still being accepted.
In each case the question is the same: when the security setup changes, does the system actually retire the keys that belonged to the old setup?
How I reported it and what happened next
After finding the issue I reported it on HackerOne. The process was straightforward: I gave a detailed description of the bug, the steps to reproduce it and its potential impact. The security team responded positively and I was awarded $150. Beyond the money, it was a significant milestone in my bug bounty journey.
For a first report, the lesson is that clarity matters as much as the finding. A reader on the security team should be able to follow your steps and see the same result without guessing.
Lessons learned
- Always test thoroughly: even after re-enabling security features like 2FA, test the whole flow, not just the happy path.
- Be detail-oriented: clear, complete reports help the security team understand the issue and what it means.
- Stay updated: keep an eye on security practices and updates so weaknesses are addressed promptly.
Glossary
- 2FA (two-factor authentication): a second proof of identity at login, on top of the password, such as a code from a phone app.
- Recovery code: a one-time backup code that can be used instead of the second factor if the usual method is unavailable.
- Bug bounty: a scheme where companies pay people for finding and responsibly reporting security weaknesses.
- Bug bounty hunter / researcher: the person who looks for and reports those weaknesses.
- HackerOne: a platform where companies list bug bounty programs and researchers submit reports.
- Private program: a bug bounty program that only invited researchers can see and test.
- Vulnerability: a weakness in a system that can be used to break its security.
- Bypass: getting past a security check without satisfying it properly.
- Authentication: the process of proving who you are, usually with a password and sometimes a second factor.
- Second factor: the additional proof required by 2FA, beyond the password.
- Enrolment / re-enrolment: setting up a security method such as 2FA, or setting it up again after a change.
- Invalidate / revoke: to make something, such as a code, stop being accepted.
- Regenerate: to create a fresh set of codes to replace the old ones.
- Root cause: the underlying reason a weakness exists, as opposed to its visible symptom.
- Impact: the harm that could result if a weakness is exploited.
- Exploit: to make practical use of a weakness to achieve an unauthorised result.
- HTTP: the language a browser and a website use to exchange requests and responses.
- Request: the message a browser sends to a server, for example when you submit a login form.
- Response: the message a server sends back to the browser.
- Data breach: an incident in which sensitive information is accessed or exposed without authorisation.
- Credential: a piece of information used to prove identity, such as a password.
- Authenticator app: a phone app that generates the short codes used as a second factor.