Skip to content
Account takeover Write-up Beginner

Account takeover vulnerability that resulted in $2500 bounty!

The password reset response included a validationSession object containing the sessionId needed to reset the password. An attacker could request a reset for any email address, read the sessionId from the response, and use it to reset that user's password and take over the account.

Imad Husanovic Follow

Published on medium.com

Bounty$2,500 View original

In case you have any questions, or just wanna do some research with me, hit me up at @deadoverflow I decided to make a YouTube channel that teaches you how to actually find bugs, you can find the first episode here: https://youtu.be/fGMxekgqpm4

Imad Husanovic, 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. 3 min read.

Context

The target was a music streaming website. The researcher does not name it, citing privacy reasons, and notes that the issue has since been fixed. The feature under examination was the forgot password flow: a user submits an email address, the site sends a password reset link to that address, and the link lets the user set a new password.

Setup

No special tooling, roles or versions are described. The researcher worked against the live site's password reset functionality.

Finding it

The first attempts targeted the reset request itself. The researcher tried injecting a custom host header into the password reset request to see whether the generated link could be pointed elsewhere. That did not work. Further poking at how the reset was handled also came up empty: the site appeared to do everything the correct way, and the researcher decided to look elsewhere.

Before moving on, the researcher opened the response to the password reset request. The response contained an object called validationSession, which looked interesting. At first nothing seemed obviously wrong, but comparing that response with the reset link received by email made the problem clear.

From the original on medium.com

The response body carried a sessionId, and that same value was the code needed to reset the password, the one delivered in the email link.

From the original on medium.com

Exploitation

Step 1: request a reset for the victim's address

Submit the victim's email address to the forgot password endpoint. The report does not reproduce the request itself, only the response.

Step 2: read the session identifier from the response

The response contains a validationSession object with a sessionId field. That value is the reset code that would normally only reach the account owner by email.

Step 3: reset the password and log in

Use the sessionId to complete the password reset for the victim, then log in to the site as that user. The researcher states this worked without any issues whatsoever.

No raw request or response is included in the write-up, so the exact endpoint, parameters and body are not shown here.

Timeline

The researcher started at around 11:50 and reported the issue on 14 Sep 2023 12:19:33, roughly ten minutes of work. The report went to Bugcrowd.

From the original on medium.com

After the initial response the researcher was nervous but relieved, because the issue was confirmed not to be a duplicate. Six days after that initial response, the team awarded $2500.

From the original on medium.com

Root cause

The reset response contained a session identifier inside an object called validationSession. The identifier was also the secret embedded in the emailed reset link. Because the response was readable by whoever submitted the request, the secret was disclosed to the attacker rather than being confined to the mailbox owner.

The host header injection attempt did not work; the leak was in the response.

Impact

An attacker who knows a victim's email address can request a reset, take the sessionId from the response, set a new password and log in as that user. This is account takeover for an account whose email address the attacker knows. The researcher does not discuss rate limiting, MFA or other conditions that might narrow this.

Fix

The report does not describe the fix, only that the issue has been fixed.

Variants to test

  1. Request a password reset for your own account and inspect the full response body for any field that also appears in the emailed link or in the reset form. A positive result is a token, code or identifier in the response that the reset endpoint accepts.
  2. Repeat the same inspection on registration, email change, MFA enrolment and invitation flows. A positive result is any secret returned to the caller that is meant to be delivered out of band.
  3. Compare the response for a registered address with the response for an unregistered one. A positive result is a difference that confirms account existence or leaks a session for the registered case.
  4. Try the host header injection the researcher attempted, on the reset request and on any endpoint that builds links. A positive result is a reset link pointing at a host you control.
  5. Check whether a sessionId issued for one address can be used against another, and whether it survives a second reset request. A positive result is reuse or cross-account acceptance.

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 testing a music streaming website, the kind of site where you sign up with an email address and a password and then listen to songs. He does not name the site, for privacy reasons, and he says the problem has since been fixed.

He was looking at one particular feature: the "forgot password" button. You have almost certainly used one. You type your email address into a box, the site sends you an email containing a special link, and clicking that link lets you choose a new password. The whole point of the feature is that only the person who can read that email should be able to change the password.

What he found was that the website was handing out the secret part of that link to anyone who asked, in the reply it sent back to the browser. So he could type in somebody else's email address, read the secret from the reply, use it to set a new password on that person's account, and log in as them. That is called account takeover: you end up in control of someone else's account.

