Skip to content
IDOR Write-up Intermediate

What is BOLA? 3digit bounty from Topcoder ($$$)

An API endpoint used for watching forum threads authenticated users using multiple checkpoints, including a forum user ID and an API-defined ID in the request header. By changing the header ID and substituting the victim's Topcoder ID, the attacker could access the victim's PII such as email, name, and account ID.

can1337 Follow

Published on infosecwriteups.com

This write-up will be about Broken Object Level Authorization (BOLA), which is #1 topic of API Security (OWASP). I will also consider a case where I found this vulnerability.

can1337, on infosecwriteups.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

Topcoder is a competitive programming platform with a main site at topcoder.com and a forum hosted separately at apps.topcoder.com/forums. The forum used the main site account directly, so the PII held on the main site was also valid for the forum account.

The feature involved is the forum's Watch Thread action. When a user watches a thread, the forum front end sends a POST request to an API on a different host. That API returns account details for the user, including email, name and surname, and an account_id that is not shown on the Topcoder profile itself.

The vulnerability class is Broken Object Level Authorization (BOLA), the first entry in the OWASP API Security Top 10. BOLA is the API-level equivalent of IDOR: a request that should only return the caller's own object is accepted with another user's identifier, because the server does not check that the object belongs to the authenticated caller. The attack surface ranges from information disclosure to account takeover, depending on what the object exposes.

(Defense against BOLA) From the original on infosecwriteups.com

The diagram above illustrates the typical BOLA scenario: the API hands the victim and the attacker their own identities and access to their own sensitive data at a path such as https://redacted.com/exposed/v1/profiles/self-id, and the attacker then requests https://redacted.com/exposed/v1/profiles/target-id with the victim's user id. The report notes that user-specific variables do not always sit in a GET request: some APIs carry them in a POST body, and some vulnerable APIs are configured around more than one control point. The Topcoder case is of the second kind.

Setup

  1. Create an account on topcoder.com.
  2. Proxy traffic through Burp Suite and inspect every HTTP request made during registration and normal browsing.
  3. Create a second account to act as the victim.
  4. Have access to the forum at apps.topcoder.com/forums, which reuses the main site account.

No special role or privilege is needed. Any registered user can reach the Watch Thread feature.

Finding it

While checking requests during account creation, the researcher noticed the forum user-id being sent when membership was opened. The same value was visible in the source code of the member page, and it also appeared when viewing any other user's profile.

From the original on infosecwriteups.com

Nothing exploitable turned up on the main site, so the researcher moved to subdomains. After some duplicate reports, the forum at apps.topcoder.com/forums became the target. Because the forum used the main site account directly, the PII held on the main site was valid for the forum account as well.

From the original on infosecwriteups.com

