Skip to content
IDOR Write-up Beginner

How I Get the Name of the Hotel (and other Data) that you ever Stay - Personal Data Leaks: Private Bug Bounty Program

The checkout request accepted a payment_id parameter without validating the user's session, allowing an attacker to change that value and view other users' booking details, including email addresses and transaction information. The attacker could also automate enumeration of these records by brute-forcing the payment_id.

YoKo Kho Follow

Published on medium.com

Please kindly visit this simple paper directly to looking this release in simple:

YoKo Kho, 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

A few months before writing this up, I received an invitation to a private bug bounty programme on HackerOne. The programme had been running since September 2015, and when I saw that it had only 29 resolved reports I nearly skipped it. I decided to spend a few hours on it anyway. During that time I found two subdomain takeover issues and, more interestingly, an IDOR that led to a personal data leak.

The target is a private programme whose application has an online shopping style checkout. Customers pick a destination, fill in personal details, choose a payment method and are then passed to a third party payment service. The programme accepted various international credit cards; I no longer remember the full list of payment options, since the issue had been closed for around three months when I wrote this.

Setup

There were no special accounts, roles or tool versions involved. I worked against the live application as a normal customer, walking through the booking flow and watching the requests. The enumeration step used an intercepting proxy with an intruder-style mode, configured to always follow redirects.

Finding it

To understand the application I mapped the payment flow. Paying a bill takes several steps before the request is handed to the third party service. The general flow is shown below.

From the original on medium.com
  1. The user chooses a destination. On submit, the application generates a temporary URL that stores the session holding that choice, and sends a POST request containing the personal data saved in the profile.
HTTP
POST /booking2/numbers_here/save_session/unique_sessions_over_here HTTP/1.1Host: target.comPOST Value: the detail that has been saved into our profile
  1. The user fills in personal details and chooses a payment method. The URL changes from save_session to order.
HTTP
POST /booking2/numbers_here/order/unique_sessions_over_here HTTP/1.1Host: target.comPOST Value: the detail that has been saved into our profile including the chosen payment method
  1. Once the server has checked the POST request and no data is missing, the application calls a function with the unique hash and payment numbers to talk to the third party service. The function name closely resembled the name of the company providing that service; I have replaced it with xyzabc.
HTTP
GET /xyzabc/unique_hash_over_here/payment_numbers_over_here/payment HTTP/1.1Host: target.com
  1. With the unique hash and payment numbers in the URL, the application POSTs the checkout to the third party service.
HTTP
POST /xyzabc/checkout/ HTTP/1.1Host: target.comcsrfmiddlewaretoken=random_value_over_here&payment_id=means_payment_numbers&payment_product=card&card=unique_hash_of_the_card
  1. Whether or not the details are correct, the application generates a booking number. If the payment failed, the booking number (transaction ID) page contains information about the failed payment.
HTTP
GET /order/X-12312312/instalment/resolve/?NTO=random_character_here HTTP/1.1Host: target.com

After analysing this, the problem sat at step 4: the application proceeds with the payment by sending the payment_id parameter to the server. Manipulating that parameter let me enumerate successful and failed bookings made by other users.

Insecure Direct Object Reference, in short, lets an attacker reach objects without valid authorisation by manipulating a parameter value. Here the IDOR is in the payment_id parameter, because the application did not validate the session in the checkout request.

Exploitation

Step 1: try the obvious identifier first

My first attempt was to enumerate the booking number (the transaction ID from step 5) directly, because the number looked easy to guess. That failed: nothing appeared, either in the browser or in the front-end source.

Step 2: change payment_id

Changing the payment_id parameter worked. The system generated another user's booking number, which could then be used to enumerate data related to that booking. The data is not visible without viewing the source.

For example, changing the ID from 4055809 to 4055311 redirected me to another user's booking number (B-213xxxxx). There I could see that someone with the email address [redacted] had ordered a hotel with a 1 day trip duration. I could also see the total transaction, departure month, group size, location and other details.

The sample request carrying the payment_id parameter:

Figure 1: Sample Request of sent “Payment_id” From the original on medium.com

Figure 1: Sample Request of sent "Payment_id"

The response, showing another user's booking data:

Figure 2: Sample Response — Enumerating Other Users’ Booked From the original on medium.com

Figure 2: Sample Response, Enumerating Other Users' Booked

Step 3: automate the enumeration

The data can be enumerated automatically. Using intruder mode with the redirect set to always, I enumerated other users' data at scale.

Figure 3: Enumerate other user Data Automatically From the original on medium.com

Figure 3: Enumerate other user Data Automatically

The attack flow, recapped:

Figure 4: Flow of Attack From the original on medium.com

