Skip to content
IDOR Write-up Beginner

Hack Till Your Last Breath

An email change endpoint accepted a user ID parameter, allowing an attacker to change another user's email by substituting their ID. The user ID was initially considered unguessable, but the author later found it leaked in URLs and used Google dorks to collect IDs, enabling account takeover.

mechboy Follow

Published on medium.com

Bounty$200 View original

{{media:0}}

mechboy, 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. 5 min read.

Context

The target was a private HackerOne program, so the researcher refers to it throughout as "redacted.com". The program had a very small scope, and the researcher decided to hunt on the main domain instead. The feature involved is the account dashboard: it offers a way to change the email address associated with your own account. The write-up is about turning that self-service email change into an account takeover (ATO) of other users, and about the long argument with the triager that followed.

mechboy
mechboy From the original on medium.com

Setup

The researcher worked with Burp Suite and a browser, monitoring the requests made by the dashboard. No other tooling, versions or preconditions are described. The only account mentioned is the researcher's own, used to observe the email change request.

Finding it

While looking at the user dashboard, the researcher found the option to change the email for the account. Changing the mail id and watching the request in Burp showed a JSON body with two parameters: a user id and the new email address. The user id is unique for every user.

Changing email
Changing email From the original on medium.com
JSON
{"userId":"xxxxx-xxxxxxxx-xxxx-xxxxx","email":"[redacted]"}

The request carries the identifier of the account whose email is being changed, and the server apparently trusts it without checking that it belongs to the caller. That is the IDOR: the identifier is supplied by the client and is not tied to the authenticated session.

Exploitation

Step 1: swap the user id

The researcher replaced their own user id in the request with the victim's user id. The victim's mail got changed. With the email now pointing at an address the attacker controls, the account can be taken over by requesting a forgot password for the victim account. The researcher reports finding this P1 bug within 10 minutes and reported it on HackerOne.

Step 2: the triager's rejection

The report was not triaged. It was marked "NOT APPLICABLE", with this message:

The user_id parameter is a UUID value that has very high entropy. I don't see an impact here because the UUID cannot be guessed.

The researcher tried to crack the user id values and got nothing. The site is safe from guessing alone, but only as long as nobody can obtain another user's id.

Step 3: where the id leaks

The researcher then noticed that the user id was leaking in URLs, password reset links and cookies, and passed this information to the triager. The reply was:

There are two same reports before, and the team informed us that they are not willing to accept this UUID is not publicly available. What example you gave for UUID was self exploitable. If you are able to find UUID of another user without any self-attack, I can ask the team to have another look.

The report was closed as a duplicate. The objection is precise: the researcher's demonstration used an id they already had, so it did not show an attacker obtaining another user's id.

Step 4: chaining with XSS

Because the id was leaking in a cookie, the researcher hunted for XSS and found it. Through that XSS, a payload executed in a victim's browser can read that victim's user id. Combined with the IDOR, this gives account takeover. The researcher informed the triager again. It was marked as a duplicate once more:

This XSS was also reported before and again it is a duplicate of #XXXXXX

Step 5: Google dorks to obtain other users' ids

After a break spent learning recon, the researcher found a business logic vulnerability in another site within an hour and was paid 200 USD for it. While hunting that bug, Google dorks were used to gather information, which led to the idea of using dorks to find URLs containing user ids of redacted.com users. The user id was already known to leak in URLs, so the dork was:

site:redacted.com inurl:"xxxxxxxx"

This returned more than 1000 URLs containing user ids of redacted.com users. From those URLs the researcher took a random user id belonging to an unknown user of redacted.com, changed the email through the IDOR bug, changed the password through "Forgot password", and logged in to the victim account. This was given as a PoC to the triager, and the report was finally triaged.

The chain is summarised in the write-up as: IDOR + DORKS = ACCOUNT TAKEOVER.

Root cause

