Skip to content
Account takeover Write-up Beginner

Watch out the links : Account takeover!

An email-change verification link was not tied to the session of the user who requested it, so whoever clicked the link had their own account's email changed to the new address. An attacker could send their own verification link to a victim, and if the victim clicked it, the victim's account email would be replaced with the attacker's address, leading to account takeover.

Akash Hamal Follow

Published on akashhamal0x01.medium.com

Today we will discuss a case of what happens if there is poor session management. The worst is it can lead to account takeover!

Akash Hamal, on akashhamal0x01.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

This write-up is about a class of bug that comes from poor session management around email change verification links. The feature in question is the ordinary profile setting where a user updates their email address. Normally, when a user changes their email from the profile settings, a verification link is sent to the new address, and once that link is clicked the user's email is updated on the website. That is how it is supposed to work.

The question the researcher set out to answer was what happens if the verification link, instead of being clicked by the intended user, is clicked by another user. Will it update the other user's email? The researcher describes this as a manual approach, tested against roughly 10 to 15 public and private programs to confirm the idea was legitimate. Only one program was found vulnerable, and a second one was an external program. The impact in the worst case is account takeover, which is the main focus of the article.

Setup

To reproduce the test you need two accounts on the target site. The researcher uses the example names [redacted] and [redacted], treating them as the victim and the attacker respectively. No specific tools, versions or headers are described; the approach is manual.

The precondition is that the target has an email change flow that sends a verification link to the new address, and that clicking the link is what commits the change on the site.

Finding it

The idea came to the researcher months before finding a target: what if a link meant to be clicked by a user to update something is clicked by another user, and the details are updated? The report's explanation is simply that there was no session validation, so whoever clicks the verification link has their account updated to the new email.

Because this was only a theory, the researcher went looking for it in real targets. The search was manual and covered about 10 to 15 public and private programs, with only one found vulnerable and a second one being an external program.

Exploitation

Step 1: Create the two accounts

Create two accounts on the target site, for example [redacted] and [redacted], assuming them to be the victim and the attacker respectively.

Step 2: Request an email change from the attacker account

Go to the attacker account and change the email to [redacted]. A verification link is then sent to [redacted].

Step 3: Copy the verification link

Copy the verification link that was sent to the new address.

Step 4: Open the link in the victim's session

Paste that link into the web session of the [redacted] account. If the site is vulnerable, the email of the victim is updated to [redacted].

On the target the researcher tested, the site was vulnerable and did update the victim's email when the verification link was clicked. The reason given is that there was no session validation, so whoever clicks the verification link has their account updated to the new email.

POC of one of my private report! From the original on akashhamal0x01.medium.com

The image is the proof of concept from one of the researcher's private reports, showing the original report, which the researcher describes as fairly simple.

Timeline

The report was submitted on October 24, 2021, and was triaged and paid instantly on October 26, 2021. Although the issue required a single user click, the team decided to reward it as critical because it was the first high severity vulnerability on their program.

Root cause

The mistake is the absence of session validation when the verification link is clicked. The report only says there was no session validation, so whoever clicks the link has their account updated. As a result, any session that opens the link has its own account updated to the new email address.

Impact

The maximum impact described is account takeover. In the demonstrated case, the victim's account email is changed to the address from the attacker's pending change. The researcher notes that this is just one case with maximum impact, and that in other cases the impact depends on the context: there may be links on a website which, when clicked, change something in your account, and the severity changes accordingly.

The report notes that the issue required a single user click. The researcher also found a similar issue in a bitcoin website that was hosted externally, and was rewarded for it.

Fix

The report does not describe what the program changed. The report does not describe a fix.

Variants to test

The researcher's general advice is to identify links on a website which, when clicked, change something in your account, use them in your other account, and see if they change something. A positive result is any state change applied to the second account when the link was generated for the first. Concrete places to look:

  1. Email change verification links, as in this report. A positive result is the second account's email being updated to the address from the first account's pending change.
  2. Other account-setting confirmation links that change something in your account. A positive result is the second account's setting being changed by a link generated for the first.
  3. Any link that performs an action on click without checking which session opened it. A positive result is the action being applied to the wrong account.

The researcher notes that this tip was already shared on their Twitter handle, and that the proof of concept image mentions 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. 6 min read.

What happened, in plain words

Imagine you change your email address on a website. The site sends a confirmation link to the new address. You click it, and your account is updated. That is normal. But what if someone else clicks that link while logged in as a different user? Does the site update their account instead? This write-up shows that on one website, it did. The researcher changed the email on an attacker account, copied the confirmation link, and opened it while logged in as a victim. The victim's email was changed to the attacker's chosen address. That is account takeover: the victim's email was changed to the attacker's chosen address. The bug happened because the website did not check which user was clicking the link. It just applied the change to whoever was logged in.

