Skip to content
Account takeover Write-up Beginner

Misconfigured Reset password that leads to Account Takeover (No user Interaction ATO)

The password reset endpoint returned the reset token in its response for any valid username, allowing an attacker to obtain the token and construct a reset link to take over the account. The attacker could then perform actions such as diverting payments.

Aditya Sharma Follow

Published on medium.com

Bounty$5,000 View original

I hope you are all keeping yourselves safe and healthy through this challenging time, Aditya here today I would like to share one of my findings that I came across on a public program on Hackerone which I expect is known by many of them here, so let’s begin.

Aditya Sharma, 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The target was a well-known public program on HackerOne, described by the researcher as one of the leading online adult entertainment platforms. The domain involved was out of scope in the public program, but the same organisation ran a private program with a wide scope, and the researcher was invited to submit the finding there. Throughout the write-up the target is referred to as company.com.

The feature at the centre of the finding is the password reset flow on an affiliate registration page. Normally, a user who forgets their password enters a username, the application sends a reset link containing a unique token, and the user follows that link to set a new password. The reset page is built on AJAX requests, so the browser exchanges data with the server behind the scenes and updates parts of the page without reloading it.

Setup

No special accounts, roles, tools or versions are described. The researcher was testing the login page, the signup page and the forgot password functionality of the affiliate registration area. The token is returned for any valid existing username on the target.

Finding it

Testing the login and signup pages produced nothing impressive. There was an OAuth misconfiguration that led to an open redirect on the login page, and the forgot password functionality behaved as expected: it sent a reset token link when the action was performed, so there was no immediate luck there.

The researcher then looked at the page source of the application. Because the application works over AJAX, clicking forgot password causes no page reload and no visible process: the user simply receives a password reset link with a set of unique tokens, and an ordinary user has no idea what happens behind the scenes.

Pic 2: AJAX Working Process From the original on medium.com

In the XMLHttpRequest behind that flow there was an endpoint of the form:

HTTP
https://company.com/api/REDACTED/resetPasswordToken/

The response to that request looked somewhat like the screenshot below.

Forgot Password API Endpoint
Pic 3: Response of Vulnerable Endpoint From the original on medium.com

Exploitation

Step 1: Intercept the reset password request

The researcher intercepted the reset password request again. The endpoint took the following shape, with the username appended:

Step 2: Read the response

This time the focus was on the response received for the POST request, and it contained something unexpected. The response looked like this:

Pic 5: Password Reset Token in Response( Developer was high on grass that day) From the original on medium.com
JSON
{
 "id": 11077,
 "token": "4PjLzn7fyLU<Redacted>f1h1P2F",
 "stamp": 1628796031082,
 "username": "test13337"
}

Due to a server-side misconfiguration, the server leaks the reset token in the response for any user who requests it for any valid existing username. The response also returns the username itself, alongside an id and a stamp value.

Step 3: Build the reset link

The reset URL format looks somewhat like:

Text
https://www.company.com/#/changePassword/<username>/<token>

Since the response leaks both the username and the token, the attacker only has to substitute those values into the URL. The final reset link for the example above would be:

Text
https://www.company.com/#/changePassword/test13337/4PjLzn7fyLU<Redacted>f1h1P2F

Step 4: Take over the account

Following that link lets the attacker set a new password for the victim and take over any valid user's account. From there the attacker can perform any suspicious activities, and the researcher notes that payments could also be diverted to the attacker's crypto address, which made the issue critical.

Root cause

The mistake is on the server side: the endpoint that issues a password reset token returns the token itself in the HTTP response, instead of delivering it only through the out-of-band channel (the reset link sent to the account owner). Any caller who supplies a valid existing username receives that user's token. The report attributes this to a misconfiguration on the server side and does not show the underlying code, so the exact implementation flaw is not stated. The AJAX design of the page made the request and its response easy to observe in the browser, but the disclosure itself is a server-side decision to include the token in the response body.