He reported it and was paid $2500. The whole thing took him about ten minutes to find.

Background you need first

A few ideas come up again and again below, so here they are from zero.

The website and the browser talk in requests and responses. When you click a button or submit a form, your browser sends a request to the website's computer (the server). The server sends back a response. A response has two parts: a status line and headers (small pieces of information about the reply, like what type of content it is), and a body (the actual content, such as the HTML of a page or a lump of data).

An API is the part of a website that answers in data rather than in pages. Many modern sites are built so that the page you see is drawn by your browser, and the browser fetches the raw information it needs from the server separately. That raw information often comes back as JSON, a text format for structured data that looks like {"name": "value"}. Think of a restaurant: the dining room is the web page you see, and the kitchen is the API. You do not walk into the kitchen, but your order goes there and food comes back. The problem in this story is that the kitchen was shouting the secret ingredient list out of the window.

A token (or session identifier) is a temporary secret that proves who you are. When you log in, the server does not want to check your password on every single click, so it gives your browser a long random string. Your browser sends it back with every request, and the server recognises you by it. It is like a cloakroom ticket: whoever holds the ticket gets the coat. If someone else gets your ticket, they get your coat.

A password reset token is the same idea, used once. The link in the reset email contains a long random code. The site's reset page takes that code and says, in effect, "this person proved they can read the mailbox, let them set a new password". The code is the proof. If the code leaks, the proof leaks.

A host header is a line in a request that says which website name you were trying to reach. Because one server can host many websites, the request includes something like Host: example.com so the server knows which one you mean. A classic attack is to put a different name there and hope the site builds its links using it, so the reset email points at the attacker's site instead. That is what the researcher tried first.

Bugcrowd is a bug bounty platform. Companies publish their programs there, researchers submit reports, and the platform handles triage (checking whether the report is real and new) and payment. A duplicate is a report of a bug someone else already reported; duplicates usually earn nothing, which is why the researcher was nervous.

The setup

The researcher did not use any special tools, accounts or software versions. He worked against the live website and could see the reset email arrive. That is all you need to repeat this kind of test: a browser, an account, and a way to read the reply the server sends back.

In a browser you can see responses using the developer tools, which open with F12 or a right-click and "Inspect"; the Network tab lists every request the page makes and lets you read each response.

Finding it

First idea: the host header

His first plan was the host header trick. The reasoning: if the site builds the reset link using the name in the request, and you can control that name, you can make the link point at a server you own. Then the victim clicks the link in their email, the secret code goes to your server, and you use it. It is a real technique and worth trying.

It did not work here. He also poked at the reset feature in other ways, looking at how the reset was handled, and found nothing. The site seemed to do everything the correct way. He decided to look somewhere else for a bug.

The turn: reading the response

Just as he was about to move on, he opened the response to the password reset request. This is the key habit in the whole story: not just looking at what the page shows you, but at the raw data the server sent back. In the response there was an object called validationSession, and it looked interesting to him.

From the original on medium.com

The screenshot shows the response body of the password reset request, with the validationSession object in it. At first he did not notice anything wrong. Then he looked at the password reset link that had arrived in his email, and things started to click.

From the original on medium.com

The second screenshot shows the email he received from that request. Comparing the two, he saw it: the response contained a sessionId, and that same value was the code needed to reset the password, the one delivered in the email link.

Put simply, the site was doing this:

  1. You ask to reset the password for some email address.
  2. The server creates a secret code and emails it to that address.
  3. The server also puts the same secret code in the reply it sends back to whoever made the request.

Step 3 is the bug. The secret is supposed to travel only to the mailbox owner. Instead it travels back to the person who asked, and that person can be anyone.

Exploitation

Step 1: request a reset for the victim's address

Submit the victim's email address to the forgot password feature. The report does not reproduce the request itself, only the response, so the exact address of the endpoint, the parameter names and the body are not shown.

Why this step: the reset flow only starts if you ask for it, and the leak only happens in the reply to that request.

Step 2: read the session identifier from the response

The response contains a validationSession object with a sessionId field. That value is the reset code that would normally only reach the account owner by email.

Why this step: this is where the secret is exposed. You are not guessing anything; you are reading a value the server volunteered.

Step 3: reset the password and log in

