Skip to content
IDOR Write-up Intermediate

~/BugBounty/IDOR/”How I was able to exfiltrate any user’s credit coupons”

An API endpoint that normally answered a preflight OPTIONS request with an empty response returned full user data when the same request was sent with GET. By changing the email and an incremental external identifier, an attacker could read other users' credit coupons, balances and transaction details.

Jai Sharma Follow

Published on ja1sharma.medium.com

Hi guys, I will explain how a simple HTTP Method Verb Tampering led to credit coupon stealing IDOR via this article.

Jai Sharma, on ja1sharma.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 Bugcrowd private program with two in-scope subdomains, a.redacted.com and b.redacted.com. The subdomain a.redacted.com lets authenticated users create discount coupons for their individual business stores. The researcher spent two to three hours on that domain before moving to the second in-scope subdomain, b.redacted.com, where the actual issue was found.

The feature involved is a preflight API call on b.redacted.com that returns client information for a given user. The request carries the user's email address, an external_id, a customer_token and a merch_id. The call was a preflight request that returned a plain 204 response.

Setup

The researcher crawled b.redacted.com without prior user authentication, then logged in to the application with valid user credentials and continued crawling. No special tooling or versions are described. The only precondition for the attack is an authenticated account on the application, plus knowledge of the victim's email address and external_id.

Finding it

While crawling the target after login, the researcher found an interesting preflight API call:

HTTP
OPTIONS /api/v1/client_info?email=[redacted]&external_id=00000111&customer_token=[redacted]&merch_id=60037

The user's email address was being sent via the OPTIONS method, and the call returned a plain 204 response. That is the normal behaviour of a preflight request: it is triggered to check whether the oncoming requests are safe or not.

From the original on ja1sharma.medium.com

The screenshot shows the OPTIONS call and its plain 204 response, with the user email address visible in the request.

What made this look wrong is that the endpoint accepted the user's identity parameters on a method whose only job is to negotiate a preflight. If the same parameters were accepted on a method that actually returns a body, the endpoint would hand back data for whatever user was named in the query string.

Exploitation

Step 1: Tamper with the HTTP method

The next thing the researcher tried was to tamper with the OPTIONS verb, changing it to GET. The response was strange: it included everything the user [redacted] had created in a.redacted.com, namely credit coupons, credit history, expired coupons and similar records.

From the original on ja1sharma.medium.com

The screenshot shows the response to the GET request, containing the data belonging to [redacted] from a.redacted.com.

Step 2: Manipulate the email address

At this point the researcher wanted to see whether simply manipulating the email address would fetch data from a.redacted.com belonging to other users. That worked. However, it required the attacker to know the victim's email address and external_id. That seemed doable, but it was still incomplete.

Step 3: Enumerate the external_id

The researcher observed that the external_id value is incremental and unique for each unique user. The same API call was also found to be missing any rate limit, so the identifier could be walked without throttling.

Step 4: Obtain the external_id from the password reset flow

Surprisingly, the same external_id is shared once a password reset request is initiated. That gives an attacker a way to learn the victim's external_id without guessing: the value is exposed through the password reset functionality, alongside the victim's email address.

Step 5: Fetch the victim's data

All that remains is to create another test account, obtain the victim's email address and external_id through the exposed password reset functionality, and send the same vulnerable request with the OPTIONS verb changed to GET. The response contains the coupons created in a.redacted.com by the victim: not only the currently active credit coupons, but also expired coupons, the current balance and other transaction details.

From the original on ja1sharma.medium.com

The screenshot shows the GET request returning the victim's coupons and related account data from a.redacted.com.

Root cause

Changing the email and external_id returned other users' data, which indicates missing object-level authorisation. The OPTIONS request returned 204, but changing the verb to GET returned the full record set for whichever user was named. Changing the verb from OPTIONS to GET was enough to get a data response.

Two design choices made the issue worse. The external_id is incremental and unique per user, so it can be enumerated, and the endpoint had no rate limit to slow that down. The same external_id is also exposed through the password reset flow, which removes the need to guess it at all. The report does not describe the root cause in these terms.

Impact

An attacker with an authenticated account can read another user's credit coupons, expired coupons, current balance and other transaction details from a.redacted.com, provided the attacker knows the victim's email address and external_id. Both values can be obtained through the password reset functionality, and the external_id can also be enumerated because it is incremental and the endpoint has no rate limit. The report does not state how many users or records were affected.

