Skip to content
IDOR Write-up Beginner

BOLA in the Wild: Reading Another User’s Full Profile by Changing One UUID

The profile endpoint returned any user's full profile to any authenticated session, because it looked up the ID in the URL without checking that the ID belonged to the caller. An attacker with a normal account could read other users' emails, usernames, full names and roles by swapping the ID.

Neel Chauhan Follow

Published on medium.com

Bola

Neel Chauhan, 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. 6 min read.

Context

This write-up covers a Broken Object Level Authorization (BOLA) flaw in a profile API. The feature is the endpoint that returns a user's own profile: the client sends a request to /api/profile/{user-id} and the server responds with a JSON object containing the account's details. The report classifies the issue as CWE-639 (Authorization Bypass Through User-Controlled Key) and CWE-284 (Improper Access Control), with a CVSS 3.1 score of 6.5 (Medium), vector AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.

The point of the endpoint is that a logged-in user can read their own profile. The question the researcher set out to answer is whether the server checks that the {user-id} in the path belongs to the session making the request, or whether it simply looks up whatever ID it is handed and returns it.

Setup

BOLA cannot be tested with a single account. You need two separate identities, so that you can prove the server is failing to check ownership, not just failing to check authentication. The researcher created two test accounts specifically for this and used one to attack the other's data.

From the original on medium.com