Impact

An attacker who knows a valid username can obtain that user's reset token and take over the account without any interaction from the victim. The researcher describes this as allowing any suspicious activity on the compromised account, including diverting payments to a crypto address.

Fix

The report does not describe the fix that was applied. The change implied by the finding is to stop returning the reset token in the response body and to deliver it only to the account owner through the reset link, so that possession of a username is not sufficient to obtain a token.

Variants to test

  1. Request a password reset for a known username and inspect the full response body, including JSON fields such as token, stamp and id. A positive result is a token value in the response that can be placed into the reset URL and used to set a new password.
  2. Inspect the XMLHttpRequest calls made by AJAX-based forgot password forms in the browser's developer tools, looking for endpoints under paths such as /api/.../resetPasswordToken/ or /api/.../resetPassword. A positive result is an endpoint that accepts a username and returns reset material.
  3. Try the reset endpoint with a username that does not exist and compare the response with one for a valid username.
  4. A positive result is a token that works in the #/changePassword/<username>/<token> style URL for that user.

Timeline

Event Time
Issue found Aug 16th, 2021 9:30 PM IST
Issue reported Aug 16th, 2021 10:00 PM IST
Issue triaged Aug 16th, 2021 10:10 PM IST
Rewarded Aug 16th, 2021 10:30 PM IST with a $5000 bounty
Fixed Aug 17th, 2021 9:41 AM IST

The team validated and triaged the issue within 10 minutes of submission, and the researcher was rewarded with a $5000 bounty.

Pic 7: Reward for Vulnerability From the original on medium.com

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 10 min read.

What happened, in plain words

A security researcher was hunting for bugs on a public bug bounty program on HackerOne. A bug bounty program is a scheme where a company invites people to look for security problems in its systems and pays them for reporting what they find. The target was, in the researcher's words, one of the leading online adult entertainment platforms. The domain involved was out of scope in the public program, meaning it was not on the list of things the public program allowed people to test. The same organisation ran a private program with a wide scope, and the researcher was invited to submit the finding there. Throughout the write-up the target is called company.com.

The feature at the centre of the finding is the password reset flow on an affiliate registration page. An affiliate is a partner who promotes a site and earns a share of the money from the customers they bring in, so an affiliate registration page is where such partners sign up. A password reset flow is the everyday feature where you click "forgot password", type your username, and the site sends you a link that lets you choose a new password. Normally that link contains a unique token, a long random string that proves you are the person who owns the account. The reset page is built on AJAX requests. AJAX is a way for a web page to exchange data with a server behind the scenes and update parts of itself without reloading the whole page, a bit like sending a text message to a shop while you stand in it, instead of walking out and coming back in.

The problem was simple and serious: when the browser asked the server for a reset token, the server answered with the token itself in the response. Anyone who knew a valid username could ask for that user's token and use it to set a new password, taking over the account without the victim doing anything at all. The researcher exploited it within 5 to 10 minutes, reported it, and was paid a $5000 bounty.

Setup

The report describes no special accounts, roles, tools or versions. The researcher was testing the login page, the signup page and the forgot password functionality of the affiliate registration area, using nothing more than a browser and the ability to look at what the page sends and receives. The token is returned for any valid existing username on the target.

Finding it

Testing the login and signup pages produced nothing impressive. There was an OAuth misconfiguration that led to an open redirect on the login page. OAuth is a way for a site to let you log in with another service, such as "log in with Google", and an open redirect is a flaw where a site can be made to send you to an address chosen by an attacker. The forgot password functionality behaved as expected: it sent a reset token link when the action was performed, so there was no immediate luck there.

The researcher then looked at the page source of the application. Page source is the underlying text of a web page, which you can view in any browser. Because the application works over AJAX, clicking forgot password causes no page reload and no visible process: the user simply receives a password reset link with a set of unique tokens, and an ordinary user has no idea what happens behind the scenes.