The issue was initially triaged as P3 and later changed to P2 after the potential impact was seen. The timeline was:

Event Date
Submitted 02 Jun 2021
Triaged 07 Jun 2021
Rewarded 21 Jun 2021

VRT: Broken Access Control (BAC) > Insecure Direct Object References (IDOR). Priority: P2.

From the original on ja1sharma.medium.com

Fix

Based on the root cause, the endpoint should enforce object-level authorisation: the authenticated caller's identity should be checked against the email and external_id in the request, and the request should be rejected when they do not match. The handler should also restrict which methods return data, so that a preflight OPTIONS request cannot be turned into a GET that serves records. Rate limiting on the endpoint and avoiding exposure of the external_id through the password reset flow would remove the enumeration path.

Variants to test

  1. Method tampering on preflight endpoints. Find OPTIONS calls that carry identity parameters and replay them as GET, POST or HEAD. A positive result is a response body containing user data instead of a plain 204.
  2. Identity parameters in query strings. Look for endpoints that take email, external_id, customer_token or merch_id as parameters and return records. A positive result is data for a user other than the authenticated caller.
  3. Incremental identifiers. Check whether identifiers such as external_id are sequential and unique per user. A positive result is being able to walk the range and retrieve records for other users.
  4. Identifier leakage in password reset. Request a password reset for a known account and inspect the response and any follow-up requests for an identifier that matches the one used by the API. A positive result is the same external_id appearing in the reset flow.
  5. Missing rate limits. Send the same request repeatedly with different identifiers. A positive result is no throttling, blocking or CAPTCHA after a large number of requests.

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 was testing a company's website as part of a private bug bounty program. A bug bounty program is an arrangement where a company invites independent testers to look for security problems in its systems and pays them for reporting what they find, instead of punishing them. This particular program was run through Bugcrowd, a platform that hosts such programs.

The researcher found a way to read other people's discount coupons and account details. The researcher found a preflight request that returned a plain 204, changed the method from OPTIONS to GET, and the website returned user data.

To make it worse, the website used a customer number that simply counts up (1, 2, 3, ...), so anyone could guess other people's numbers. And the same number was handed out openly when someone asked to reset their password. Put together, an attacker with an ordinary account could pick a victim, learn their number, and read their coupons, balance and transaction history.

The company first rated the problem as low priority (P3) and later raised it to P2 once the impact was clear. The researcher was paid a bounty. The report does not say how much.

Below, I walk through the same steps the researcher took, explaining each idea from scratch.

Background ideas you need first

Before the steps make sense, here are a few everyday ideas.

A subdomain is a named section of a website. If a company owns example.com, it can run separate services at shop.example.com and help.example.com. In this report the two in-scope subdomains are written as a.redacted.com and b.redacted.com. "Redacted" means the real names were removed before publishing. "In-scope" means the company explicitly allowed testing on those addresses; testing outside the scope would be against the rules.

An API is the part of a website that serves data rather than web pages. Think of a restaurant: the dining room (the website you see) and the kitchen (the API) are separate, and the waiter carries orders between them. When a page in your browser shows your coupons, it usually asks the API for them behind the scenes. API requests look like short lines of text, for example a method word, a path, and some parameters.

An HTTP method (also called a verb) is the first word of every request and says what kind of action you want. GET means "give me something". POST means "here is something, please accept it". OPTIONS means "tell me what I am allowed to do here". Browsers send OPTIONS automatically in a process called a preflight check: before a page from one site sends a real request to another site, the browser first asks the other site, quietly, whether the request would be welcome. That is what the researcher means by "triggered to ensure if the oncoming requests are safe or not".

A parameter is a named value attached to a request, usually after a ? in the address. In ?email=[redacted], the parameter is called email and its value is [redacted]. Parameters are how a request says which record it is interested in.

A token is a short string of characters that acts like a temporary key or wristband. You get one when you log in, and you show it with each request so the server knows who you are without asking for your password again. A cookie is one common place a browser stores such a token. The customer_token in this report is a value of that kind.

