Lesson 2 of 5 · 18 min · Intermediate

Broken object level authorisation (BOLA)

The number one API risk, and how to test for it.

In this lesson you will

  • Find broken object level authorisation (BOLA), API1, systematically
  • Find broken function level authorisation (BFLA), API5
  • Use two accounts per role and an authorisation matrix for APIs
  • Recommend fixes that check ownership on every request

Broken object level authorisation (BOLA) is number one in the OWASP API Security Top 10, and for good reason: it's common, easy to exploit and usually serious. It's the API version of the IDOR you met in the web track. Its sibling, broken function level authorisation (BFLA), is number five. Together they cover the two questions an API must ask on every request: may this user touch this object? and may this user call this function?

BOLA (API1): someone else's object

An API endpoint takes an object identifier and returns or changes that object without checking it belongs to the caller.

http
GET /api/v2/vehicles/7f3c1e2a-9b4d-4c1e-8f2a-1d2e3f4a5b6c/location HTTP/1.1
Authorization: Bearer <alice's token>

If Alice can replace that vehicle ID with Bob's and get Bob's car location, that's BOLA. In real incidents, BOLA has exposed vehicle locations, medical records, bank statements and entire customer databases.

Why it's so common in APIs

  • APIs expose object IDs directly in paths, queries and bodies.
  • Developers check that the user is logged in and forget to check that the user owns the object.
  • Authorisation logic is copied endpoint by endpoint, and one copy is always missing.

Where IDs hide

  • Path segments: /users/42/invoices/1001
  • Query strings: ?accountId=42
  • JSON bodies: {"orderId": 1001}
  • Headers: X-Tenant-Id: 7
  • Nested and related objects: the customerId inside an order you do own
  • Batch endpoints: {"ids": [1001, 1002, 1003]}

Testing BOLA systematically

Two accounts per role

Create user A and user B with the same role. Every object belongs to one of them, so you can test cross-access using only your own test data.

The method

  1. As user A, use every feature and record each request containing an object ID.
  2. Note user B's IDs for the same kinds of objects.
  3. Replay each of A's requests, with A's token, but B's IDs.
  4. Test every method: B's object might be protected for GET but not for PATCH or DELETE.
  5. Test related endpoints: if /orders/{id} is protected, check /orders/{id}/invoice, /orders/{id}/items and exports.

"The IDs are UUIDs"

Random identifiers make guessing impractical, but they aren't access control. UUIDs leak through other responses, shared links, emails, logs and public features like reviews or leaderboards. If you can obtain B's ID by any means and the API returns B's data, it's BOLA. Report it, and note how the ID was obtained.

Useful variations

  • Different ID formats: if /users/42 is blocked, try /users/42.json, /users/0042 or an array [42].
  • Parameter pollution: ?id=MY_ID&id=OTHER_ID: which one does the server use for the check, and which for the lookup?
  • Wrapped IDs: IDs inside Base64 or JWTs can be decoded, changed and re-encoded if they aren't signed.
  • "Me" endpoints: /users/me may be safe while /users/{id} isn't.

BFLA (API5): someone else's function

BFLA is about functions, not objects: a normal user calling an endpoint meant for admins or another role.

Finding admin functions

  • Documentation listing admin endpoints.
  • JavaScript for the admin interface, often shipped to every user.
  • Predictable patterns: if GET /api/v2/users/42 exists, try GET /api/v2/admin/users or DELETE /api/v2/users/42.
  • Different paths for the same action: /api/v2/users/42/role versus /api/v2/admin/users/42.

Testing

  1. Capture admin requests while logged in as an admin test account.
  2. Replay them with a normal user's token, and with no token at all.
  3. Try method switching: an endpoint that blocks DELETE may allow POST with a parameter like _method=DELETE or an override header.

The Autorize Burp extension automates replaying with a low-privilege token, as in the web track.

The API authorisation matrix

Build the matrix from the web track for the API: endpoints down the side, roles and both same-role accounts across the top, with the expected result in each cell. Test every cell; each mismatch is a finding.

Endpoint Anonymous User A User B Mechanic Admin
GET /vehicles/{A's id}/location 401 200 403 403 200
PATCH /users/{A's id} 401 200 403 403 200
GET /admin/users 401 403 403 403 200
POST /mechanic/reports 401 403 403 200 200

Proving impact responsibly

  • Use your own two test accounts for cross-access whenever possible.
  • If real data must be shown, retrieve one record, don't download, and redact it.
  • Never modify or delete real users' data. Prove write access against your own test objects.
  • For broad BOLA, explain scale: "any of the platform's users' records can be retrieved by iterating IDs", without actually iterating them.

How it gets fixed

  • Check ownership on every request, in a central authorisation layer, for every method: look objects up with the caller's identity (for example, order 1001 where owner = current user).
  • Take the user and tenant identity from the server-side session or token, never from client-supplied IDs.
  • Deny by default for functions; map every endpoint to the roles allowed to call it.
  • Add automated tests that call each endpoint as the wrong user and expect a 403 or 404.
  • Reference: OWASP API Security Top 10, API1 and API5.

Lab

In crAPI with your two accounts:

  1. Find an endpoint that returns vehicle information by ID. Can user A see user B's vehicle?
  2. Find where other users' IDs leak (hint: look at community or public features).
  3. Look for an endpoint that seems intended for mechanics or admins and call it as a normal user.
  4. Build an authorisation matrix for six crAPI endpoints and test every cell.
  5. Write one complete BOLA finding with reproduction steps and the ownership-check fix.

Checkpoint

  1. What's the difference between BOLA and BFLA?
  2. Why do you need two accounts with the same role?
  3. Name four places an object ID can appear in an API request.
  4. Why must the fix use the identity from the session rather than from the request?