Skip to content
Account takeover Write-up Intermediate

My Fourth Account takeover through password reset

The password reset token contained a predictable serial code rather than a random value, and the user ID was leaked when reporting an article. An attacker could brute-force the last three digits of the token to reset any user's password and take over their account.

Omar Hamdy Follow

Published on seaman00o.medium.com

Omar Hamdy

Omar Hamdy, on seaman00o.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 is a write-up of an account takeover found on a private Bugcrowd program. The researcher, Omar Hamdy (Seaman), refers to the target only as redacted.com. The feature involved is the password reset flow: a user enters their email address, and the application sends a password reset link to that address.

The site also lets users publish articles, and it has a feature for reporting a specific article. That reporting feature turns out to be central to the attack, because it leaks the user ID that the reset link needs.

Setup

The work was done against a private program, so there are no public scope details, versions or tool names in the report. The researcher's stated approach was to spend time on reconnaissance and then examine the password reset function, looking in particular for account takeover and Host Header injection issues. The attacker needs their own account to request a reset and observe the code, and the victim's user ID, which the reporting feature discloses.

Finding it

The researcher requested a password reset for his own account and looked at the link that arrived:

The link has two parts: a user ID and a 10-digit code. What made it interesting is that the 10-digit code is not random. It is a serial value. If a reset for the attacker's account produced the code 1618963650, then a reset requested for the victim's account would produce 1618963720: only the last three digits differ.

The remaining obstacle was the user ID, which was not public. The researcher spent more than two days looking for an endpoint that leaked it, including Google Dorks, without success. The leak came from the article reporting feature: when you report an article belonging to a user, that user's ID appears in the request.

Exploitation

Step 1: Request a reset for your own account

Request a password reset for the attacker's account and note the 10-digit code in the link that is sent. This gives the serial value from which the victim's code can be predicted.

Step 2: Request a reset for the victim's account

Request a password reset for the victim's account. The victim's link will carry a code close to the attacker's, differing only in the last three digits.

Step 3: Obtain the victim's user ID

Report an article belonging to the victim. The request made by the reporting feature contains the victim's user ID, which is the first part of the reset link.

Step 4: Swap the ID and brute force the last three digits

Change your own ID in the reset link to the victim's ID, keep the same 10-digit code, and brute force only the last three digits. The operation completes successfully, according to the report's steps. The link to attack is the update-password endpoint:

Root cause

The reset code is generated as a serial value rather than a random one, so a code observed for one account predicts the code for another account to within the last three digits. The user ID that the link also requires is treated as non-public, but the article reporting feature discloses it in its request. Together, the two parts of the link are either predictable or obtainable, and the small remaining search space of three digits can be enumerated. The report does not mention any rate limiting or attempt limit.

Impact

An attacker who can request a reset for their own account, request one for the victim, and learn the victim's user ID from the reporting feature can take over any user account by resetting its password. The researcher describes this as enabling takeover of any user account on the program. The attack depends on the serial behaviour of the code and on the ID leak; the report gives no further conditions.

Fix

The report does not say what was changed. A fix would need to make the reset code unpredictable and stop disclosing user IDs.

Variants to test

  1. Request two resets in a row for your own account and compare the codes. A positive result is a small, predictable difference, which suggests a serial generator.
  2. Request a reset for a second account you control and compare its code with the first. A positive result is a code that differs only in the trailing digits.
  3. Look for features that reference other users (reporting, sharing, mentions, comments) and inspect their requests for numeric or UUID identifiers. A positive result is a user identifier that matches the first part of a reset link.
  4. Try the reset endpoint with a valid ID and a code from a neighbouring range, watching for differences between invalid and valid responses. A positive result is a distinguishable response that allows enumeration of the remaining digits.

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

What happened, in plain words