Pic 2: AJAX Working Process From the original on medium.com

The screenshot shows the AJAX working process, the behind-the-scenes exchange that happens when the user clicks forgot password.

In the XMLHttpRequest behind that flow there was an endpoint of the form:

HTTP
https://company.com/api/REDACTED/resetPasswordToken/

An endpoint is a specific address on a server that does one job, like a service counter in a large building: you go to the right counter to get the thing you need. An API is the set of such endpoints a program uses to talk to a server. XMLHttpRequest is the browser mechanism that sends these behind-the-scenes requests. REDACTED marks a part of the path the researcher removed before publishing, so the exact wording is not shown.

The response to that request looked somewhat like the screenshot below.

Forgot Password API Endpoint
Pic 3: Response of Vulnerable Endpoint From the original on medium.com

The screenshot shows the response of the vulnerable endpoint, the answer the server sent back.

Exploitation

Step 1: Intercept the reset password request

The researcher intercepted the reset password request again. Intercepting means capturing a request between the browser and the server so you can read it and change it, usually with the browser's developer tools or a proxy tool. The endpoint took the following shape, with the username appended:

Here <username> is a placeholder for the actual username being requested. The researcher intercepted the reset request and watched what came back.

Step 2: Read the response

This time the focus was on the response received for the POST request, and it contained something unexpected. A POST request is one of the standard ways a browser sends data to a server, as opposed to simply asking for a page. The response looked like this:

Pic 5: Password Reset Token in Response( Developer was high on grass that day) From the original on medium.com

The screenshot shows the password reset token appearing in the response.

JSON
{
 "id": 11077,
 "token": "4PjLzn7fyLU<Redacted>f1h1P2F",
 "stamp": 1628796031082,
 "username": "test13337"
}

This is JSON, a common text format for structured data, where each field has a name and a value. Line by line:

  • "id": 11077 is a numeric identifier for the account.
  • "token": "4PjLzn7fyLU<Redacted>f1h1P2F" is the password reset token itself, the secret that should only ever reach the account owner. The middle part is redacted in the published report.
  • "stamp": 1628796031082 is a numeric value returned alongside the token.
  • "username": "test13337" is the username that was requested, returned back in the answer.

Due to a server-side misconfiguration, the server leaks the reset token in the response for any user who requests it for any valid existing username. A misconfiguration means the server was set up wrongly, not that the code was necessarily written with bad intent. The response also returns the username itself, alongside an id and a stamp value.

Step 3: Build the reset link

The reset URL format looks somewhat like:

Text
https://www.company.com/#/changePassword/<username>/<token>

This is the address of the page where a user chooses a new password. The two placeholders <username> and <token> are where the site expects the user's name and the secret token to appear. Since the response leaks both the username and the token, the attacker only has to substitute those values into the URL. The final reset link for the example above would be:

Text
https://www.company.com/#/changePassword/test13337/4PjLzn7fyLU<Redacted>f1h1P2F

In plain words: take the username from the response, take the token from the response, drop them into the two slots, and you have a working reset link that belongs to someone else.

Step 4: Take over the account

Following that link lets the attacker set a new password for the victim and take over any valid user's account. Account takeover means logging in as someone else and controlling their account. From there the attacker can perform any suspicious activities, and the researcher notes that payments could also be diverted to the attacker's crypto address, which made the issue critical. The attacker only needs the username.

Root cause

The mistake is on the server side: the endpoint that issues a password reset token returns the token itself in the HTTP response, instead of delivering it only through the out-of-band channel, meaning the reset link sent to the account owner. Any caller who supplies a valid existing username receives that user's token. The report attributes this to a misconfiguration on the server side and does not show the underlying code, so the exact implementation flaw is not stated. The AJAX design of the page made the request and its response easy to observe in the browser, but the disclosure itself is a server-side decision to include the token in the response body.