An identifier is a value that names a specific record or person. A username is an identifier; so is a customer number. An incremental identifier is one that goes up by one each time a new record is created, like ticket numbers at a bakery: 001, 002, 003. That is convenient for the company but dangerous, because anyone can guess the next number.

A rate limit is a cap on how many requests a server will answer in a given time. It is like a bouncer who lets you ask a question, but not ten thousand questions a minute. Without one, an attacker can try every number in a range quickly.

A response code is a three-digit number the server sends back to say how it went. 200 usually means "here is your data". 204 means "done, and there is nothing to send back". A 204 is exactly what you would expect from a polite preflight answer.

An IDOR stands for Insecure Direct Object Reference. It means the server lets you name a record directly (by its number or email) and hands it over without checking that the record belongs to you. The everyday comparison: a hotel clerk who gives out room keys to anyone who says a room number, without checking whether the person is actually staying in that room. The report classifies the bug as Broken Access Control (BAC) > Insecure Direct Object References (IDOR). Broken access control is the wider family: any failure to check who is allowed to do what.

CORS (Cross-Origin Resource Sharing) is the browser rulebook that decides whether a page from one site may read responses from another site. Preflight OPTIONS requests exist to enforce it. You do not need the details here; just remember that OPTIONS is a housekeeping verb, not a data verb.

The target and the feature

The program was a Bugcrowd private program with two in-scope subdomains, a.redacted.com and b.redacted.com.

The subdomain a.redacted.com lets logged-in users create discount coupons for their own business stores. A coupon here is a credit or discount that a shop gives its customers. Each shop owner has an account, and the account holds their coupons, their credit history, their expired coupons and their balance.

The researcher spent two to three hours on a.redacted.com and then moved to the second in-scope subdomain, b.redacted.com. That is where the actual problem was found.

The feature involved is a preflight API call on b.redacted.com that returns client information for a given user. The request carries the user's email address, an external_id, a customer_token and a merch_id. The call was a preflight request that returned a plain 204 response. An endpoint is simply a specific address on a server that does one job, like a specific counter in a large office.

Setting up

The researcher crawled b.redacted.com without logging in first. Crawling means clicking and following links systematically, or letting a tool do it, to map out what pages and requests exist. Doing it before logging in shows you the public surface; doing it after logging in shows you the private one.

Then the researcher logged in to the application with valid user credentials and continued crawling. No special tooling or versions are described in the report. The only precondition for the attack is an authenticated account on the application, plus knowledge of the victim's email address and external_id.

Finding it

While crawling the target after login, the researcher found an interesting preflight API call:

HTTP
OPTIONS /api/v1/client_info?email=[redacted]&external_id=00000111&customer_token=[redacted]&merch_id=60037

Line by line, in plain words:

  • OPTIONS is the method word. It asks the server what actions are permitted here. It is not supposed to return data.
  • /api/v1/client_info is the path, the address of the endpoint inside the server. api suggests it is a data endpoint, v1 is a version label, and client_info suggests it returns information about a client, that is, a customer.
  • ? starts the list of parameters.
  • email=[redacted] names the user whose information is being asked about. The address is a placeholder in the published report.
  • external_id=00000111 is a second identifier for the same user. The name "external" suggests it is the company's own customer number, used to refer to the user in outside systems.
  • customer_token=[redacted] is a token value. In a real request this would be a secret; here it is a value from the report.
  • merch_id=60037 is a merchant identifier, presumably naming the shop the customer belongs to.

The user's email address was being sent via the OPTIONS method, and the call returned a plain 204 response. That is the normal behaviour of a preflight request: it is triggered to check whether the oncoming requests are safe or not.

From the original on ja1sharma.medium.com

The screenshot shows the OPTIONS call and its plain 204 response, with the user email address visible in the request.

Why did this look wrong? Because the endpoint accepted the user's identity parameters on a method whose only job is to negotiate a preflight. If the same parameters were accepted on a method that actually returns a body, the endpoint would hand back data for whatever user was named in the query string. In other words, the OPTIONS verb was acting as a thin curtain in front of a data counter. The researcher's next thought was: what happens if I walk around the curtain?

Exploitation

Step 1: Tamper with the HTTP method

The next thing the researcher tried was to tamper with the OPTIONS verb, changing it to GET. Verb tampering means swapping the method word while keeping everything else the same. The idea is that the server might check the method for the preflight case but forget to check it for the data case, or route both to the same code.