Figure 4: Flow of Attack

Root cause

The application did not validate the session in the payment_id request. The application did not validate the session in the checkout request carrying the payment_id value. Because the payment_id value could be brute forced, the missing check allowed enumeration. The report does not describe any further server-side control that would have limited the guessing.

Impact

An attacker can obtain failed or successful bookings created by other users of the site, without knowing their account or password. In the example, the data seen included the booking number, the customer's email address, the hotel, trip duration, total transaction, departure month, group size and location. Because the payment_id can be brute forced, this can be done automatically for many users rather than one at a time.

Fix

Around four hours after receiving the report, the programme owner fixed the issue completely. The reward was sent around 50 minutes after the fix was verified. The report does not describe the change that was made; the fix that is needed is to validate the session on the checkout request so that a payment_id is only honoured for the session that owns the booking.

Figure 5: Response from the Program’s Owner From the original on medium.com

Figure 5: Response from the Program's Owner

This turnaround broke every record I had seen.

Variants to test

  • Sequential numeric identifiers in checkout or payment endpoints. Walk the normal payment flow, note every parameter that carries an ID, and substitute a neighbouring value. A positive result is a redirect or response containing another user's booking number or personal details.
  • Session checks missing on checkout. Look for checkout requests that accept an ID without validating the session. If the checkout POST accepts an ID before that validation, try changing it. A positive result is data for an object you do not own.
  • Identifiers that look easy to guess. The booking number here looked easy to guess but returned nothing when enumerated directly; the working parameter was the payment ID. Test each identifier in the flow separately rather than assuming one stands in for another.
  • Automated enumeration with redirects followed. Configure your proxy's intruder mode to always follow redirects and run the parameter across a range. A positive result is a series of distinct booking pages belonging to different users.
  • Data visible only in source. When a manipulated request appears to return nothing, check the front-end source before concluding the object is inaccessible, as the booking data here was not rendered visibly.

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

What happened, in plain words

A security researcher received an invitation to a private bug bounty programme on HackerOne. A bug bounty programme is a scheme where a company invites independent testers to look for security problems in its systems and pays them for reporting what they find. A private programme means only invited people can take part, rather than anyone on the internet.

The programme had been running since September 2015. When the researcher saw that it had only 29 resolved reports, he nearly skipped it, because a low number suggested there was not much left to find. He decided to spend a few hours on it anyway. In that time he found two subdomain takeover issues (a separate kind of problem, not covered here) and, more interestingly, an IDOR that led to a personal data leak.

IDOR stands for Insecure Direct Object Reference. In everyday terms: imagine a hotel cloakroom where every coat gets a numbered ticket, and the attendant hands you coat number 12 when you hand in ticket 12, without ever checking that ticket 12 is yours. If you can simply write a different number on your ticket and get someone else's coat, the reference (the number) is direct and the check is missing. In a web application, the "number" is usually a value in a request, and the "coat" is a record in the company's database.

The target was a private programme whose application had an online shopping style checkout. Customers pick a destination, fill in personal details, choose a payment method, and are then passed to a third party payment service. A third party payment service is a separate company that actually moves the money, so the booking site hands the payment details over to it rather than handling card payments itself. The programme accepted various international credit cards; the researcher no longer remembers the full list of payment options, since the issue had been closed for around three months when he wrote this up.

Setup

There were no special accounts, roles or tool versions involved. The researcher worked against the live application as a normal customer, walking through the booking flow and watching the requests his own browser sent. Watching requests is possible because a browser and a web server talk in plain text messages: the browser sends a request, the server sends back a response. A tool called an intercepting proxy sits between the browser and the server and lets you read and edit those messages. The enumeration step used such a proxy in an intruder-style mode, configured to always follow redirects. Intruder mode means the tool automatically repeats one request many times, swapping in a different value each time. A redirect is the server telling the browser "the thing you asked for is over there, go and fetch it instead"; following redirects means the tool automatically goes to that new address.

Finding it

To understand the application, the researcher mapped the payment flow. Paying a bill takes several steps before the request is handed to the third party service. The general flow is shown below.

From the original on medium.com
  1. The user chooses a destination. On submit, the application generates a temporary URL that stores the session holding that choice, and sends a POST request containing the personal data saved in the profile.
HTTP
POST /booking2/numbers_here/save_session/unique_sessions_over_here HTTP/1.1Host: target.comPOST Value: the detail that has been saved into our profile

