Password Reset Vulnerability — Full Account takeover (Insecure Direct Object Reference)
The password reset process did not validate that the submitted username and email matched the security questions, allowing an attacker to change them to a victim's details and reset the victim's password. This enabled full account takeover without user interaction.
Published on web.archive.org
{{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 write-up describes a password reset flaw that allowed full account takeover on a private bug bounty program on HackerOne. The researcher is Muhammad Asim Shahzad, known as protector47, and the finding was published on 22 June 2019. The report does not name the target application or the program.
The feature involved is the application's forgot password flow. Unlike the common design where a reset link or token is emailed to the user, this application reset the password on the same page. The flow asked for a username, an email address and security questions, and then let the user set a new password directly. There was no password reset token functionality.

Setup
The researcher was testing a private bug bounty program on HackerOne. To demonstrate the issue he created two accounts on the application: one for the attacker and one for the victim. In the write-up these are shown as [redacted] for the attacker and [redacted] for the victim. The report does not give the tools used.
The precondition for the attack is knowing the victim's username and email address. The researcher notes that the target application was also vulnerable to user enumeration, which made obtaining those details practical. The attack itself requires no interaction from the victim.

Finding it
The researcher started by looking for user enumeration. He describes the forgot password panel as the best place to enumerate the registered users of an application, and he enumerated a user from it. While doing so he noticed that the application used a different mechanism to reset passwords.

Instead of sending a reset token, the flow took the username, the email and the security questions, and then allowed the user to reset the password on the same page. That design is what made the later manipulation interesting: the identity of the account being reset was carried in the request itself rather than bound to a token issued to a verified mailbox.
Exploitation
Step 1: Create two accounts
The researcher created two accounts on the application, one as the attacker ([redacted]) and one as the victim ([redacted]).
Step 2: Start the forgot password flow with the attacker's details
He went to the forgot password panel and entered the attacker account information.
Step 3: Submit the attacker's login ID and email
He entered the attacker's Login ID and Email and moved to the next step, which is Security Questions.
Step 4: Answer the security questions and intercept the request
He entered the attacker's Security Questions and intercepted the request. The report does not reproduce the raw request, so the exact parameter names and body are not shown.
Step 5: Inspect the intercepted request
In the intercepted request he found the security questions plus the email address and the username. The request therefore carried the identity of the account to be reset as ordinary client-supplied fields.
Step 6: Consider swapping the identity
He asked himself what would happen if he changed the email address and username to the victim's email address and username.
Step 7: Replace the email and username and forward the request
He changed the email address and username to the victim's email address and username and forwarded the request.
Step 8: Reach the password reset screen
He reached the password reset screen. At that point he was, in his words, totally blind as to which account's password would be reset once he updated it.
Step 9: Reset the password and confirm
He reset the password. He then received an email on the victim's email address saying that the password had been reset.

Celebration time :D
In summary, he entered the attacker's username, email and security questions on the forgot password panel, and before moving on to the password reset screen he changed the email and username to the victim's email and username. He reset the password and received an email on the victim's address saying the password had been reset.
Root cause
The server did not validate the inputs properly. The report frames this as a failure of input validation, which it calls one of the most important and necessary security controls. More specifically, the account to be reset was identified by client-supplied email and username fields in the security question request, and the server trusted those fields when performing the reset. The identity used for the reset was taken from the same request as the security question answers.
Because there was no password reset token, there was nothing tying the reset to a mailbox the requester had proven control of. The report attributes the flaw to improper input validation.
Impact
An attacker who knows a victim's username and email address can reset that victim's password and take over the account, without any interaction from the victim. The researcher demonstrated this by receiving the password reset notification on the victim's email address. The attack depends on knowing the victim's username and email, which the application's separate user enumeration issue made easy to obtain.
Fix
Variants to test
- Swap the identity fields in a security question step. Send the victim's email and username while answering the attacker's own security questions. A positive result is reaching the password reset screen and receiving the reset notification on the victim's address.
- Swap only one field at a time. Change the email but keep the username, then the reverse. A positive result is a reset on either account, which shows which field the server actually trusts.
- Reuse a completed reset step. After finishing the security question step for your own account, replay the next request with another user's identity. A positive result is a password change on the other account.
- Test other flows that carry identity in the body, such as email change or profile update, for the same trust in client-supplied identifiers. A positive result is a change applied to an account other than the one authenticated.
- Check whether the reset step accepts a request without any prior security question verification. A positive result is a password reset performed with no valid session or answer state.
What happened, in plain words
A security researcher found a way to take over any user's account on a website, without the victim doing anything at all. The trick was in the "forgot password" feature. Normally, when you forget your password, a site emails you a special link or code that proves you own the mailbox. This site did something different: it asked for your username, your email and your security questions, and then let you type a new password on the same page. There was no emailed link or code at all.
The researcher intercepted the request sent at the security question step and found it contained the username and email. He entered his own security questions, intercepted the request, and changed the email and username to the victim's. He reset the password and received an email on the victim's address saying the password had been reset. The victim got an email saying the password had been reset, and the researcher got a $1,200 bounty.
The finding was published on 22 June 2019 by Muhammad Asim Shahzad, known online as protector47. It came from a private bug bounty program on HackerOne. The report does not name the application or the program.

The pieces you need to know first
Before the steps make sense, here are the ideas involved, explained from zero.
- A web request. When you fill in a form and press a button, your browser sends a message to the website's server. The server reads it and sends a reply. Think of it as posting a form to an office: the office only knows what is written on the paper you sent.
- Fields in a request. The paper has labelled boxes:
username,email, and so on. The server usually trusts the labels but should not blindly trust the contents, because the browser, and therefore the user, can change them. - An intercepting proxy. A tool that sits between your browser and the website. It pauses each request so you can read it, edit it, and then let it continue. It is like a postal worker who lets you open and rewrite a letter before delivering it.
- User enumeration. Finding out which usernames or email addresses are registered on a site. If a site answers differently for a real account and a fake one (for example, "email sent" versus "no such user"), you can build a list of real users. The forgot password form is a classic place to do this.
- A password reset token. A long random code a site emails to you. You click the link or paste the code, and the site checks it before letting you set a new password. The token proves you can read that mailbox. This application had no such token.
- Security questions. Extra questions (mother's maiden name, first pet, and so on) used as a second proof of identity. They are weaker than a token because the answers can often be guessed or found.
- IDOR (Insecure Direct Object Reference). A bug where the server lets you name the object you want to act on (an account, a file, an order) using an identifier you supply, and does not check that the object belongs to you. Here the "object" is the account whose password gets reset, and the identifier is the username and email in the request.
- Account takeover. Gaining control of someone else's account, usually by changing their password so the real owner is locked out.
- Input validation. The server checking that what it received makes sense and is allowed. The report calls it one of the most important and necessary security controls.
Setting up the test
The researcher was testing a private bug bounty program on HackerOne. A bug bounty program is a site's offer to pay researchers who report security bugs responsibly instead of exploiting them.
To show the bug safely, he made two accounts on the application: one for himself as the attacker, and one to act as the victim. In the write-up these appear as [redacted] for the attacker and [redacted] for the victim. The report does not say which tools he used.
Two things are needed before the attack works: the victim's username and the victim's email address. The researcher notes that the application was also vulnerable to user enumeration, which made getting those details practical. The attack needs no action from the victim at all.

How he found it
He started by looking for user enumeration. He describes the forgot password panel as the best place to enumerate the registered users of an application, and he enumerated a user from it. While doing that, he noticed the application reset passwords in an unusual way.

Instead of emailing a reset token, the flow took the username, the email and the security questions, and then let the user set a new password on the same page. There was no password reset token functionality. That design is what made the later manipulation possible: the identity of the account being reset travelled inside the request itself, rather than being tied to a token sent to a verified mailbox.
The exploitation, step by step
Step 1: Create two accounts
He created two accounts on the application, one as the attacker ([redacted]) and one as the victim ([redacted]).
Step 2: Start the forgot password flow with the attacker's details
He went to the forgot password panel and entered the attacker account information.
Step 3: Submit the attacker's login ID and email
He entered the attacker's Login ID and Email and moved to the next step, which is Security Questions. At this point the browser is about to send a request saying, in effect, "this is the account I want to reset".
Step 4: Answer the security questions and intercept the request
He entered the attacker's Security Questions and intercepted the request. Intercepting means the proxy holds the request before it reaches the server, so he can read and edit it. The report does not reproduce the raw request, so the exact parameter names and body are not shown.
Step 5: Inspect the intercepted request
In the intercepted request he found the security questions plus the email address and the username. That is the key observation: the request carried the identity of the account to be reset as ordinary fields the browser supplies. The request carried the identity of the account to be reset as ordinary fields.
Step 6: Consider swapping the identity
He asked himself what would happen if he changed the email address and username to the victim's email address and username. The question is the heart of the bug: does the server check that the identity in the request matches the account whose security questions were just answered?
Step 7: Replace the email and username and forward the request
He changed the email address and username to the victim's email address and username and forwarded the request. Forwarding means letting the edited request continue to the server. The security question answers stayed his own, because he only modified the email and username fields.
Step 8: Reach the password reset screen
He reached the password reset screen. At that moment he was, in his words, totally blind as to which account's password would be reset once he updated it. He reached the password reset screen but could not yet tell whose account would be reset.
Step 9: Reset the password and confirm
He reset the password. He then received an email on the victim's email address saying that the password had been reset. That email is the proof: the server had reset the victim's account, not his own.

Celebration time :D
In short, he entered the attacker's username, email and security questions on the forgot password panel, and before moving on to the password reset screen he changed the email and username to the victim's email and username. The server accepted the modified identity and reset the victim's password.
Why it worked
The server did not validate the inputs properly. The report frames this as a failure of input validation, which it calls one of the most important and necessary security controls. More precisely, the account to be reset was identified by client-supplied email and username fields in the security question request, and the server trusted those fields when performing the reset. The identity used for the reset came from the same request as the security question answers.
Because there was no password reset token, nothing tied the reset to a mailbox the requester had proven control of. The report attributes the flaw to improper input validation.
What an attacker could do with it
Anyone who knows a victim's username and email address can reset that victim's password and take over the account, with no interaction from the victim. The researcher demonstrated it by receiving the password reset notification on the victim's email address. The attack depends on knowing the victim's username and email, which the application's separate user enumeration issue made easy to obtain.
How to fix it
Other places to look for the same mistake
- Swap the identity fields in a security question step. Send the victim's email and username while answering the attacker's own security questions. A positive result is reaching the password reset screen and receiving the reset notification on the victim's address.
- Swap only one field at a time. Change the email but keep the username, then the reverse. A positive result is a reset on either account, which shows which field the server actually trusts.
- Reuse a completed reset step. After finishing the security question step for your own account, replay the next request with another user's identity. A positive result is a password change on the other account.
- Test other flows that carry identity in the body, such as email change or profile update, for the same trust in client-supplied identifiers. A positive result is a change applied to an account other than the one authenticated.
- Check whether the reset step accepts a request without any prior security question verification. A positive result is a password reset performed with no valid session or answer state.
Glossary
- Bug bounty program: a site's offer to pay researchers who report security bugs responsibly instead of exploiting them.
- Client-supplied field: a value in a request that the browser, and therefore the user, can set or change.
- Forgot password flow: the series of pages a site shows when you cannot log in and need a new password.
- HackerOne: a platform where organisations run bug bounty programs and researchers report findings.
- IDOR (Insecure Direct Object Reference): a bug where the server lets you name the object you want to act on using an identifier you supply, without checking that the object belongs to you.
- Intercepting proxy: a tool that pauses requests between your browser and the website so you can read, edit and forward them.
- Password reset token: a long random code a site emails to you, which you must present before setting a new password, proving you can read that mailbox.
- Private bug bounty program: a program visible only to invited researchers, not to the public.
- Security questions: extra questions used as a second proof of identity, weaker than a token because answers can often be guessed or found.
- Server: the computer that runs the website and answers the browser's requests.
- User enumeration: finding out which usernames or email addresses are registered on a site, often by comparing the site's replies for real and fake accounts.