The response was strange: it included everything the user [redacted] had created in a.redacted.com, namely credit coupons, credit history, expired coupons and similar records.

From the original on ja1sharma.medium.com

The screenshot shows the response to the GET request, containing the data belonging to [redacted] from a.redacted.com.

Why this matters: a 204 with no body is harmless. A 200 with a body full of someone's coupons is not. The server had answered a data question to a request that started life as housekeeping. The curtain was gone.

Step 2: Manipulate the email address

At this point the researcher wanted to see whether simply manipulating the email address would fetch data from a.redacted.com belonging to other users. That is the core IDOR test: change the identifier in the request to someone else's and see whether the server still answers.

That worked. However, it required the attacker to know the victim's email address and external_id. That seemed doable, but it was still incomplete. Knowing an email address is often easy; knowing a customer number is not, unless there is a way to learn it.

Step 3: Enumerate the external_id

The researcher observed that the external_id value is incremental and unique for each unique user. Enumeration means trying values one after another in a pattern, like dialling every room number in a hotel to see who picks up. If the numbers go 00000111, 00000112, 00000113 and so on, an attacker can simply walk the range.

The same API call was also found to be missing any rate limit, so the identifier could be walked without throttling. Without a rate limit, the hotel has no bouncer, and the attacker can knock on every door as fast as the network allows.

Step 4: Obtain the external_id from the password reset flow

Surprisingly, the same external_id is shared once a password reset request is initiated. A password reset flow is the sequence of steps a website runs when you click "forgot my password": it usually asks for your email, then sends you a link or a code. During that sequence, the site sometimes sends data back to the browser, and that data can include identifiers.

That gives an attacker a way to learn the victim's external_id without guessing: the value is exposed through the password reset functionality, alongside the victim's email address. So the attacker does not even need to enumerate. They can simply ask the site to start a reset for the victim's email and read the number that comes back.

Step 5: Fetch the victim's data

All that remains is to create another test account, obtain the victim's email address and external_id through the exposed password reset functionality, and send the same vulnerable request with the OPTIONS verb changed to GET. The response contains the coupons created in a.redacted.com by the victim: not only the currently active credit coupons, but also expired coupons, the current balance and other transaction details.

From the original on ja1sharma.medium.com

The screenshot shows the GET request returning the victim's coupons and related account data from a.redacted.com.

Why a test account? Because the attacker needs to be logged in to reach the endpoint at all. The account does not need to belong to the victim; it just needs to be a valid account on the application. Changing the email and external_id returned other users' data.

Root cause

Changing the email and external_id returned other users' data, which indicates missing object-level authorisation. Authorisation is the check that a logged-in user is allowed to do this particular thing, as opposed to authentication, which is only the check that they are who they say they are. Logging in proves you are someone; authorisation decides what that someone may touch.

The OPTIONS request returned 204, but changing the verb to GET returned the full record set for whichever user was named. A handler is the piece of server code that runs when a particular endpoint is called. Changing the verb from OPTIONS to GET was enough to get a data response.

Two design choices made the issue worse. The external_id is incremental and unique per user, so it can be enumerated, and the endpoint had no rate limit to slow that down. The same external_id is also exposed through the password reset flow, which removes the need to guess it at all. The report does not describe the root cause in these terms. Object-level authorisation means checking, for each individual record, that this caller owns this record, not just that the caller is logged in.

Impact

An attacker with an authenticated account can read another user's credit coupons, expired coupons, current balance and other transaction details from a.redacted.com, provided the attacker knows the victim's email address and external_id. Both values can be obtained through the password reset functionality, and the external_id can also be enumerated because it is incremental and the endpoint has no rate limit.

The issue was initially triaged as P3 and later changed to P2 after the potential impact was seen. Triaged means the program's staff reviewed the report and accepted it as a real issue. The P labels are priority ratings; a lower number means more urgent. The timeline was:

Event Date
Submitted 02 Jun 2021
Triaged 07 Jun 2021
Rewarded 21 Jun 2021

VRT: Broken Access Control (BAC) > Insecure Direct Object References (IDOR). Priority: P2. VRT stands for Vulnerability Rating Taxonomy, a shared catalogue that programs use to label bug types consistently.

From the original on ja1sharma.medium.com

