Skip to content
Account takeover Write-up Intermediate

Tale of account takeover — Sensitive info Disclosure + Broken Access Control

The registration endpoint leaked an authentication token for any email address, including existing accounts, allowing an attacker to log in as any user. The profile update endpoint did not require password confirmation, so an attacker could change the victim's email and then reset the password to take over the account.

Md Saqib Follow

Published on medium.com

Bounty$2,650 View original

HiMates, Myself Md Saqib from India I'm new to this bug hunting community, hope you are doing good. Today I'm gonna share an interesting Tale of Account Takeover Vulnerability on hackerone private Program.

Saqib Chand, 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 job portal site, run as a private program on HackerOne. Because the program was private, the author refers to it throughout as redacted.com. The site has candidate accounts: you sign up as a candidate, log in, and manage a profile. Registration, login, forgot password and profile management are the features involved in this chain.

The vulnerability is a chain of two issues: sensitive information disclosure of users' auth_token through an IDOR, and bypassing the password confirmation step through broken access control. Together they lead to account takeover.

Setup

The author signed up as a candidate and tested for CSRF and stored XSS on the profile without success. He then created a second account to test for IDORs and to understand how registration, login and forgot password work. Every request was intercepted in Burp Suite and the responses inspected.

Finding it

While registering the second account, the author intercepted every request. The site first asks for the email address to check whether it is already registered, and then the new email is entered and the response checked.

Leaking Auth_Token From the original on medium.com

The response contained a redirect_url with an auth_token in it:

Text
“redirect_url”:“/?auth_token=_v2_8dsf8as
[redacted]&contact_id=11cb26ae&e
xpire=1152315525”

The response contained a redirect_url with an auth_token in it: The author changed the email to one belonging to an already existing account.

Indirect Object Reference on auth leakage From the original on medium.com

This returned the auth_token of that existing account. In other words, the endpoint /candidate/create would hand out anyone's auth_token.

Exploitation

Step 1: turn the leaked token into a session

The author searched the Burp Suite proxy history to see where the auth_token is used, and found it is accepted directly as a login link:

He opened incognito mode, visited the link, and was logged in to the victim's account.

From the original on medium.com

Step 2: hit the password confirmation wall

Logged in as the victim, he opened the profile to see whether the password or email could be changed. The profile was not accessible: the site asked for password confirmation. Since the account was identified by the current cookie, the author reasoned that if he could change the victim's email address, he could then request a password reset link to his own mailbox.

From the original on medium.com

Step 3: learn the email change request on his own account

He logged in to his own account to see how changing an email works. The endpoint used to update or change the email is /api/profile, which takes a PATCH request with JSON formatted data:

JSON
{“email_address”:“[redacted]”}

Step 4: change the victim's email with the victim's cookie

He created a PATCH request on https://redacted.com/api/profile with his new email and JSON formatted body, using the victim's cookie:

Voila! Success!! From the original on medium.com

This succeeded: the password confirmation was bypassed and the victim's email was changed to the attacker's mail.

From the original on medium.com

Step 5: reset the password

With the victim's email now pointing at the attacker's mailbox, the author could request a password reset link, receive it in his own mail, and reset the victim's password. He attributes this to broken authentication on the profile update endpoint.

From the original on medium.com

The report was awarded 2500$ and resolved within 4 days.

Second endpoint

After the report was resolved, the author found another endpoint that bypasses the confirm password protection by changing the victim's email address:

Text
/contact/api/update/v1

He was awarded a further 150$ for that bypass.

Root cause

The email-check step of registration (/candidate/create) returns a redirect_url containing a valid auth_token for whichever email address is submitted, including an address that already belongs to an account. The token is then accepted as a login credential via the /?auth_token=...&contact_id=...&expire=... URL, so knowing a victim's email address is enough to obtain their session.

The second mistake is that the profile update endpoint /api/profile (and later /contact/api/update/v1) does not enforce the password confirmation that the profile page itself requires. The PATCH request with the victim's cookie succeeded, so the password confirmation was bypassed. The author describes this as broken authentication on the profile update endpoint.

Impact

An attacker who knows a victim's email address can obtain that victim's auth_token from the registration email-check endpoint, log in as the victim, change the victim's email to the attacker's own address, and then reset the password through the normal forgot-password flow. The result is full account takeover. The author demonstrated this on a private job portal program and was awarded 2500$ for the chain, with the report resolved in 4 days. He later found a second endpoint and was awarded 150$ for that bypass.