A security researcher found a way to take over any user account on a website by abusing the password reset feature. The site was part of a private bug bounty program on Bugcrowd, so the researcher calls it redacted.com. The attack worked because the reset link contained two pieces of information that were either predictable or easy to obtain: a 10-digit code that was not truly random but followed a sequence, and a user ID that was supposed to be secret but leaked through another feature. By combining these, the researcher could reset another user's password and take over the account.

This article explains the whole story from scratch, assuming you only know how to use a browser. We'll go step by step, explaining every technical term along the way.

Background: what is a password reset?

Almost every website with user accounts has a "forgot password" or "reset password" feature. You click it, enter your email address, and the site sends you an email containing a special link. Clicking that link lets you set a new password. This is convenient, but it also means the link itself is a kind of key: anyone who has the link can change the password.

A typical reset link looks like this:

Let's break it down:

  • https:// is the secure protocol used to talk to websites.
  • redacted.com is the site's domain name (the address you type in the browser).
  • /update-password/ is the path on the server that handles password changes.
  • 12d52catcbc344ec-9871-85ac6390d863 is a long string that identifies the user. We'll call it the user ID.
  • 1621264272 is a 10-digit number. We'll call it the reset code.

When you click the link, the site checks that the user ID and the reset code match a pending reset request. If they do, it lets you set a new password. So to take over someone else's account, an attacker would need to know both parts of their reset link.

The researcher's approach

The researcher, Omar Hamdy (also known as Seaman), was working on a private bug bounty program. A bug bounty program is a scheme where companies pay people to find and report security problems in their systems. A private program means only invited researchers can participate, and the details are not public.

His first step was reconnaissance (often shortened to recon). This means exploring the site to understand how it works, what features it has, and where the interesting parts are. He then focused on the password reset function, because it is a common place for security bugs. Specifically, he was looking for two types of issues:

  • Account takeover (ATO): a flaw that lets an attacker gain control of someone else's account.
  • Host Header injection: a trick where an attacker manipulates the Host header that a browser sends to a server, sometimes causing the server to generate links that point to the attacker's site. We won't go deeper into that here because the report only mentions it as something he looked for.

To test the reset feature, he used his own account to observe the code and needed the victim's user ID. In a real attack, the victim would be any other user, but for testing, researchers often use two accounts they control.

Step 1: Request a reset for your own account

He started by requesting a password reset for his own account. He entered his email address, and the site sent him an email with a reset link. The link looked like the one above. The link contained a 10-digit code, shown here as 1621264272.

Why do this? Because he wanted to see how the code is generated. If the code were truly random, it would be different every time and impossible to guess. But he suspected it might follow a pattern.

Step 2: Request a reset for the victim's account

Next, he requested a password reset for the victim's account. The victim's reset link would be sent to the victim's email, which he doesn't control. But he didn't need to receive it; he only needed to know what the code would be. Based on his observation, the code is a serial value: a reset for the victim produced a code differing only in the last three digits. For example, if his own reset produced 1618963650, then a reset for the victim requested shortly after would produce 1618963720. Only the last three digits differ (650 vs 720). That means the unknown part of the victim's code is just those last three digits, which range from 000 to 999. That leaves the last three digits, a range of 100 to 999, to try. This is called a brute-force attack: systematically trying every possible value until one works.

Step 3: Obtain the victim's user ID

The reset link also contains the user ID, which is a long string like 12d52catcbc344ec-9871-85ac6390d863. The researcher needed the victim's user ID to construct the victim's reset link. At first, he couldn't find it anywhere public. He spent more than two days searching, even using Google Dorks (special search queries that can uncover exposed information), but found nothing.

Then he noticed another feature on the site: users can publish articles, and other users can report an article. When you report an article, your browser sends a request to the server. The researcher discovered that this request includes the user ID of the article's author. In other words, the reporting feature leaks the user ID. So by reporting an article written by the victim, he could learn the victim's user ID.

Step 4: Swap the ID and brute force the last three digits

