BOLA: broken object level authorization in APIs

Broken object level authorization (BOLA) is an API that returns or changes an object without checking that the caller may access that particular object. The caller is authenticated, the request is well formed, and the object ID in it belongs to someone else. It is the first item, API1, in the OWASP API Security Top 10 2023, and it is the API form of the older insecure direct object reference.

Section API security Updated OWASP API API1:2023

Quick facts

Stands for
Broken object level authorization
Ranking
API1, first in the OWASP API Security Top 10 2023; see OWASP API Top 10
Weakness
CWE-639, the same as IDOR
Where the ID travels
Path, query string, JSON body or header
Does a WAF stop it?
No. Only the API knows which object belongs to which caller

Definitions follow OWASP API1:2023.

How a BOLA attack works

  1. The attacker gets a normal account. Signing up, or using a stolen one, gives a valid token.
  2. They call the API for their own objects. GET /api/v1/orders/58213 returns their order.
  3. They change the identifier. 58214, or an ID seen in another response, a shared link or a mobile app.
  4. The API answers. It checked that the token is valid, not that this order belongs to the token's owner.

With a script the same loop runs over thousands of identifiers, which is how BOLA turns into a bulk data leak rather than one exposed record.

BOLA vs IDOR

They are the same flaw seen from two angles. IDOR is the older name from web applications, where the ID usually sits in a page address or form. BOLA is the name OWASP chose for APIs, where object IDs are in every call and clients, such as mobile apps, expose the full list of endpoints to anyone who looks.

APIs make the flaw more frequent for two reasons. There are many endpoints that each take an ID, and each needs its own check. And the API is often built assuming only the official app will call it, so the checks are left to the app's screens.

WHERE BOLA HIDES IN AN API NEEDS ITS OWN CHECK OFTEN FORGOTTEN VISIBLE TO A FILTER GET ONE OBJECT LIST OBJECTS UPDATE OR DELETE NESTED: /USERS/{ID}/FILES // every endpoint that takes an ID needs its own check
// four kinds of endpoint, and where the check goes missing

Finding BOLA vulnerabilities

Test with two accounts. Record every call the first account makes, swap its token for the second account's, and replay: any call that still succeeds against the first account's objects is BOLA. Include list endpoints, filters and nested routes, not only single-object reads. The wider method is on API security testing.

In live logs, the signal is one caller requesting many object IDs, or IDs that belong to other callers. Spotting it needs the API's own data about ownership, so it is usually built into the application's logging rather than in front of it.

How to prevent BOLA

  1. Check authorisation for the object, not just the caller. Every endpoint that receives an ID confirms the caller may act on that object.
  2. Derive the owner from the token. Look the object up through the authenticated user, never through a user ID sent in the request.
  3. Use one authorisation layer. A shared policy check is easier to keep complete than code in every handler.
  4. Prefer random identifiers. UUIDs slow enumeration; they do not replace the check.
  5. Write tests that call across accounts. Make a failing cross-account call part of the test suite for each endpoint.

An API gateway can validate tokens and schemas, but it rarely knows who owns object 58214. The check belongs where the data is. The rest of the picture is on API security.

What a WAF and rate limits can do

A request filter cannot recognise BOLA: the request is authenticated, the ID is a valid number, and nothing in it is an attack pattern. It can still remove other risks from the same endpoints, such as injection in the ID field.

Rate limits help in one specific way. BOLA is usually exploited by walking through many IDs, and limiting how many requests one client makes per minute slows that walk and makes it visible. It narrows the damage; the fix is still in the API.

Questions

What is BOLA?

BOLA, broken object level authorization, is an API flaw where the API returns or changes an object without checking that the caller may access that specific object. It is API1 in the OWASP API Security Top 10 2023.

Is BOLA the same as IDOR?

Yes, it is the same flaw. IDOR is the older name used for web applications; BOLA is the name the OWASP API Security Top 10 uses for APIs.

Why is BOLA the top API risk?

APIs have many endpoints that take object IDs, each needs its own ownership check, and the checks are often left to the client app. Missing one exposes data in bulk.

How do you prevent BOLA?

Check on every endpoint that the authenticated caller may act on the requested object, look objects up through the caller's identity, centralise authorisation, and test with two accounts.