The email change endpoint accepts a client-supplied userId and acts on it without verifying that the identifier belongs to the authenticated session. The only defence the team relied on was the high entropy of the UUID, which prevents guessing but not disclosure. Because the same identifier was exposed in URLs, password reset links and cookies, it could be obtained by third parties, so the entropy argument did not hold. The XSS provided a second disclosure path, executing in the victim's browser where the cookie carrying the id is available.

Impact

An attacker who knows another user's id can change that user's email address and then complete a forgot password flow to take over the account. The precondition is obtaining the victim's UUID, which the researcher did through Google-indexed URLs and, separately, through XSS. The report does not describe the XSS payload or the exact pages where the id appeared.

Fix

The fix implied by the finding is to stop taking the target account from the request body: derive the account from the authenticated session and ignore or reject a userId that does not match it. Separately, the id should not be exposed in URLs, password reset links or cookies, and the XSS should be fixed.

Variants to test

  1. On any email or profile change endpoint, replace the account identifier in the body with another account's identifier and check whether the change is applied. A positive result is the other account's email being modified.
  2. Search for the identifier format in search engines with a dork such as site:target.com inurl:"<id-format>" and see whether URLs containing other users' ids are indexed.
  3. Inspect password reset links and cookies for the same identifier, and check whether it matches the value used in state-changing requests.
  4. Where an identifier is exposed only through client-side execution, look for XSS that can read it, then feed it into the IDOR. A positive result is a full chain from payload execution to email change on the victim account.
  5. When a triager rejects an IDOR because the identifier is unguessable, demonstrate disclosure of another user's identifier without any self-supplied value, which is the condition the triager in this report set.

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

What happened, in plain words

A security researcher who goes by mechboy found a way to take over other people's accounts on a popular website. The website let you change the email address on your own account from a settings page. Behind that page, the browser sends a small message to the website's server saying "please change the email for account number X to this new address". The researcher noticed that the account number was just a value sitting in that message, and the server did whatever the message asked without checking that the account number really belonged to the person sending it. So by putting someone else's account number into the message, the researcher could change that person's email address, then use the "forgot password" button to reset the password and log in as them. That is called account takeover.

The first report was rejected. The person reviewing it (the triager) said the account number is a long random string called a UUID, impossible to guess, so there was no real danger. The researcher then showed that these account numbers were leaking in web addresses, in password reset links and in cookies, and later found a cross-site scripting (XSS) bug that could read a victim's account number from their browser. Each follow-up was closed as a duplicate of earlier reports. Eventually the researcher used Google search tricks (dorks) to find over a thousand web addresses that contained real users' account numbers, picked one belonging to a stranger, changed that stranger's email through the same bug, reset the password and logged in. That proof was finally accepted and the report was triaged.

mechboy
mechboy From the original on medium.com

The target and the setup

The website was part of a private bug bounty program on HackerOne, a platform where companies invite researchers to test their systems and pay for valid findings. Because the program is private, the researcher cannot name the company and calls it "redacted.com" throughout. The program's listed scope (the set of systems researchers are allowed to test) was very small, so the researcher decided to work on the main domain instead.

A bug bounty program is an arrangement where a company says: if you find a security problem in our systems and report it responsibly, we will reward you. A private program means only invited researchers can take part. Scope is the list of what is fair game; testing outside it is not allowed.

The only tools described are a browser and Burp Suite. Burp Suite is a program that sits between your browser and the website and lets you see, pause and edit every request the browser sends and every response that comes back. Think of it as a recording device placed on the phone line between you and the website: you hear exactly what is being said, and you can change the words before they reach the other side. No other tools, versions or preconditions are mentioned.

The researcher used their own account to watch what happens when the email address is changed. Having your own account is important: you need to see the normal, legitimate traffic before you can tell what is unusual about it.

Finding the email change request

On the user dashboard there was an option to change the email address for the account. The dashboard is the page you see after logging in, where your settings live. The researcher changed the email address and watched the request in Burp.

Changing email
Changing email From the original on medium.com

A request is the message your browser sends to a website's server. When you fill in a form and press a button, the browser packages what you typed into a request and sends it off. The server reads it, does the work and sends back a response, usually a new page or a short confirmation. Burp lets you freeze that request mid-flight and look inside.