Browsing a thread, the researcher opened the Watch Thread action with Intercept enabled and reviewed the resulting requests. An API on a different host was sending a POST request with no Authorization header. Two values in that request stood out: an ID defined by the API (the researcher's guess) in the request header, and the forum user-id in the POST data. The response contained the researcher's email, name and surname, and an account_id that were not reflected in the Topcoder profile.

From the original on infosecwriteups.com

Exploitation

Step 1: Change the id in the body

The researcher created a second user and replaced the Topcoder id in the data section with that of the victim. Nothing changed. The API was taking multiple values and could be using all of them to identify the user, so a single substitution was not enough.

Step 2: Change the header value as well

The ID reflected in the request header caught the researcher's attention. The last digit was replaced with another letter, and at the same time the Topcoder id in the body was replaced with the victim's Topcoder id. Both changes were sent in the same request.

From the original on infosecwriteups.com

The response returned the target's PII. The API was trying to authenticate the target user through multiple checkpoints, and the values it checked were publicly displayed on topcoder.com. When the API-issued ID in the header was changed to a random value, the response reflected sensitive data for the user identified in the body.

Root cause

The API performed object-level authorisation using several control points at once: an API-defined ID in a request header and the forum user-id in the POST body. The forum user-id was publicly displayed on topcoder.com, including on other users' profiles. The server did not bind the requested object to the authenticated caller; it accepted the combination of a modified header ID and a victim's user-id and returned that victim's data. The request carried no Authorization header.

Impact

An attacker with a registered account could read another user's email address, name and surname, and account_id, provided the attacker knew the victim's Topcoder id and the corresponding API-issued header value. Both were publicly available on topcoder.com, so the precondition was easy to meet. The report does not describe any path from this disclosure to account takeover; the demonstrated impact is disclosure of PII.

Fix

The report does not state what Topcoder changed. A fix would be to authorise every object access against the authenticated caller on the server, rather than trusting identifiers supplied in the header and body.

Variants to test

  1. Multi-checkpoint APIs. Find endpoints that combine a header identifier with a body identifier. Change one at a time, then both together, and compare responses. A positive result is another user's data in the response.
  2. Identifier substitution in POST bodies. For any action that returns profile data (watch, follow, subscribe), replace the user id in the body with a second account's id. A positive result is the second account's email or name appearing in the response.
  3. Publicly leaked identifiers. Check page source, registration requests and other users' profile pages for ids used by backend APIs. A positive result is an id that the API accepts as a control value.
  4. Missing Authorization headers. Look for API calls that carry no auth header but still return user-specific data. A positive result is data returned for a user other than the one whose identifiers were sent.

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

Topcoder is a website where programmers compete in coding challenges. Besides the main site at topcoder.com, it has a discussion forum at apps.topcoder.com/forums. The forum does not have its own login: you sign in on the main site, and the forum trusts that same account. So whatever personal details the main site holds about you (your email, your name) are also valid for your forum account.

The feature at the centre of this story is the forum's Watch Thread button. When you click it, the forum's front end quietly sends a message to a server program on a different host, asking it to remember that you are watching the thread. That server program replies with your account details: email, name and surname, and an account_id that is not shown on your Topcoder profile page.

The researcher found that this reply could be made to describe someone else by changing values in the request. That is the whole bug. Topcoder confirmed it and paid a bounty.

Before the details, a few words about the kind of bug this is.

What is an API?

An API (Application Programming Interface) is the set of doors a website's own pages use to talk to its servers. When you click a button, your browser does not usually reload a whole page; it sends a small message to an API, and the API sends back a small answer, often in a format called JSON (a way of writing data as text, like {"name": "Alex"}). Think of a restaurant: the menu and the waiter are the API. You do not walk into the kitchen yourself; you tell the waiter what you want, and the waiter brings it back. The kitchen is the server, the waiter is the API.

What is BOLA?

Broken Object Level Authorization (BOLA) is the first entry on the OWASP API Security Top 10, a well-known list of the most common API mistakes. OWASP is a non-profit group that publishes security guidance.

BOLA means: an API hands out a piece of data (an "object", such as a profile) without checking that the person asking is allowed to see that particular object. It is the API version of an older bug called IDOR (Insecure Direct Object Reference), where a web page uses a simple number in the URL, like ?user=42, and you can change 42 to 43 and see someone else's page.

A useful comparison: imagine a hotel where the receptionist gives you a key card for room 305. If the card opens every room whose number you type into the door, the hotel has a BOLA problem. The card proves you are a guest, but nobody checks that room 305 is yours.

BOLA can leak information (as here) or, in worse cases, let an attacker take over an account, depending on what the object exposes.

(Defense against BOLA) From the original on infosecwriteups.com

The diagram above shows the typical BOLA scenario. The API gives the victim and the attacker their own identities and access to their own sensitive data at a path such as https://redacted.com/exposed/v1/profiles/self-id. The attacker then requests https://redacted.com/exposed/v1/profiles/target-id, using the victim's user id, and the API returns the victim's data.

The report also notes that user-specific values do not always sit in a GET request (a request that just asks for something, with the values in the URL). Some APIs carry them in a POST request (a request that sends data to the server, with the values in the body of the message). And some vulnerable APIs are set up around more than one control point, meaning they check more than one value before deciding who you are. The Topcoder case is of that second kind.

Setting up

  1. Create an account on topcoder.com.
  2. Send your browser traffic through Burp Suite, a tool that sits between your browser and the website and lets you read and edit every request and response. Think of it as a transparent postbox: you can open every letter before it is delivered, and rewrite it.
  3. Create a second account to act as the victim.
  4. Make sure you can reach the forum at apps.topcoder.com/forums, which reuses the main site account.

No special role or privilege is needed. Any registered user can reach the Watch Thread feature.

Finding it

While checking the requests made during account creation, the researcher noticed the forum user-id being sent when membership was opened. The same value was visible in the source code of the member page (the HTML your browser receives, which you can view with "View Source"), and it also appeared when viewing any other user's profile.

From the original on infosecwriteups.com

Nothing exploitable turned up on the main site, so the researcher moved to subdomains (smaller sites under the same main name, like apps.topcoder.com under topcoder.com). After some duplicate reports, the forum at apps.topcoder.com/forums became the target. Because the forum used the main site account directly, the personal data held on the main site was valid for the forum account as well.

From the original on infosecwriteups.com

Browsing a thread, the researcher opened the Watch Thread action with Intercept enabled (Burp's mode that pauses each request so you can inspect it) and reviewed the resulting requests. An API on a different host was sending a POST request with no Authorization header. An Authorization header is the usual way a browser tells a server "this is me, here is my proof" (often a token, a long random string that acts like a temporary password). Its absence was a hint that the API was identifying users some other way.

Two values in that request stood out: an ID defined by the API (the researcher's guess) in the request header, and the forum user-id in the POST data. The response contained the researcher's email, name and surname, and an account_id that were not reflected in the Topcoder profile.

From the original on infosecwriteups.com

Exploiting it

Step 1: Change the id in the body

The researcher created a second user and replaced the Topcoder id in the data section with that of the victim. Nothing changed. The API was taking multiple values and could be using all of them to identify the user, so a single substitution was not enough.

Step 2: Change the header value as well

The ID reflected in the request header caught the researcher's attention. The last digit was replaced with another letter, and at the same time the Topcoder id in the body was replaced with the victim's Topcoder id. Both changes were sent in the same request.

From the original on infosecwriteups.com

The response returned the target's personal data. The API was trying to authenticate the target user through multiple checkpoints, and the values it checked were publicly displayed on topcoder.com. When the API-issued ID in the header was changed to a random value, the response reflected sensitive data for the user identified in the body.

Why it worked

The API performed object-level authorisation using several control points at once: an API-defined ID in a request header and the forum user-id in the POST body. The forum user-id was publicly displayed on topcoder.com, including on other users' profiles. The server did not bind the requested object to the authenticated caller; it accepted the combination of a modified header ID and a victim's user-id and returned that victim's data. The request carried no Authorization header.

What an attacker could do

An attacker with a registered account could read another user's email address, name and surname, and account_id, provided the attacker knew the victim's Topcoder id and the corresponding API-issued header value. Both were publicly available on topcoder.com, so the precondition was easy to meet. The report does not describe any path from this disclosure to account takeover; the demonstrated impact is disclosure of personal information.

How to fix it

The report does not state what Topcoder changed. A fix would be to authorise every object access against the authenticated caller on the server, rather than trusting identifiers supplied in the header and body.

Things to try on other sites

  1. Multi-checkpoint APIs. Find endpoints that combine a header identifier with a body identifier. Change one at a time, then both together, and compare responses. A positive result is another user's data in the response.
  2. Identifier substitution in POST bodies. For any action that returns profile data (watch, follow, subscribe), replace the user id in the body with a second account's id. A positive result is the second account's email or name appearing in the response.
  3. Publicly leaked identifiers. Check page source, registration requests and other users' profile pages for ids used by backend APIs. A positive result is an id that the API accepts as a control value.
  4. Missing Authorization headers. Look for API calls that carry no auth header but still return user-specific data. A positive result is data returned for a user other than the one whose identifiers were sent.

Glossary

  • API: the set of doors a website's pages use to talk to its servers, sending small messages and receiving small answers.
  • JSON: a text format for writing data, like {"name": "Alex"}, commonly used in API answers.
  • BOLA (Broken Object Level Authorization): an API bug where a request for one user's data is accepted with another user's identifier, because the server does not check that the object belongs to the caller.
  • OWASP: a non-profit group that publishes security guidance, including the API Security Top 10.
  • IDOR (Insecure Direct Object Reference): a web bug where a simple identifier in a URL or form (like ?user=42) can be changed to reach someone else's data.
  • GET request: a request that asks for something, with values in the URL.
  • POST request: a request that sends data to the server, with values in the body of the message.
  • Control point: a value the server checks to decide who you are; some APIs check more than one.
  • Burp Suite: a tool that sits between your browser and a website so you can read and edit every request and response.
  • Intercept: Burp's mode that pauses each request so you can inspect it before it is sent.
  • Subdomain: a smaller site under the same main name, like apps.topcoder.com under topcoder.com.
  • Authorization header: the usual way a browser tells a server "this is me, here is my proof".
  • Token: a long random string that acts like a temporary password, often carried in an Authorization header.
  • PII (Personally Identifiable Information): data that identifies a person, such as email, name and surname.
  • account_id: an internal number the API uses to identify an account; here it was not shown on the public profile.
  • Bounty: a reward a company pays a researcher for reporting a security bug.

More by can1337

View all

9 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.