A useful comparison: a bank teller who, when asked "what is the balance on this account?", reads out the account holder's PIN as well. The customer asked a normal question, and the teller volunteered the secret.

Impact

An attacker who knows a valid username can obtain that user's reset token and take over the account without any interaction from the victim. The researcher describes this as allowing any suspicious activity on the compromised account, including diverting payments to a crypto address.

Fix

The report does not describe the fix that was applied. The change implied by the finding is to stop returning the reset token in the response body and to deliver it only to the account owner through the reset link, so that possession of a username is not sufficient to obtain a token.

Variants to test

If you want to look for the same kind of mistake on a site you are allowed to test, these are checks to consider:

  1. Request a password reset for a known username and inspect the full response body, including JSON fields such as token, stamp and id. A positive result is a token value in the response that can be placed into the reset URL and used to set a new password.
  2. Inspect the XMLHttpRequest calls made by AJAX-based forgot password forms in the browser's developer tools, looking for endpoints under paths such as /api/.../resetPasswordToken/ or /api/.../resetPassword. A positive result is an endpoint that accepts a username and returns reset material.
  3. Try the reset endpoint with a username that does not exist and compare the response with one for a valid username. Enumeration means using the site's answers to work out which accounts exist.
  4. A positive result is a token that works in the #/changePassword/<username>/<token> style URL for that user.

Timeline

Event Time
Issue found Aug 16th, 2021 9:30 PM IST
Issue reported Aug 16th, 2021 10:00 PM IST
Issue triaged Aug 16th, 2021 10:10 PM IST
Rewarded Aug 16th, 2021 10:30 PM IST with a $5000 bounty
Fixed Aug 17th, 2021 9:41 AM IST

The team validated and triaged the issue within 10 minutes of submission, and the researcher was rewarded with a $5000 bounty.

Pic 7: Reward for Vulnerability From the original on medium.com

The screenshot shows the reward for the vulnerability.

Glossary

  • AJAX: a technique where a web page exchanges data with a server in the background and updates parts of itself without reloading the whole page.
  • API: the set of addresses and rules a program uses to talk to a server, like a menu of services.
  • Account takeover: gaining control of someone else's account, usually by changing their password or session.
  • Affiliate: a partner who promotes a site and earns a share of the money from the customers they bring in.
  • Bounty: a payment a company makes to someone who reports a security problem to it.
  • Bug bounty program: a scheme where a company invites people to look for security problems and pays for reports.
  • Crypto address: a string that identifies where cryptocurrency can be sent, similar to a bank account number.
  • Endpoint: a specific address on a server that performs one job.
  • Enumeration: using a site's answers to work out which accounts or items exist.
  • HTTP response: the answer a server sends back to a browser after a request.
  • Intercept: capture a request or response between browser and server so you can read or change it.
  • JSON: a common text format for structured data, made of named fields and values.
  • Misconfiguration: a setting on a server or application that is set up wrongly.
  • OAuth: a way for a site to let you log in using another service, such as "log in with Google".
  • Open redirect: a flaw where a site can be made to send you to an address chosen by an attacker.
  • Out-of-band channel: a delivery route separate from the main request, such as an email sent to the account owner.
  • Page source: the underlying text of a web page, viewable in any browser.
  • POST request: a standard way for a browser to send data to a server.
  • Private program: a bug bounty program that only invited researchers can take part in.
  • Public program: a bug bounty program open to any researcher who follows its rules.
  • Rate limiting: a server rule that limits how many requests can be made in a period of time.
  • Scope: the list of systems and domains a bug bounty program allows researchers to test.
  • Token: a long random string used as proof of identity or permission, like a temporary key.
  • Triaged: reviewed and confirmed as a real, valid issue by the receiving team.
  • Username: the name that identifies an account on a site.
  • XMLHttpRequest: the browser mechanism that sends background requests for AJAX.

More by Aditya Sharma

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.