The two accounts are referred to as Account A (the attacker's session) and Account B (the victim whose data is read). The only tooling shown is direct HTTP requests against the API, with an authenticated session cookie for Account A.

Finding it

The baseline request fetches the researcher's own profile, authenticated as Account A, with Account A's own ID in the path:

HTTP
GET /api/profile/{own-user-id} HTTP/2Cookie: [redacted] as Account A>

The response is a normal success:

HTTP
HTTP/2 200 OKContent-Type: application/json
JSON
{  "ok": true,  "profile": {    "id": "{own-user-id}",    "username": "account_a",    "email": "[redacted]",    "role": "user"  }}

This is the expected behaviour: my session, my ID in the URL, my data back. Nothing here is wrong on its own. The finding comes from what happens when the ID in the path is changed while the session stays the same.

Exploitation

Step 1: obtain a second account's UUID

The researcher obtained Account B's UUID. In this case it was straightforward to get through the application's own normal use. In a real-world attacker scenario, the report notes, the ID could instead come from enumeration, from a leaked ID in some other response, or from brute-forcing a UUID structure if it turned out to be predictable.

Step 2: replay the same request with the other account's ID

Still authenticated as Account A, the researcher substituted Account B's ID into the same request:

HTTP
GET /api/profile/122b172f-f3cc-440a-820b-2b722ce596ea HTTP/2Cookie: [redacted] authenticated as Account A>

The only thing that changed between the baseline and this request is the UUID in the path. The session cookie is unchanged and still belongs to Account A.

Step 3: read the response

The server returned a normal success, not an error:

HTTP
HTTP/2 200 OKContent-Type: application/json
JSON
{  "ok": true,  "profile": {    "id": "122b172f-f3cc-440a-820b-2b722ce596ea",    "username": "account_b",    "email": "[redacted]",    "full_name": "account_b",    "bio": null,    "avatar_url": null,    "role": "user"  }}

This is the full profile object for an account the requesting session has no relationship to whatsoever, returned to a session that was never granted any access to it. There was no error, no 403, and no ownership check at all. The server authenticated the request, confirming the caller was logged in as someone, but never authorised it, never confirming the caller was logged in as the right someone.

Root cause

The report shows the handler in pseudocode:

JavaScript
function getProfile(req, res) {  const user = db.findById(req.params.id);     return res.json({ ok: true, profile: user });}

There is no line anywhere in this handler that touches req.session.userId. The authenticated session and the requested resource are two completely disconnected values as far as this endpoint is concerned: the ID from the path is passed straight to the database lookup, and whatever comes back is serialised into the response. The authentication layer did its job, which is why the request was accepted at all; the missing piece is the object-level check that the looked-up record belongs to the session.

Impact

The direct impact is information disclosure: any authenticated user can read the full profile object of any other user whose ID they know or can obtain. The report singles out one field, role, as the reason this is more than a generic data leak. Because the response includes the account's role, an attacker can iterate through UUIDs, or use any other way of discovering them, and build a map of which accounts on the platform are administrators before ever attempting to compromise any of them. That meaningfully sharpens the targeting for a subsequent attack, such as the privilege escalation and account-takeover findings the researcher documented separately in the same engagement.

At scale, the endpoint alone is enough to harvest emails, usernames and full names across the platform's entire user base, which has obvious downstream value for phishing and credential-stuffing target lists. The practical precondition is the ability to obtain valid user IDs; the report treats the UUID as obtainable through normal application use, enumeration, leakage in other responses, or brute force if the structure is predictable.

A negative result on a second object type

To check whether the same pattern existed elsewhere, the researcher also tested the session-audit endpoint, since it also deals with per-user data:

HTTP
GET /api/sessions/audit HTTP/2Cookie: [redacted] A, with Account B

This came back correctly scoped, returning only Account A's own session records, with no cross-account leakage. The report documents this as a negative result: it shows the BOLA issue on /api/profile/{id} is not a platform-wide pattern repeated everywhere, but is specific to that endpoint's implementation. That is useful context both for prioritising the fix and for deciding whether other similarly structured endpoints need the same review.

Fix

The report does not describe a fix being applied or a patch being deployed. What it establishes is the condition the handler is missing: the lookup should be tied to the authenticated session, so that the ID in the path is checked against req.session.userId rather than trusted on its own. The negative result on /api/sessions/audit is useful context for prioritising the fix and for checking whether other similarly structured endpoints need the same review.

Variants to test

  1. Path-based object references on other resources. Take any endpoint of the form /api/<resource>/{id} that returns per-user data and replay it with a second account's ID while keeping the first account's session. A positive result is a 200 containing the other account's fields instead of a 403 or 404.
  2. Nested and related objects. Try IDs belonging to objects the session does not own, such as another user's sessions, orders or documents, where the endpoint derives the owner from the URL rather than the session. A positive result is any record whose owner differs from the session identity.
  3. Fields that aid targeting. Look for fields such as role, group membership or tenant identifiers in the leaked object. A positive result is the ability to enumerate privileged accounts before attempting any compromise.
  4. ID predictability. Where identifiers are UUIDs, check whether they are exposed elsewhere in normal responses or generated in a predictable way. A positive result is a reliable way to obtain valid IDs at scale, which turns a single-object leak into a harvest.
  5. Endpoints that behave correctly. Test sibling endpoints that handle per-user data, as the researcher did with /api/sessions/audit, to separate an endpoint-specific bug from a platform-wide pattern. A correctly scoped response is a useful negative result for prioritising the fix and for identifying which implementation to copy.

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

What happened, in plain words

A website had a page in its API that returns your own profile: your username, your email address, your role on the site. The address of that page included your user ID, a long string of letters and numbers that identifies your account. The idea is simple: you are logged in, you ask for your profile, you get your profile back.

The problem was that the server never checked whether the ID in the address actually belonged to the person asking. It took whatever ID it was given, looked it up in its database, and sent back the matching profile. So if you were logged in as one user and you changed the ID in the address to somebody else's ID, the server happily handed you that other person's full profile: their email address, their username, their full name, and their role.

This kind of bug has a name: Broken Object Level Authorization, usually shortened to BOLA. The report also labels it CWE-639 (Authorization Bypass Through User-Controlled Key) and CWE-284 (Improper Access Control), and gives it a CVSS 3.1 score of 6.5, which is Medium, with the vector AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.

A few of those terms need unpacking before anything else makes sense.

An API is the part of a website that the page's own code talks to behind the scenes. When you open your profile page, the page does not contain your data in advance; it asks the API for it, the API answers with the data, and the page draws it on screen. You can think of it as the counter of a shop: you ask for an item by name, the person behind the counter fetches it. The API here lives under addresses starting with /api/.

A cookie is a small piece of text your browser stores for a website and sends back with every request to that site. When you log in, the site gives your browser a cookie containing a session, which is the site's way of remembering that this browser is you. Every request you make afterwards carries that cookie, so the server knows who is asking. If you have ever ticked "remember me" on a site, you have used a cookie.

Authentication means proving who you are, like showing your passport at a hotel reception. Authorization means deciding what you are allowed to do once you are inside, like the receptionist checking that room 214 is actually yours before handing over the key. This bug is an authorization failure: the server checked the passport, then handed over any room key that was asked for.

BOLA is exactly that: the server looks up an object (here, a profile) by an identifier supplied by the user, without checking that the user owns that object. The identifier in this case is a UUID, a long random-looking string such as 122b172f-f3cc-440a-820b-2b722ce596ea, used instead of a simple number like 42 so that IDs are hard to guess.

Setting up a proper two-account test

You cannot test this kind of bug with a single account. If you only have one account and you ask for your own profile, everything looks fine, because it is fine. To prove the server is not checking ownership, you need two separate identities: one to make the request, and one whose data you try to read. That way you can show the server is failing to check ownership, not just failing to check authentication.

The researcher created two test accounts specifically for this and used one to attack the other's data. Throughout the report they are called Account A, the attacker's session, and Account B, the victim whose data gets read. The only tool used is direct HTTP requests against the API, carrying Account A's session cookie.

From the original on medium.com

Baseline: fetching your own profile

Before trying anything unusual, the researcher did the normal thing: asked for their own profile while logged in as Account A, with Account A's own ID in the address. This is the baseline, the known-good request you compare everything else against. It is like weighing yourself on a scale before weighing a parcel: you need the normal reading first.

HTTP
GET /api/profile/{own-user-id} HTTP/2Cookie: [redacted] as Account A>

Line by line:

  • GET is the type of request. It means "give me this thing", as opposed to sending data to the server. When your browser loads a page, it is doing a GET.
  • /api/profile/{own-user-id} is the address being requested. {own-user-id} is a placeholder standing for Account A's real ID; the curly brackets are not sent literally.
  • HTTP/2 is the version of the language the browser and server use to talk to each other. It is a technical detail here, not part of the bug.
  • Cookie: [redacted] as Account A> is the header carrying the session cookie. A header is a labelled line of extra information sent along with a request, like the address block on an envelope. The value is shown as a description rather than the real cookie, because a real session cookie is a secret: anyone holding it can act as you until it expires.

The server answered with a normal success:

HTTP
HTTP/2 200 OKContent-Type: application/json
  • HTTP/2 200 OK is the status line. 200 is the standard code for "here is what you asked for". Other codes you will meet later: 403 means "I know who you are but you are not allowed", and 404 means "not found".
  • Content-Type: application/json says the body of the answer is in JSON, a text format for structured data. It looks like a set of labelled boxes: a name, a colon, a value.
JSON
{  "ok": true,  "profile": {    "id": "{own-user-id}",    "username": "account_a",    "email": "[redacted]",    "role": "user"  }}
  • The outer { ... } is one JSON object, a bundle of labelled values.
  • "ok": true says the request succeeded.
  • "profile": { ... } is a nested object holding the account details.
  • "id" is the account's identifier, the same one that was in the address.
  • "username" and "email" are the account's name and email address.
  • "role" says what kind of account it is. Here it is "user", an ordinary account; other accounts might have a more powerful role such as administrator.

This is the expected behaviour: my session, my ID in the address, my data back. Nothing is wrong yet. The finding comes from what happens when the ID in the address is changed while the session stays the same.

The actual test: same session, different ID

The question that defines a BOLA test is simple: does the server check that the {user-id} in the address belongs to the session making the request, or does it just look up whatever ID it is handed and return it? In shop terms: does the person behind the counter check that the order number is yours, or do they hand over any parcel whose number you read out?

Step 1: obtain a second account's UUID

The researcher obtained Account B's UUID. In this case it was straightforward to get through the application's own normal use. In a real-world attacker scenario, the report notes, the ID could instead come from enumeration (trying many IDs in turn), from an ID leaked in some other response, or from brute-forcing a UUID structure if it turned out to be predictable. Brute force means simply trying huge numbers of possibilities until one works.

Step 2: replay the same request with the other account's ID

Still logged in as Account A, the researcher put Account B's ID into the same request. The only thing that changed between the baseline and this request is the UUID in the address. The session cookie is unchanged and still belongs to Account A.

HTTP
GET /api/profile/122b172f-f3cc-440a-820b-2b722ce596ea HTTP/2Cookie: [redacted] authenticated as Account A>
  • GET is the same kind of request as before.
  • /api/profile/122b172f-f3cc-440a-820b-2b722ce596ea is the same endpoint, but with Account B's UUID in place of Account A's. This is the whole attack: one string swapped.
  • Cookie: [redacted] authenticated as Account A> is the same session as the baseline. The word STILL is there to make the point that the identity making the request did not change at all.

Step 3: read the response

The server returned a normal success, not an error:

HTTP
HTTP/2 200 OKContent-Type: application/json
  • 200 OK again means "here is what you asked for". A correct server would have answered 403 (you are not allowed) or 404 (no such thing for you).
  • Content-Type: application/json again says the body is JSON.
JSON
{  "ok": true,  "profile": {    "id": "122b172f-f3cc-440a-820b-2b722ce596ea",    "username": "account_b",    "email": "[redacted]",    "full_name": "account_b",    "bio": null,    "avatar_url": null,    "role": "user"  }}
  • "ok": true says the request succeeded, which is the problem: it should not have.
  • "id" is Account B's UUID, the one that was put in the address.
  • "username" and "email" are Account B's details, not Account A's.
  • "full_name" is the account's full name.
  • "bio" and "avatar_url" are the profile description and profile picture address. Both are null, which in JSON means "empty, nothing set".
  • "role" is the account's role, here "user".

This is the full profile object for an account the requesting session has no relationship to whatsoever, returned to a session that was never granted any access to it. There was no error, no 403, and no ownership check at all. The server authenticated the request, confirming the caller was logged in as someone, but never authorised it, never confirming the caller was logged in as the right someone.

Root cause, in pseudocode

The report shows the code behind the endpoint in pseudocode, a simplified sketch of a program rather than the real thing. It is there to show the shape of the mistake, not to be run.

JavaScript
function getProfile(req, res) {  const user = db.findById(req.params.id);     return res.json({ ok: true, profile: user });}

Line by line:

  • function getProfile(req, res) defines a function called getProfile, the piece of code that runs whenever this endpoint is called. req stands for the incoming request and res for the answer that will be sent back.
  • const user = db.findById(req.params.id); takes the ID from the address (req.params.id), asks the database (db) to find the record with that ID, and stores the result in a variable called user.
  • return res.json({ ok: true, profile: user }); sends that record back as a JSON answer, wrapped in ok and profile.

There is no line anywhere in this handler that touches req.session.userId, the value that says which account is logged in. The authenticated session and the requested record are two completely disconnected values as far as this endpoint is concerned: the ID from the address goes straight to the database lookup, and whatever comes back is sent out. The login check did its job, which is why the request was accepted at all; the missing piece is the check that the record found actually belongs to the session.

Why the role field specifically escalates the severity

This finding is more than a generic data leak because of one specific field in the response: role. That turns a straightforward information disclosure into a reconnaissance tool. Reconnaissance means gathering information about a target before attacking it, like studying a building's layout before deciding which door to try.

An attacker can go through UUIDs, or use any other way of discovering them, and build a map of which accounts on the platform are administrators before ever attempting to compromise any of them. That meaningfully sharpens the targeting for a subsequent attack, such as the privilege escalation and account-takeover findings the researcher documented separately in the same engagement. Privilege escalation means getting more power on a system than you were given; account takeover means getting control of somebody else's account.

Beyond that, at scale, this endpoint alone is enough to harvest emails, usernames and full names across the platform's entire user base. That has obvious downstream value for phishing (fake messages designed to trick people into handing over passwords or other details) and for credential-stuffing target lists (trying username and password pairs stolen elsewhere on other sites, on the hope that people reuse them).

The practical precondition is the ability to obtain valid user IDs. The report notes that in a real-world attacker scenario the ID could come from enumeration, a leaked ID in some other response, or brute-forcing a UUID structure if it turned out to be predictable.

Confirming it wasn't a one-off with a second object type

To check whether the same pattern existed elsewhere, the researcher also tested the session-audit endpoint, since it also deals with per-user data. A session audit endpoint deals with per-user session data, which is private to that account in the same way a profile is.

HTTP
GET /api/sessions/audit HTTP/2Cookie: [redacted] A, with Account B
  • GET /api/sessions/audit asks for the session audit list. Notice there is no ID in the address at all: the server has to work out whose list to return from the session cookie alone.
  • Cookie: [redacted] A, with Account B is the session cookie, shown here as a description rather than a real value.

This came back correctly scoped, returning only Account A's own session records, with no cross-account leakage. The report documents this as a negative result: a test that found nothing wrong. Negative results matter because they show the BOLA issue on /api/profile/{id} is not a platform-wide pattern repeated everywhere, but is specific to that endpoint's implementation. That is useful context both for prioritising the fix and for deciding whether other similarly structured endpoints need the same review.

Fix

The report does not describe a fix being applied or a patch being deployed. What it establishes is the condition the handler is missing: the lookup should be tied to the authenticated session, so that the ID in the address is checked against req.session.userId rather than trusted on its own. The negative result on /api/sessions/audit is useful context for prioritising the fix and for checking whether other similarly structured endpoints need the same review.

Variants to test

If you want to look for the same kind of mistake elsewhere, these are the directions the report points to. Each one describes what to try and what a positive result looks like.

  1. Path-based object references on other resources. Take any endpoint of the form /api/<resource>/{id} that returns per-user data and replay it with a second account's ID while keeping the first account's session. A positive result is a 200 containing the other account's fields instead of a 403 or 404.
  2. Nested and related objects. Try IDs belonging to objects the session does not own, such as another user's sessions, orders or documents, where the endpoint takes the owner from the address rather than from the session. A positive result is any record whose owner differs from the session identity.
  3. Fields that aid targeting. Look for fields such as role, group membership or tenant identifiers in the leaked object. A positive result is the ability to list privileged accounts before attempting any compromise.
  4. ID predictability. Where identifiers are UUIDs, check whether they are exposed elsewhere in normal responses or generated in a predictable way. A positive result is a reliable way to obtain valid IDs at scale, which turns a single-record leak into a harvest.
  5. Endpoints that behave correctly. Test sibling endpoints that handle per-user data, as the researcher did with /api/sessions/audit, to separate an endpoint-specific bug from a platform-wide pattern. A correctly scoped response is a useful negative result for prioritising the fix and for identifying which implementation to copy.

Glossary

  • API: the part of a website that its pages talk to behind the scenes to fetch and send data.
  • Authentication: proving who you are, for example by logging in.
  • Authorization: deciding what a logged-in user is allowed to see or do.
  • Baseline: the normal, known-good request you compare later tests against.
  • BOLA (Broken Object Level Authorization): a bug where the server looks up a record by an ID supplied by the user without checking that the user owns it.
  • Brute force: trying very large numbers of possibilities until one works.
  • Cookie: a small piece of text a site stores in your browser and receives back with each request, often used to remember that you are logged in.
  • Credential stuffing: trying username and password pairs stolen from one site on another, hoping people reuse them.
  • CVSS: a standard scoring system for the severity of a security flaw; 6.5 is Medium.
  • CWE-639: the catalogue entry for an authorization bypass caused by a user-controlled key, such as an ID in an address.
  • CWE-284: the catalogue entry for improper access control in general.
  • Endpoint: one specific address on an API that does one specific job, such as returning a profile.
  • Enumeration: going through many possible values, such as IDs, one after another.
  • Header: a labelled line of extra information sent with a request or response, such as the cookie or the content type.
  • HTTP/2: the version of the protocol browsers and servers use to exchange requests and responses.
  • JSON: a text format for structured data, made of labelled values in curly brackets.
  • Negative result: a test that found nothing wrong, which is still useful information.
  • Phishing: fake messages designed to trick people into giving away passwords or other details.
  • Privilege escalation: gaining more power on a system than you were given.
  • Pseudocode: a simplified sketch of code that shows its logic without being runnable.
  • Reconnaissance: gathering information about a target before attacking it.
  • Role: the kind of account a user has, such as ordinary user or administrator.
  • Session: the site's record that a particular browser is logged in as a particular user, carried in a cookie.
  • Status code: the number at the start of a response saying how it went, such as 200 for success, 403 for forbidden, 404 for not found.
  • UUID: a long, random-looking string used as an identifier, hard to guess compared with a simple number.
  • Account takeover: gaining control of somebody else's account.

More by Neel Chauhan

View all

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