Now he had both pieces: the victim's user ID (from the reporting feature) and a good guess for the reset code (the serial value with only the last three digits unknown). He took his own reset link and replaced his user ID with the victim's user ID, keeping the same 10-digit code. Then he performed a brute-force attack on the last three digits. The link to attack is:

He would brute force the last three digits until the server accepted one. According to the report's steps, once the correct code was found the operation completed successfully.

Why it worked (root cause)

The root cause is a combination of two weaknesses:

  1. Predictable reset code: The 10-digit code is generated as a serial number, not randomly. This means observing one code reveals the pattern and lets an attacker predict the next ones to within a small range.
  2. Leaked user ID: The user ID is treated as a secret, but the article reporting feature discloses it in its request. So the attacker can obtain it.

Together, these make the reset link guessable. The report does not mention any rate limiting or other protection against the brute force.

Impact

An attacker who can request a reset for their own account, request one for the victim, and learn the victim's user ID from the reporting feature can take over any user account by resetting its password. The researcher describes this as enabling takeover of any user account on the program. The attack depends on the serial behaviour of the code and on the ID leak; the report gives no further conditions.

Fix

The report does not say what was changed. A fix would need to make the reset code unpredictable and stop disclosing user IDs.

Variants to test

If you want to look for similar bugs, here are some tests you can try:

  1. Request two resets in a row for your own account and compare the codes. A positive result is a small, predictable difference, which suggests a serial generator.
  2. Request a reset for a second account you control and compare its code with the first. A positive result is a code that differs only in the trailing digits.
  3. Look for features that reference other users (reporting, sharing, mentions, comments) and inspect their requests for numeric or UUID identifiers. A positive result is a user identifier that matches the first part of a reset link.
  4. Try the reset endpoint with a valid ID and a code from a neighbouring range, watching for differences between invalid and valid responses. A positive result is a distinguishable response that allows enumeration of the remaining digits.

Glossary

  • Account takeover (ATO): A security breach where an attacker gains unauthorised access to someone else's account.
  • API: Application Programming Interface; a set of rules that lets different software components communicate. In web terms, it's often the way a browser talks to a server behind the scenes.
  • Brute-force attack: Trying every possible combination (like all 1000 three-digit numbers) until the correct one is found.
  • Bug bounty program: A program where organisations reward researchers for finding and reporting security vulnerabilities.
  • Cookie: A small piece of data stored by a website in your browser, often used to keep you logged in.
  • Cryptographically secure random source: A random number generator designed to be unpredictable and suitable for security purposes.
  • Endpoint: A specific URL or URI where a web service can be accessed; think of it as a door to a particular function.
  • Entropy: A measure of randomness or unpredictability; more entropy means harder to guess.
  • Google Dorks: Advanced search operators used in Google to find specific information, sometimes exposing sensitive data.
  • Host Header injection: An attack where the attacker manipulates the Host header in an HTTP request to make the server generate malicious links or redirects.
  • HTTP request: The message a browser sends to a server to ask for a resource or to submit data.
  • Opaque reference: An identifier that reveals no information about the underlying data, often a random string.
  • Password reset flow: The sequence of steps a user goes through to reset a forgotten password.
  • Private program: A bug bounty program that is not open to the public; only invited researchers can participate.
  • Rate limiting: A control that restricts how many requests can be made in a given time period, to prevent abuse.
  • Reconnaissance (recon): The information-gathering phase of a security assessment.
  • Reset code: The numeric or alphanumeric string in a password reset link that proves the request is legitimate.
  • Serial value: A number that increases by a fixed amount each time it is generated, making it predictable.
  • Token: A piece of data used to authenticate or identify a user or session, often in the form of a string.
  • User ID: A unique identifier for a user account, sometimes a number or a string like a UUID.
  • UUID: Universally Unique Identifier; a long string of characters designed to be unique.
  • Vulnerability: A weakness in a system that can be exploited to compromise security.

More by Omar Hamdy

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.