Line by line: POST is the type of request used when the browser is sending data to the server, as opposed to GET, which is used when it is just asking for a page. /booking2/numbers_here/save_session/unique_sessions_over_here is the address on the server being asked, with placeholder words standing in for the real numbers and session values. HTTP/1.1 is the version of the language the browser and server use to talk. Host: target.com says which website the request is for, because one server can host many sites. The last line describes the body of the request: the personal details already saved in the user's profile. A session is the server's memory of who you are across several requests; because the web is stateless (each request arrives with no memory of the last), the server needs something to tie your requests together, and that is what the temporary URL and session value do.

  1. The user fills in personal details and chooses a payment method. The URL changes from save_session to order.
HTTP
POST /booking2/numbers_here/order/unique_sessions_over_here HTTP/1.1Host: target.comPOST Value: the detail that has been saved into our profile including the chosen payment method

This is the same shape of request as before, but the address now contains order instead of save_session, and the body includes the chosen payment method. The change of word in the address is the application moving the user from the "still choosing" stage to the "placing the order" stage.

  1. Once the server has checked the POST request and no data is missing, the application calls a function with the unique hash and payment numbers to talk to the third party service. The function name closely resembled the name of the company providing that service; the researcher replaced it with xyzabc.
HTTP
GET /xyzabc/unique_hash_over_here/payment_numbers_over_here/payment HTTP/1.1Host: target.com

Here the request type is GET, because the browser is now asking for something rather than submitting a form. The address contains three parts after the site name: xyzabc (the censored name of the payment function), a unique hash, and the payment numbers. A hash is a short string of characters produced from some data, used here as an identifier that is hard to guess. The word payment at the end tells the application which action to perform.

  1. With the unique hash and payment numbers in the URL, the application POSTs the checkout to the third party service.
HTTP
POST /xyzabc/checkout/ HTTP/1.1Host: target.comcsrfmiddlewaretoken=random_value_over_here&payment_id=means_payment_numbers&payment_product=card&card=unique_hash_of_the_card

This is the key request. The body is a list of name and value pairs joined by &, the same format a web form produces. csrfmiddlewaretoken is a security token the site puts in forms to prove the request came from its own pages rather than from a malicious site; here its value is a placeholder. payment_id is the payment number, and it is the value that turned out to be the problem. payment_product=card says the payment method is a card. card carries the unique hash of the card. A token, in this general sense, is a short value the server issues and expects back, used to recognise or authorise something.

  1. Whether or not the details are correct, the application generates a booking number. If the payment failed, the booking number (transaction ID) page contains information about the failed payment.
HTTP
GET /order/X-12312312/instalment/resolve/?NTO=random_character_here HTTP/1.1Host: target.com

This is a GET to an order page. X-12312312 stands in for the booking number, instalment and resolve are parts of the address, and ?NTO=random_character_here is a query string: extra values appended to an address after a question mark, here a random character string. A transaction ID is simply the unique reference the system gives to one booking or payment attempt.

After analysing this, the problem sat at step 4: the application proceeds with the payment by sending the payment_id parameter to the server. Manipulating that parameter let the researcher enumerate successful and failed bookings made by other users. To enumerate means to go through values one after another, systematically, rather than guessing a single one.

Insecure Direct Object Reference, in short, lets an attacker reach objects without valid authorisation by manipulating a parameter value. Authorisation is the check that you are allowed to do or see a particular thing, as opposed to authentication, which is the check of who you are. Here the IDOR is in the payment_id parameter, because the application did not validate the session in the checkout request: it accepted whatever payment number arrived and returned the matching booking, without asking whether that booking belonged to the person making the request.

Exploitation

Step 1: try the obvious identifier first

The first attempt was to enumerate the booking number (the transaction ID from step 5) directly, because the number looked easy to guess. That failed: nothing appeared, either in the browser or in the front-end source. Front-end source is the HTML and other code the browser receives and renders into the page you see; viewing it shows what the server actually sent, even if the page displays nothing useful.

Step 2: change payment_id

Changing the payment_id parameter worked. The system generated another user's booking number, which could then be used to enumerate data related to that booking. The data is not visible without viewing the source, which is why the first attempt looked like a dead end.

For example, changing the ID from 4055809 to 4055311 redirected the researcher to another user's booking number (B-213xxxxx). There he could see that someone with the email address [redacted] had ordered a hotel with a 1 day trip duration. He could also see the total transaction, departure month, group size, location and other details.

The sample request carrying the payment_id parameter:

Figure 1: Sample Request of sent “Payment_id” From the original on medium.com

Figure 1: Sample Request of sent "Payment_id"

The response, showing another user's booking data:

Figure 2: Sample Response — Enumerating Other Users’ Booked From the original on medium.com

Figure 2: Sample Response, Enumerating Other Users' Booked

Step 3: automate the enumeration