The request body looked like this:

JSON
{"userId":"xxxxx-xxxxxxxx-xxxx-xxxxx","email":"[redacted]"}

Line by line:

  • The outer curly braces { and } mark the start and end of a single object, which is a bundle of labelled values. This format is called JSON, short for JavaScript Object Notation, and it is a common way for browsers and servers to exchange structured data.
  • "userId" is the label (the key) for the first value. It names the account the request is about. The value next to it, "xxxxx-xxxxxxxx-xxxx-xxxxx", is a placeholder for the real identifier, a long string in five groups separated by hyphens. That shape is what a UUID looks like: a universally unique identifier, a very long random-looking string used to tell one record apart from every other record.
  • "email" is the label for the second value, and "[redacted]" is the new email address the researcher typed into the form.
  • The comma between the two pairs separates them.

So the message says: change the email address of the account with this identifier to this new address. The identifier is unique for every user, which is exactly what makes it useful as a target: if you know someone's identifier, you can point the request at their account.

The key observation is that the account identifier is supplied by the browser. The server receives it and acts on it. Nothing in the request proves that the identifier belongs to the person who is logged in. This is the vulnerability class called IDOR, Insecure Direct Object Reference: the application takes a reference to an object (here, a user account) straight from the client and uses it without checking that the client is allowed to touch that object. An everyday comparison: a hotel receptionist hands you a key when you give your room number, but never checks that the room is actually yours. Say "room 214" and you get the key to room 214, whoever you are.

Step 1: swapping the user id

The researcher replaced their own user id in the request with the victim's user id. The victim's mail got changed. With the email address now pointing at an address the attacker controls, the account can be taken over by using the forgot password function on the victim's account: the reset link goes to the attacker's inbox, the attacker sets a new password, and the account is theirs.

Why this works: the forgot password feature assumes that whoever can read the email inbox is the rightful owner. Once the email address on the account has been changed to one the attacker owns, that assumption hands the account to the attacker. The email change is the door; the password reset is the key that the door then gives away.

The researcher reports finding this P1 bug within 10 minutes and reported it on HackerOne. P1 means priority one, the highest severity level in the platform's scale, reserved for the most serious issues.

Step 2: the triager's rejection

The report was not triaged. Triaged means a reviewer has looked at it, confirmed it is a real and valid issue, and passed it on to the company. Instead it was marked "NOT APPLICABLE", with this message:

The user_id parameter is a UUID value that has very high entropy. I don't see an impact here because the UUID cannot be guessed.

Entropy here means unpredictability. A UUID has so many possible values, and they are spread so widely, that trying random ones is hopeless: you would need an enormous number of attempts to hit a real one. The triager's argument is that the bug is harmless because an attacker cannot produce a valid victim identifier out of thin air.

The researcher tried to crack the user id values and got nothing. That supports the entropy argument: guessing alone will not get you another user's id. The disagreement is not about whether the id is guessable. It is about whether the id can be obtained some other way.

Step 3: where the id leaks

The researcher then noticed that the user id was leaking in URLs, password reset links and cookies, and passed this information to the triager.

A URL is the address of a page, the thing you type in the address bar. Anything after a question mark in a URL is called a query string, and it is a common place for an application to carry an identifier from page to page. A password reset link is the special URL emailed to you when you click "forgot password"; it usually contains a value that proves you received the email. A cookie is a small piece of data that a website asks your browser to store and send back with every request to that site; it is how a site remembers who you are between page loads, and it often holds a session identifier, the value that says "this browser is logged in as this user".

If the same account identifier appears in all three places, then it is not secret at all. It travels in addresses that can be copied, shared and bookmarked, and it sits in a cookie that any script running in the page can read.

The reply was:

There are two same reports before, and the team informed us that they are not willing to accept this UUID is not publicly available. What example you gave for UUID was self exploitable. If you are able to find UUID of another user without any self-attack, I can ask the team to have another look.