Use the sessionId to complete the password reset for the victim, then log in to the site as that user. The researcher states this worked without any issues whatsoever.

Why this step: the reset page accepts the code as proof that you own the mailbox. Since you have the code, the page believes you, and you set a new password. You set a new password and log in as that user.

No raw request or response is included in the write-up, so the exact endpoint, parameters and body are not shown here.

Timeline

The researcher started at around 11:50 and reported the issue on 14 Sep 2023 12:19:33, roughly ten minutes of work. The report went to Bugcrowd.

From the original on medium.com

The screenshot shows the response he got from Bugcrowd after submitting the report. After that initial response he was nervous but relieved, because the issue was confirmed not to be a duplicate. Six days after that initial response, the team awarded $2500.

From the original on medium.com

The last screenshot shows the reward: $2500 for the report.

Why it happened

The reset response contained a session identifier inside an object called validationSession. That identifier was also the secret embedded in the emailed reset link. Because the response could be read by whoever submitted the request, the secret was disclosed to the attacker instead of being confined to the mailbox owner.

The host header attempt did not work; the leak was in the response.

A useful comparison: a bank teller who writes the customer's PIN on the outside of the envelope as well as the letter inside. The letter is fine. The envelope is the problem.

Impact

An attacker who knows a victim's email address can request a reset, take the sessionId from the response, set a new password and log in as that user. This is account takeover for an account whose email address the attacker knows. The researcher does not discuss rate limiting, MFA or other conditions that might narrow this.

Fix

The report does not describe the fix, only that the issue has been fixed.

Variants to test

If you want to look for this kind of bug yourself, here are the same checks in beginner terms. Each one names what a positive result looks like.

  1. Request a password reset for your own account and inspect the full response body for any field that also appears in the emailed link or in the reset form. A positive result is a token, code or identifier in the response that the reset endpoint accepts.
  2. Repeat the same inspection on registration, email change, MFA enrolment and invitation flows. A positive result is any secret returned to the caller that is meant to be delivered out of band (that is, through a channel other than the response, such as email).
  3. Compare the response for a registered address with the response for an unregistered one. A positive result is a difference that confirms account existence or leaks a session for the registered case.
  4. Try the host header injection the researcher attempted, on the reset request and on any endpoint that builds links. A positive result is a reset link pointing at a host you control.
  5. Check whether a sessionId issued for one address can be used against another, and whether it survives a second reset request. A positive result is reuse or cross-account acceptance.

Glossary

  • Account takeover: gaining control of someone else's account, usually by changing their password or session so the real owner is locked out.
  • API: the part of a website that answers requests with data rather than with a finished web page.
  • Body: the main content of an HTTP response, such as a page or a block of data.
  • Bug bounty: a program where a company pays researchers for reporting security problems.
  • Bugcrowd: a platform that hosts bug bounty programs and handles report triage and payment.
  • Duplicate: a report of a bug that someone else already reported, usually unpaid.
  • Endpoint: a specific address on a server that accepts requests, for example the one that handles password resets.
  • Forgot password flow: the feature where you enter your email, receive a reset link, and use it to set a new password.
  • Headers: small pieces of information sent with a request or response, describing it rather than being its content.
  • Host header: a header in a request naming the website you are trying to reach, used when one server hosts several sites.
  • Host header injection: putting a different host name into that header to influence what the server does, for example which link it builds.
  • HTTP: the language browsers and servers use to exchange requests and responses.
  • JSON: a text format for structured data, built from names and values in braces.
  • MFA: multi-factor authentication, asking for a second proof of identity such as a code from a phone.
  • Out of band: delivered through a separate channel, such as email, rather than in the direct response.
  • Rate limiting: a server rule that limits how many requests you can make in a period of time.
  • Request: a message your browser sends to a server asking for something.
  • Response: the server's reply to a request, containing headers and a body.
  • Root cause: the underlying reason a vulnerability exists, as opposed to its visible symptom.
  • Session identifier (sessionId): a long random value that stands in for your login, proving to the server who you are.
  • Token: a temporary secret used as proof of identity or permission.
  • Triage: the process of checking a submitted report to confirm it is real, new and in scope.
  • Validation session: in this report, the server-side object that tracked the password reset attempt and carried the sessionId.
  • Vulnerability: a weakness in software that lets someone make it behave in a way its owners did not intend.

More by Imad Husanovic

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.