Lesson 3 of 9 · 27m
BOLA: Object-Level Authorization Done Properly
Systematically test whether the server enforces ownership, tenancy, and relationship constraints on every object reference.
Broken Object Level Authorization is the API bug class that keeps paying rent in real breach reports. The endpoint works exactly as designed; the object reference is just trusted far more than it deserves. If you remember one rule, make it this: the existence of an ID is not proof that the caller may use the object behind it.
The mental model
BOLA lives one layer below authentication. The server knows who you are, but fails to prove that the requested object belongs to you, your tenant, or an allowed relationship:
GET /v1/invoices/10492 HTTP/2
Authorization: Bearer eyJ...If invoice 10492 belongs to another customer and still returns data, authentication is fine and object authorization is broken. The check must happen server-side for every read, update, delete, export, share, restore, and indirect object use.
Use a two-account matrix
Testing with one account tells you almost nothing. Create or use two authorized test users in separate tenants and compare behavior:
curl -s -o a.json -w '%{http_code}
' -H "authorization: Bearer $A" https://api.target.local/v1/invoices/1001
curl -s -o b.json -w '%{http_code}
' -H "authorization: Bearer $B" https://api.target.local/v1/invoices/1001You care about four outcomes: allowed owner, denied stranger, indirect access, and different representation. "Different representation" catches sneaky partial leaks: 200 with masked fields, a metadata-only response, or an error revealing existence.
IDs are not only path parameters
Object references hide everywhere:
{
"invoice_id": 1001,
"recipient": {"user_id": 42},
"items": [{"document_id": "01J8..."}],
"next": "/v1/invoices/1001/download"
}Test path IDs, body IDs, nested IDs, query filters, batch arrays, export jobs, webhook subscriptions, and relationship endpoints. GraphQL nodes and "get by external key" conveniences are common BOLA sinks.
Random IDs help, but are not authorization
UUIDv4 or ULIDs reduce guessing. They do not prevent access after IDs leak through logs, referrers, screenshots, emails, search indexes, or other APIs. A secure design treats the identifier as opaque but unguessable, while still checking ownership.
Distinguish BOLA from missing function authorization
GET /v1/users/55 is object authorization. POST /v1/admin/users is function-level authorization. They overlap in exploitation but not in remediation: BOLA fixes are object-scoped policy checks; admin-route fixes are capability checks. Write the distinction clearly in your report or engineering will patch the wrong layer.
Field notes
- A 403 for one object proves nothing about the next object; IDs are often loaded through different services or repositories.
- Batch endpoints amplify impact: one authorization mistake becomes a bulk extraction primitive.
- Test soft-deleted, archived, pending, draft, and trial objects. State transitions often bypass the normal policy path.
- Prefer evidence with two accounts and exact object ownership. "I changed the number and saw data" is not enough without proving whose data it was.
Was this lesson helpful?