The report was closed as a duplicate. The objection is precise: the researcher's demonstration used an id they already had, their own, so it did not show an attacker obtaining another user's id. "Self exploitable" means the only victim in the proof was the researcher. The triager set a clear condition for reopening: show another user's identifier obtained without attacking yourself.

Step 4: chaining with XSS

Because the id was leaking in a cookie, the researcher hunted for XSS and found it. XSS, cross-site scripting, is a bug where an attacker manages to get their own code (usually JavaScript, the language browsers run) to execute inside someone else's browser while that person is viewing the vulnerable site. The code runs as if the site itself had written it, so it can read what the site can read, including cookies.

Through that XSS, a payload executed in a victim's browser can read that victim's user id. A payload here just means the piece of code the attacker injects. Combined with the IDOR, this gives account takeover: the script reads the victim's id, the attacker feeds that id into the email change request, and the rest follows as before. The researcher informed the triager again. It was marked as a duplicate once more:

This XSS was also reported before and again it is a duplicate of #XXXXXX

A duplicate is a report describing a problem that has already been reported. Platforms close duplicates because the company only pays for the first report of a given issue.

Step 5: Google dorks to obtain other users' ids

After a break spent learning recon, the researcher found a business logic vulnerability in another site within an hour and was paid 200 USD for it. Recon, short for reconnaissance, is the information-gathering phase: finding out what a target has, what it exposes and how it is put together, before attacking anything. A business logic vulnerability is a flaw in the rules of a feature rather than in its code: the software does exactly what it was programmed to do, but the rule itself can be abused.

While hunting that bug, Google dorks were used to gather information. A Google dork is a search query that uses Google's advanced operators to find very specific things, for example pages with a particular word in the address. That led to the idea of using dorks to find URLs containing user ids of redacted.com users. The user id was already known to leak in URLs, so the dork was:

site:redacted.com inurl:"xxxxxxxx"

Line by line:

  • site:redacted.com restricts the results to pages on that one domain, so Google only returns addresses belonging to the target site.
  • inurl:"xxxxxxxx" asks Google to return only pages whose address contains that text. The xxxxxxxx stands for the pattern of the user id, the same kind of long string seen in the request body.
  • The asterisks around the whole query are just the write-up's way of quoting the line, not part of the search.

This returned more than 1000 URLs containing user ids of redacted.com users. In other words, the identifiers were not merely leaking: a search engine could surface them. That is exactly the "without any self-attack" proof the triager had asked for.

From those URLs the researcher took a random user id belonging to an unknown user of redacted.com, changed the email through the IDOR bug, changed the password through "Forgot password", and logged in to the victim account. This was given as a PoC to the triager, and the report was finally triaged. A PoC, proof of concept, is the demonstration that a bug is real: the smallest reliable set of steps that shows the impact.

The chain is summarised in the write-up as: IDOR + DORKS = ACCOUNT TAKEOVER.

Root cause

The email change endpoint accepts a client-supplied userId and acts on it without verifying that the identifier belongs to the authenticated session. An endpoint is simply one address on a server that does a particular job, like a counter in a building: you go to the email-change counter to change an email. Authenticated session means the state of being logged in, the server's memory that this particular browser has already proved who it is.

The only defence the team relied on was the high entropy of the UUID, which prevents guessing but not disclosure. Disclosure means the value becoming known through some other route: a link, a log, a cookie, a search engine. A secret that is strong against guessing but printed on every page is not a secret.

Because the same identifier was exposed in URLs, password reset links and cookies, it was indexable and obtainable by third parties, so the entropy argument did not hold. The XSS provided a second disclosure path, executing in the victim's browser where the cookie carrying the id is available.

Impact

An attacker who knows another user's id can change that user's email address and then complete a forgot password flow to take over the account. The precondition is obtaining the victim's UUID, which the researcher did through Google-indexed URLs and, separately, through XSS. The report does not describe the XSS payload or the exact pages where the id appeared.

Fix