Fix

The report does not describe what the program changed. The report does not describe what the program changed or recommend fixes.

Variants to test

  1. Submit an existing account's email to registration or email-check endpoints and inspect the response for tokens, redirect_url values, contact_id or expire parameters. A positive result is a token that logs you in as that account.
  2. Look for login links of the form /?auth_token=...&contact_id=...&expire=... in proxy history and try them in a fresh incognito session. A positive result is being logged in without credentials.
  3. On your own account, capture the request that changes the email address, then replay it with another account's session cookie. A positive result is the victim's email changing without a password confirmation prompt.
  4. Try alternative profile update endpoints such as /contact/api/update/v1 with the same PATCH body and a victim cookie. A positive result is the same email change succeeding through a second route.
  5. After any successful email change, run the forgot-password flow against the new address. A positive result is a reset link arriving in the attacker's mailbox for the victim's account.

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. 13 min read.

What happened, in plain words

A security researcher found a way to take over other people's accounts on a job portal website. The site let candidates sign up, log in and manage a profile. Two mistakes combined made the takeover possible.

First, the site's registration form had a step that checked whether an email address was already registered. The response to that check contained a redirect_url with an auth_token in it, even when the address already belonged to someone else. A token is a short piece of text that acts like a temporary key: whoever holds it is treated as logged in. So by typing a victim's email address into the registration form, the researcher received the victim's key.

Second, the site asked for the account password before letting someone change the profile email address, but only on the profile page itself. The behind-the-scenes request that saves the new email succeeded with the victim's cookie, without the password confirmation. So with the victim's key, the researcher could change the victim's email address to his own without knowing the password.

Once the victim's email address pointed at the researcher's mailbox, the normal "forgot password" feature did the rest: the reset link arrived in the researcher's inbox, and the researcher set a new password for the victim's account. That is a full account takeover.

The report earned 2500 USD and was resolved in 4 days. Later the researcher found a second endpoint with the same email-change weakness and earned a further 150 USD.

Background you need

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

  • A website and its API. When you click a button on a page, your browser often sends a separate request behind the scenes to a server, and the server answers with data rather than a finished page. That behind-the-scenes conversation is often called an API (application programming interface). Think of the page as the counter of a shop and the API as the back room: the counter shows you a form, the back room actually changes the records. A common mistake is to guard the counter but leave the back room open.
  • A cookie. A small note the website asks your browser to keep and to send back with every request. It is how the site remembers who you are between page loads. If someone else gets your cookie, the site cannot tell the difference between you and them.
  • A token. A piece of text that works like a key. Sometimes it is stored in a cookie; sometimes it is put in a link. Anyone who has the key is let in, so tokens must be kept secret and should expire.
  • IDOR (Insecure Direct Object Reference). When a website lets you name an object, such as an account, by an identifier, and does not check that the object belongs to you. A simple comparison: a cloakroom that hands over any coat to anyone who reads out a ticket number, without checking who is asking. If you can swap your ticket number for someone else's and get their coat, that is an IDOR.
  • Broken access control. The general name for the site failing to check whether you are allowed to do something. The password confirmation above is an example: the page asks, but the back room does not.
  • Account takeover. Exactly what it sounds like: an attacker ends up in control of someone else's account, usually by getting in, changing the contact email, and then resetting the password.
  • Burp Suite. A tool that sits between your browser and the website and lets you read and edit every request and response. The researcher used it to intercept requests and to look back through the history of everything the browser had sent.
  • Incognito mode. A browser window that starts with no cookies and no saved logins, which makes it a clean way to test whether a link really logs you in.
  • PATCH request. One of the standard ways a browser or tool talks to a server. A PATCH request means "change part of this record". The body of the request carries the new values, usually in JSON, a simple text format of names and values in curly brackets.

Setting up

The target was a job portal site, run as a private program on HackerOne. A private program means only invited researchers can test it, so the author refers to the site throughout as redacted.com. The site has candidate accounts: you sign up as a candidate, log in, and manage a profile. Registration, login, forgot password and profile management are the features involved in this chain.

The vulnerability is a chain of two issues: sensitive information disclosure of users' auth_token through an IDOR, and bypassing the password confirmation step through broken access control. Together they lead to account takeover.

The author signed up as a candidate and tested for CSRF and stored XSS on the profile without success. CSRF is when a site is tricked into accepting a request the user did not mean to send; stored XSS is when a site saves attacker-supplied script and runs it later in other people's browsers. Neither worked here, so he moved on.