The researcher tested this idea on about 10 to 15 public and private bug bounty programs. Only one was vulnerable. A second one was an external program. The report was submitted on 24 October 2021 and paid two days later.

Background: what is a session, and why does it matter?

When you log in to a website, the server gives your browser a small piece of data, often called a session cookie or token. Your browser sends it back with every request so the server knows who you are. Think of it like a wristband at an event: you show it at the door, and staff let you in without asking for your ID every time. If the server does not check the wristband when you perform an action, anyone can do that action as you.

In this case, the action is changing your email address. The website sends a verification link to the new address. Clicking that link is supposed to prove you own the new address. But the server also needs to check that the person clicking is the same person who requested the change. If it does not, the link works for anyone.

The idea

The researcher asked: what if a link meant to be clicked by one user to update something is clicked by another user, and the details are updated? This is a theory about missing session validation. The report says there was no session validation, so whoever clicks the link has their account updated. So any session that opens the link gets its own account updated.

Setting up the test

You need two accounts on the target website. The researcher uses [redacted] and [redacted] as examples. No special tools are needed: just a browser and the ability to log in to two accounts.

The target must have an email change feature that sends a verification link to the new address, and clicking that link is what actually changes the email on the site.

Step-by-step exploitation

Step 1: Create two accounts

Create two accounts on the target site. For example, [redacted] and [redacted]. Treat the first as the victim and the second as the attacker.

Step 2: Request an email change from the attacker account

Log in as the attacker. Go to the profile settings and change the email to [redacted]. The site will send a verification link to [redacted].

Step 3: Copy the verification link

Copy the verification link that was sent to [redacted].

Step 4: Open the link while logged in as the victim

Log in as the victim (or use the victim's existing session). Paste the copied link into the victim's web session. If the site is vulnerable, the victim's email will be changed to [redacted].

On the website the researcher tested, this worked. The victim's email was updated. The reason: there was no session validation. Whoever clicks the verification link has their account updated to the new email.

POC of one of my private report! From the original on akashhamal0x01.medium.com

The image shows the proof of concept from one of the researcher's private reports. It displays the original report, which the researcher describes as fairly simple.

Timeline

The report was submitted on 24 October 2021. It was triaged and paid instantly on 26 October 2021. Although the attack required a single click by the victim, the team rewarded it as critical because it was the first high-severity vulnerability on their program.

Why it works

The mistake is that the email change verification endpoint does not check the session. So any session that opens the link gets its own account updated to the new email address.

Impact

The maximum impact is account takeover. In the demonstrated case, the victim's account email is changed to an address the attacker controls. The victim's account email is changed to an address from the attacker's pending change. The researcher notes that this is just one case with maximum impact. In other cases, the impact depends on the context: there may be links on a website which, when clicked, change something in your account. The severity changes accordingly.

The report notes that the issue required a single user click. The researcher also found a similar issue in a bitcoin website that was hosted externally, and was rewarded for it.

Fix

The report does not describe what the program changed. The report does not describe a fix.

Variants to test

The researcher's general advice is to identify links on a website which, when clicked, change something in your account. Use them in your other account and see if they change something. A positive result is any state change applied to the second account when the link was generated for the first. Concrete places to look:

  1. Email change verification links, as in this report. A positive result is the second account's email being updated to the address from the first account's pending change.
  2. Other account-setting confirmation links that change something in your account. A positive result is the second account's setting being changed by a link generated for the first.
  3. Any link that performs an action on click without checking which session opened it. A positive result is the action being applied to the wrong account.

The researcher notes that this tip was already shared on their Twitter handle, and that the proof of concept image mentions it.

Glossary

  • Account takeover (ATO): When an attacker gains control of another person's account, often by changing the email or password so the original owner cannot log in.
  • Session: A period of interaction between a user and a website, identified by a cookie or token so the server remembers who is logged in.
  • Session cookie / token: A small piece of data stored by the browser and sent with requests to prove the user's identity.
  • Session validation: The server checking that the session making a request is allowed to perform that action.
  • Verification link: A URL sent by email that, when clicked, confirms ownership of an email address or approves a change.
  • Endpoint: A specific URL or function on a server that performs an action when requested.
  • State-changing action: An action that modifies data, such as changing an email address or password.
  • Bug bounty program: A program run by an organisation that rewards security researchers for finding and reporting vulnerabilities.
  • Public program: A bug bounty program that anyone can participate in.
  • Private program: A bug bounty program that only invited researchers can access.
  • Triaged: When a bug bounty program reviews a report and confirms it is a valid vulnerability.
  • Critical severity: The highest level of risk in many bug bounty programs, often indicating potential for full system compromise or account takeover.
  • Proof of concept (POC): A demonstration, often with screenshots or steps, that proves a vulnerability exists.
  • Manual approach: Testing by hand, without automated tools.
  • External program: A bug bounty program hosted on a platform other than the one where the researcher normally works, or a program for a target outside the main scope.

More by Akash Hamal

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.