The data can be enumerated automatically. Using intruder mode with the redirect set to always, the researcher enumerated other users' data at scale. Doing this by hand would mean editing one number, sending, reading the result, and repeating; automation turns that into a loop over a whole range of numbers.

Figure 3: Enumerate other user Data Automatically From the original on medium.com

Figure 3: Enumerate other user Data Automatically

The attack flow, recapped:

Figure 4: Flow of Attack From the original on medium.com

Figure 4: Flow of Attack

Root cause

The application did not validate the session in the payment_id request. The application did not validate the session in the checkout request carrying the payment_id value. Because the payment_id value could be brute forced, the missing check allowed enumeration. The report does not describe any further server-side control that would have limited the guessing.

Impact

An attacker can obtain failed or successful bookings created by other users of the site, without knowing their account or password. In the example, the data seen included the booking number, the customer's email address, the hotel, trip duration, total transaction, departure month, group size and location. Because the payment_id can be brute forced (tried across a range of values until matches are found), this can be done automatically for many users rather than one at a time.

Fix

Around four hours after receiving the report, the programme owner fixed the issue completely. The reward was sent around 50 minutes after the fix was verified. The report does not describe the change that was made; the fix that is needed is to validate the session on the checkout request so that a payment_id is only honoured for the session that owns the booking.

Figure 5: Response from the Program’s Owner From the original on medium.com

Figure 5: Response from the Program's Owner

This turnaround broke every record the researcher had seen.

Variants to test

  • Sequential numeric identifiers in checkout or payment endpoints. Walk the normal payment flow, note every parameter that carries an ID, and substitute a neighbouring value. A positive result is a redirect or response containing another user's booking number or personal details.
  • Session checks missing on checkout. Look for checkout requests that accept an ID without validating the session. If the checkout POST accepts an ID before that validation, try changing it. A positive result is data for an object you do not own.
  • Identifiers that look easy to guess. The booking number here looked easy to guess but returned nothing when enumerated directly; the working parameter was the payment ID. Test each identifier in the flow separately rather than assuming one stands in for another.
  • Automated enumeration with redirects followed. Configure your proxy's intruder mode to always follow redirects and run the parameter across a range. A positive result is a series of distinct booking pages belonging to different users.
  • Data visible only in source. When a manipulated request appears to return nothing, check the front-end source before concluding the object is inaccessible, as the booking data here was not rendered visibly.

Glossary

  • Bug bounty programme: a scheme where a company invites independent testers to find security problems and pays them for valid reports.
  • Private programme: a bug bounty programme open only to invited researchers.
  • Subdomain takeover: a separate class of issue where a subdomain points at a service that no longer exists and can be claimed by someone else.
  • IDOR (Insecure Direct Object Reference): a flaw where a request carries a direct reference to a record and the server does not check that the requester is allowed to access it.
  • Personal data leak: exposure of information that identifies or relates to individual people.
  • Third party payment service: an outside company that handles the actual movement of money on behalf of the site.
  • Request: the message a browser sends to a server asking for a page or submitting data.
  • Response: the message a server sends back.
  • Intercepting proxy: a tool that sits between browser and server so you can read and edit the traffic.
  • Intruder mode: a proxy feature that repeats one request many times, substituting a different value each time.
  • Redirect: the server telling the browser to fetch a different address instead.
  • Following redirects: automatically going to the address a redirect points to.
  • POST: a request type used to send data to the server.
  • GET: a request type used to ask the server for something.
  • HTTP/1.1: the version of the protocol browsers and servers use to exchange requests and responses.
  • Host header: the part of a request that says which website the request is for.
  • Session: the server's memory of who you are across multiple requests.
  • Stateless: having no memory of previous requests; the web is stateless, which is why sessions exist.
  • Hash: a short string produced from data, used as an identifier that is hard to guess.
  • Token: a short value issued by the server and expected back, used to recognise or authorise something.
  • CSRF token: a token placed in forms to prove a request came from the site's own pages.
  • Parameter: a named value sent with a request, such as payment_id.
  • Query string: extra values appended to an address after a question mark.
  • Transaction ID / booking number: the unique reference given to one booking or payment attempt.
  • Enumerate: to go through values systematically, one after another.
  • Authorisation: the check that you are allowed to do or see something.
  • Authentication: the check of who you are.
  • Front-end source: the HTML and code the browser receives and renders into the page.
  • Brute force: trying many values in turn until matches are found.
  • Enumeration primitive: a small weakness that can be repeated mechanically to extract many records.
  • Root cause: the underlying reason a vulnerability exists.
  • Impact: the harm that can result from a vulnerability.
  • Fix: the change made to remove the vulnerability.

More by YoKo Kho

View all

15 more disclosed reports, best first.

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.