He then created a second account to test for IDORs and to understand how registration, login and forgot password work. Every request was intercepted in Burp Suite and the responses inspected. In everyday terms: you first walk through the shop as a normal customer, noting which doors open and which forms send what, before trying anything unusual.

Finding it

While registering the second account, the author intercepted every request. The site first asks for the email address to check whether it is already registered, and then the new email is entered and the response checked.

Leaking Auth_Token From the original on medium.com

The screenshot is captioned Leaking Auth_Token and shows the response to that email check. The response contained a redirect_url with an auth_token in it:

Text
“redirect_url”:“/?auth_token=_v2_8dsf8as
[redacted]&contact_id=11cb26ae&e
xpire=1152315525”

Line by line, in plain words:

  • redirect_url is the name of a value in the response. It tells the browser where to go next, like a forwarding address written on an envelope.
  • /?auth_token=... is that forwarding address. The ? starts a list of values attached to the address, and auth_token is the key itself.
  • &contact_id=... is a second value, an identifier for the account contact.
  • &expire=... is a third value, a number that looks like an expiry time.

That looked wrong: the email-check step was returning a token for the account. A form that is only supposed to answer "is this address taken?" was also handing out a key. The author changed the email to one belonging to an already existing account.

Indirect Object Reference on auth leakage From the original on medium.com

This returned the auth_token of that existing account. In other words, the endpoint /candidate/create would hand out anyone's auth_token. The screenshot is captioned Indirect Object Reference on auth leakage, which is the IDOR: the form takes an identifier you supply (the email address) and returns the secret belonging to it, without checking that it is yours.

Exploitation

Step 1: turn the leaked token into a session

The author searched the Burp Suite proxy history to see where the auth_token is used, and found it is accepted directly as a login link:

This is the same shape as the leaked value: the site address, then ?auth_token=, then &contact_id= and &expire=. The https;// at the start is written with a semicolon in the report. The point is that the token is not just an internal value; it is accepted as a login credential when placed in the address bar.

He opened incognito mode, visited the link, and was logged in to the victim's account. Incognito matters here because it starts with no cookies, so there is no chance that his own logged-in session is what let him in. The only thing that could have logged him in is the token in the link.

From the original on medium.com

Step 2: hit the password confirmation wall

Logged in as the victim, he opened the profile to see whether the password or email could be changed. The profile was not accessible: the site asked for password confirmation. This is a sensible safety measure, like a bank asking for your PIN again before a transfer, because it means a stolen session alone is not enough to change the account's credentials.

Since the account was identified by the current cookie, the author reasoned that if he could change the victim's email address, he could then request a password reset link to his own mailbox. The logic: the site trusts the cookie to say who you are, so any request made with the victim's cookie is treated as coming from the victim. If the email change can be made without the password prompt, the reset flow will then send the victim's reset link to the attacker's inbox.

From the original on medium.com

Step 3: learn the email change request on his own account

He logged in to his own account to see how changing an email works. This is the careful part: he first watched the normal, legitimate request on an account he owned, so he knew exactly what the victim's request should look like. The endpoint used to update or change the email is /api/profile, which takes a PATCH request with JSON formatted data:

JSON
{“email_address”:“[redacted]”}

In plain words: the body is a single name and value pair. email_address is the field being changed, and the value after the colon is the new address. The curly brackets mark the start and end of the data. The request method is PATCH, meaning "change this part of the record".

Step 4: change the victim's email with the victim's cookie

He created a PATCH request on https://redacted.com/api/profile with his new email and JSON formatted body, using the victim's cookie:

Line by line:

  • PATCH https://redacted.com/api/profile is the request line: the method, then the address of the back-room endpoint that saves profile changes.
  • The blank line separates the request line from the body.
  • {“email_address”:“[redacted]”} is the body: change the account's email address to this new value.

The crucial detail is not in the text above but in what travels with it: the victim's cookie. The request is sent as if the victim's browser had sent it. If the endpoint had asked for the password, the request would have failed. It did not.

Voila! Success!! From the original on medium.com

This succeeded: the password confirmation was bypassed and the victim's email was changed to the attacker's mail. The screenshot is captioned Voila! Success!!. The lesson is the one from the shop comparison: the profile page asked for the password, but the back room did not, so talking to the back room directly skipped the check.

From the original on medium.com

Step 5: reset the password