Fix

Based on the root cause, the endpoint should enforce object-level authorisation: the authenticated caller's identity should be checked against the email and external_id in the request, and the request should be rejected when they do not match. The handler should also restrict which methods return data, so that a preflight OPTIONS request cannot be turned into a GET that serves records. Rate limiting on the endpoint and avoiding exposure of the external_id through the password reset flow would remove the enumeration path.

In everyday terms: the hotel clerk should check the guest's name against the room register before handing over a key, the front desk should not answer questions it was not asked, the lobby should have a bouncer, and the guest list should not be printed on the back of the "forgot your key" form.

Variants to test

If you want to look for similar problems on sites you are allowed to test, here are the same ideas as a checklist. Each one names what to look for and what a positive result looks like.

  1. Method tampering on preflight endpoints. Find OPTIONS calls that carry identity parameters and replay them as GET, POST or HEAD. A positive result is a response body containing user data instead of a plain 204.
  2. Identity parameters in query strings. Look for endpoints that take email, external_id, customer_token or merch_id as parameters and return records. A positive result is data for a user other than the authenticated caller.
  3. Incremental identifiers. Check whether identifiers such as external_id are sequential and unique per user. A positive result is being able to walk the range and retrieve records for other users.
  4. Identifier leakage in password reset. Request a password reset for a known account and inspect the response and any follow-up requests for an identifier that matches the one used by the API. A positive result is the same external_id appearing in the reset flow.
  5. Missing rate limits. Send the same request repeatedly with different identifiers. A positive result is no throttling, blocking or CAPTCHA after a large number of requests.

Glossary

  • API: the part of a website that serves data to other software rather than drawing pages for people; requests to it are short lines of text.
  • Authentication: proving who you are, usually by logging in.
  • Authorisation: deciding what a logged-in user is allowed to do or see.
  • Broken Access Control (BAC): the broad family of bugs where a server fails to check permissions properly.
  • Bug bounty program: an arrangement where a company invites outside testers to find security problems and pays for valid reports.
  • Bugcrowd: a platform that hosts bug bounty programs.
  • Cookie: a small piece of data a browser stores for a site, often holding a login token.
  • CORS (Cross-Origin Resource Sharing): the browser rulebook for whether a page from one site may read responses from another site.
  • Coupon: here, a credit or discount that a shop gives its customers.
  • Crawling: systematically following links and requests to map out what a site contains.
  • Endpoint: a specific address on a server that performs one job.
  • Enumeration: trying values one after another in a pattern to discover valid ones.
  • External_id: in this report, the company's own customer number for a user; it is incremental and unique per user.
  • GET: an HTTP method meaning "give me something".
  • Handler: the server code that runs when a particular endpoint is called.
  • HTTP method (verb): the first word of a request, saying what kind of action is wanted, such as GET, POST or OPTIONS.
  • IDOR (Insecure Direct Object Reference): a bug where a server lets you name a record directly and hands it over without checking that it belongs to you.
  • Identifier: a value that names a specific record or person, such as an email address or customer number.
  • Incremental identifier: an identifier that goes up by one for each new record, so it can be guessed.
  • In-scope: explicitly allowed for testing by the program's rules.
  • Object-level authorisation: checking, for each individual record, that the caller owns it.
  • OPTIONS: an HTTP method used for preflight checks; it asks what actions are permitted and is not meant to return data.
  • Parameter: a named value attached to a request, usually after a ?.
  • Password reset flow: the sequence of steps a site runs when you click "forgot my password".
  • Preflight check: an automatic OPTIONS request a browser sends before a cross-site request, to ask whether the request is welcome.
  • Priority (P2, P3): a rating of how urgent a bug is; a lower number means more urgent.
  • Rate limit: a cap on how many requests a server will answer in a given time.
  • Response code: a three-digit number the server returns to say how a request went, such as 200 or 204.
  • Subdomain: a named section of a website, such as shop.example.com under example.com.
  • Token: a short string that acts like a temporary key, shown with requests so the server knows who you are.
  • Triaged: reviewed and accepted as a real issue by the program's staff.
  • Verb tampering: changing the HTTP method word of a request while keeping everything else the same.
  • VRT (Vulnerability Rating Taxonomy): a shared catalogue used to label bug types consistently.

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.