The fix implied by the finding is to stop taking the target account from the request body: derive the account from the authenticated session and ignore or reject a userId that does not match it. In plain terms, the server should look up who is logged in and change the email for that account, rather than believing a number the browser sent. Separately, the id should not be exposed in URLs, password reset links or cookies, and the XSS should be fixed.

Variants to test

  1. On any email or profile change endpoint, replace the account identifier in the body with another account's identifier and check whether the change is applied. A positive result is the other account's email being modified.
  2. Search for the identifier format in search engines with a dork such as site:target.com inurl:"<id-format>" and see whether URLs containing other users' ids are indexed.
  3. Inspect password reset links and cookies for the same identifier, and check whether it matches the value used in state-changing requests.
  4. Where an identifier is exposed only through client-side execution, look for XSS that can read it, then feed it into the IDOR. A positive result is a full chain from payload execution to email change on the victim account.
  5. When a triager rejects an IDOR because the identifier is unguessable, demonstrate disclosure of another user's identifier without any self-supplied value, which is the condition the triager in this report set.

Glossary

  • Account takeover (ATO): gaining control of someone else's account, usually by changing their email or password so the real owner is locked out.
  • API: the set of addresses and rules a program uses to talk to a server, the counter where requests are handed in and answers come back.
  • Authenticated session: the state of being logged in, remembered by the server so it does not ask you for your password on every page.
  • Bug bounty program: an arrangement where a company invites researchers to find and report security problems in exchange for rewards.
  • Burp Suite: a tool that sits between browser and website so you can see, pause and edit requests and responses.
  • Business logic vulnerability: a flaw in the rules of a feature rather than in its code; the software does what it was told, but the rule can be abused.
  • Cookie: a small piece of data a site asks your browser to store and send back with every request, often used to remember who is logged in.
  • Cross-site scripting (XSS): a bug that lets an attacker's code run inside another person's browser on a vulnerable site, where it can read what the site can read.
  • Disclosure: a secret value becoming known through some route other than guessing, such as a link, a log, a cookie or a search engine.
  • Domain: the name of a website, the part after the @ in an email address or before the first slash in a URL.
  • Dork (Google dork): a search query using advanced operators to find very specific pages, for example pages whose address contains a given string.
  • Duplicate: a report describing a problem that has already been reported.
  • Endpoint: one address on a server that performs a particular job, like a counter in a building.
  • Entropy: unpredictability; high entropy means so many possible values that guessing is hopeless.
  • HackerOne: a platform where companies run bug bounty programs and researchers submit reports.
  • IDOR (Insecure Direct Object Reference): a bug where the application takes a reference to an object from the client and acts on it without checking that the client is allowed to touch that object.
  • JSON: a text format for structured data, made of labelled values inside curly braces, commonly used between browsers and servers.
  • P1: priority one, the highest severity level on the platform's scale.
  • Payload: the piece of code an attacker injects to make a bug do something.
  • PoC (proof of concept): the smallest reliable set of steps that demonstrates a bug is real and shows its impact.
  • Private program: a bug bounty program open only to invited researchers.
  • Query string: the part of a URL after the question mark, often used to carry values from page to page.
  • Recon (reconnaissance): the information-gathering phase before attacking, finding out what a target exposes and how it is built.
  • Request: the message a browser sends to a server, for example when you submit a form.
  • Response: the message a server sends back after a request.
  • Scope: the list of systems a program allows researchers to test.
  • Session identifier: the value in a cookie that tells the server which logged-in user a browser belongs to.
  • Triaged: reviewed and confirmed as a real, valid issue, then passed on to the company.
  • Triager: the person who reviews incoming reports and decides whether they are valid.
  • URL: the address of a page, the thing you type in the address bar.
  • UUID: a universally unique identifier, a very long random-looking string used to tell one record apart from every other record.
  • Vulnerability class: a family of bugs that share the same underlying mistake, such as IDOR or XSS.

Similar reports

View all

Same bug class and techniques, clearest first.

Insecure direct object reference (IDOR)

The lesson behind this report.

One user can read or change another user's data, usually by changing an identifier the server trusts without checking who is asking. One of the most paid bug classes on web programs.