With the victim's email now pointing at the attacker's mailbox, the author could request a password reset link, receive it in his own mail, and reset the victim's password. He attributes this to broken authentication on the profile update endpoint. In plain words: the site believed the cookie was enough proof of identity for a change that should have needed the password too.

The report was awarded 2500$ and resolved within 4 days.

From the original on medium.com

Second endpoint

After the report was resolved, the author found another endpoint that bypasses the confirm password protection by changing the victim's email address:

Text
/contact/api/update/v1

The report names this endpoint as another way to bypass the confirm password protection by changing the victim's email address. He was awarded a further 150$ for that bypass. The lesson for defenders: fixing one endpoint is not enough if another one writes to the same field.

Why it worked

The email-check step of registration (/candidate/create) returns a redirect_url containing a valid auth_token for whichever email address is submitted, including an address that already belongs to an account. The token is then accepted as a login credential via the /?auth_token=...&contact_id=...&expire=... URL, so knowing a victim's email address is enough to obtain their session. In everyday terms: the receptionist who is supposed to say "that name is taken" instead hands out the key to that person's locker.

The second mistake is that the profile update endpoint /api/profile (and later /contact/api/update/v1) does not enforce the password confirmation that the profile page itself requires. The PATCH request with the victim's cookie succeeded, so the password confirmation was bypassed. The author describes this as broken authentication on the profile update endpoint.

What an attacker could do

An attacker who knows a victim's email address can obtain that victim's auth_token from the registration email-check endpoint, log in as the victim, change the victim's email to the attacker's own address, and then reset the password through the normal forgot-password flow. The result is full account takeover. The author demonstrated this on a private job portal program and was awarded 2500$ for the chain, with the report resolved in 4 days. He later found a second endpoint and was awarded 150$ for that bypass.

How to fix it

The report does not describe what the program changed. The report does not describe what the program changed or recommend fixes. "Server-side" means the check happens in the back room, where it cannot be skipped by talking to the back room directly.

Things to try yourself

  1. Submit an existing account's email to registration or email-check endpoints and inspect the response for tokens, redirect_url values, contact_id or expire parameters. A positive result is a token that logs you in as that account.
  2. Look for login links of the form /?auth_token=...&contact_id=...&expire=... in proxy history and try them in a fresh incognito session. A positive result is being logged in without credentials.
  3. On your own account, capture the request that changes the email address, then replay it with another account's session cookie. A positive result is the victim's email changing without a password confirmation prompt.
  4. Try alternative profile update endpoints such as /contact/api/update/v1 with the same PATCH body and a victim cookie. A positive result is the same email change succeeding through a second route.
  5. After any successful email change, run the forgot-password flow against the new address. A positive result is a reset link arriving in the attacker's mailbox for the victim's account.

Glossary

  • API: the behind-the-scenes part of a website that receives requests and returns data, as opposed to the pages you see.
  • Account takeover: an attacker gaining control of someone else's account, here by changing the victim's email and resetting the password.
  • auth_token: the token the site uses to recognise a logged-in user; in this report it was leaked by the registration email check and accepted as a login link.
  • Broken access control: a site failing to check whether the person making a request is allowed to do it.
  • Burp Suite: a tool that intercepts and records the requests and responses between a browser and a website.
  • Cookie: a small note stored by the browser and sent with requests so the site can remember who you are.
  • CSRF: a class of attack where a site is tricked into accepting a request the user did not intend to send.
  • Endpoint: a specific address on a server that performs one job, such as /api/profile for profile updates.
  • Expire: a value attached to a token that indicates when it should stop being valid.
  • HackerOne: a platform where organisations run bug bounty programs and researchers report vulnerabilities.
  • IDOR (Insecure Direct Object Reference): a site letting you name an object by an identifier and returning it without checking that it belongs to you.
  • Incognito mode: a browser window that starts with no cookies or saved logins, useful for testing whether a link alone logs you in.
  • JSON: a simple text format for data, written as names and values inside curly brackets.
  • PATCH request: a request that changes part of a record on the server.
  • Private program: a bug bounty program open only to invited researchers.
  • redirect_url: a value in a response telling the browser where to go next.
  • Sensitive information disclosure: a site revealing data that should have stayed secret, such as another user's token.
  • Session: the period during which a site treats you as logged in, usually maintained by a cookie.
  • Stored XSS: a site saving attacker-supplied script and running it later in other users' browsers.
  • Token: a piece of text that works like a key; whoever holds it is treated as authorised.
  • UI-level check: a check that exists only on the page you see, and can be skipped by sending the request directly.

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.