Broken Object Level Authorization (BOLA)
Learn how APIs fail to verify that the requesting user has permission to access specific objects.
TAMPER OBJECT IDENTIFIER
Client substitutes foreign resource ID
User 'Bob' observes legitimate endpoint structure and tampers with the object ID parameter, requesting data belonging to User 'Alice' to test for Broken Object Level Authorization (BOLA).
GET /api/v2/customers/1092/private_records HTTP/1.1 Host: api.gateway.corp Authorization: Bearer <Bob_Valid_JWT>
PACKET FLOW (WIRESHARK INSPECTOR)
| NO. | TIME | SOURCE | DESTINATION | PROTOCOL | INFO | SIZE |
|---|---|---|---|---|---|---|
| 1 | 0.000s | 192.168.1.10 | api.gateway.corp | HTTP | GET /api/v2/customers/1092/private_records [Auth: Bob] | 162 B |
| 2 | 0.015s | api.gateway.corp | 10.0.1.25 | JSON | RPC: Forwarding request to Account Microservice | 198 B |
| 3 | 0.028s | 10.0.1.25 | 10.0.2.90 | SQL | QUERY: SELECT * FROM customers WHERE id = 1092 | 174 B |
| 4 | 0.041s | 10.0.2.90 | 10.0.1.25 | SQL | DATA: [id=1092, owner=Alice, balance=$92k] | 270 B |
| 5 | 0.056s | 10.0.1.25 | 192.168.1.10 | HTTP | HTTP/1.1 200 OK [Alice's Confidential Data returned to Bob] | 356 B |
GET /api/v2/customers/1092/private_records HTTP/1.1 Host: api.gateway.corp Authorization: Bearer <Bob_Valid_JWT>
What is Broken Object Level Authorization (BOLA)?
Root Cause Analysis
// BAD: Untrusted execution or unhardened configuration
const config = { debug: true, allowUnauthenticated: true };
app.use('/api', createService(config));
// GOOD: Strict hardening and defense-in-depth
const config = { debug: false, allowUnauthenticated: false, authRequired: true };
app.use('/api', authenticate, createService(config));Detection & Penetration Testing Methodology
IDOR (also called BOLA -- Broken Object Level Authorization in API contexts) happens when an application checks that a user is authenticated, but fails to check that the user is actually authorized to access the specific object they're requesting. The classic sign is an ID in a URL or request body -- /orders/1234, /profile?id=5678 -- where simply changing that ID lets you see or modify someone else's data, even though you're still logged in as yourself.
This is one of the most common and highest-impact API vulnerabilities, precisely because it's so simple to test: you don't need to break any crypto or injection filter -- you just need two accounts and the willingness to swap an ID.
This lab teaches 5 steps:
Authenticate as two test accounts with similar privilege levels
Identify requests that reference an object by ID
Swap the ID while keeping your own session, and observe the result
Repeat across read/update/delete operations and all ID formats
Document each endpoint where cross-account access succeeds
Step 1 -- Authenticate as Two Test Accounts (A and B)
Goal: You need two separate, same-privilege-level accounts so you can create an object as one and try to access it as the other.
1.1 Create or use two test accounts
Account A: testuser.a@yourtestdomain.com
Account B: testuser.b@yourtestdomain.com
Both should have the same role/privilege level (e.g., both regular users, not one admin and one regular user -- that's a separate test, privilege escalation, though it uses a similar method).
1.2 Capture both sessions/tokens
Log in as each and capture the session cookie or auth token from the request:
curl -s -i -X POST https://target.com/login \
-d "email=testuser.a@yourtestdomain.com&password=TestPass123" \
-c account_a_cookies.txt
curl -s -i -X POST https://target.com/login \
-d "email=testuser.b@yourtestdomain.com&password=TestPass123" \
-c account_b_cookies.txt
For token-based APIs (JWT, API keys), capture each token from the login response body instead:
curl -s -X POST https://target.com/api/login \
-H "Content-Type: application/json" \
-d '{"email":"testuser.a@yourtestdomain.com","password":"TestPass123"}'
json
{"token": "eyJhbGciOi..."}
Save each account's token separately -- you'll keep swapping which one you use while keeping the other account's object IDs as your target.
1.3 Create distinct objects under each account
Using the app normally, create at least one of each object type you plan to test under both accounts -- an order, a document, a message, a profile update -- so that each account has its own private data to try to access from the other side.
# As Account A, create an order (example)
curl -s -X POST https://target.com/api/orders \
-H "Cookie: session=ACCOUNT_A_SESSION" \
-H "Content-Type: application/json" \
-d '{"item": "Test Item A", "quantity": 1}'
# As Account B, create a different order
curl -s -X POST https://target.com/api/orders \
-H "Cookie: session=ACCOUNT_B_SESSION" \
-H "Content-Type: application/json" \
-d '{"item": "Test Item B", "quantity": 1}'
Note down the resulting object IDs returned in each response -- e.g. Account A's order is 1001, Account B's order is 1002.
Step 2 -- Identify Requests That Reference an Object by ID
Goal: Map every endpoint where an object is accessed, updated, or deleted using an identifier -- these are your test candidates.
Common places object IDs show up:
/api/orders/1001
/api/users/42/profile
/api/invoices?id=5567
/api/messages/8891
/api/documents/a1b2c3d4-e5f6-... (UUID)
/api/account/export?userId=42
How to find them:
Use the app normally as Account A (browse your orders, open your profile, view a message), with Burp Suite's proxy history open -- every request that includes an ID referencing something you created is a candidate.
zap-cli quick-scan --spider -r https://target.com
(helps map the overall app, but manual browsing while logged in is more reliable for finding ID-based endpoints tied to your own data)
What to write down for each candidate:
The endpoint and HTTP method (GET/PUT/PATCH/DELETE)
Where the ID appears (URL path, query parameter, JSON body field)
The ID format (sequential number, UUID, base64-encoded, hashed)
What data/action it exposes
Step 3 -- Swap the ID, Keep Your Own Session
Goal: This is the core test. Take a request captured while logged in as Account A, but change the object ID to one that belongs to Account B -- while leaving Account A's session/token untouched. If the server returns B's data (or lets you modify/delete it), authorization is broken.
3.1 Baseline -- confirm normal access works
curl -s -i "https://target.com/api/orders/1001" \
-H "Cookie: session=ACCOUNT_A_SESSION"
This should return Account A's own order (ID 1001) successfully -- confirms the endpoint and session are both working normally.
3.2 The actual test -- swap only the ID
curl -s -i "https://target.com/api/orders/1002" \
-H "Cookie: session=ACCOUNT_A_SESSION"
Note: this request still uses Account A's session, but requests Account B's order ID (1002).
3.3 Reading the result
| Response | Meaning |
|---|---|
| Account B's actual order data is returned (HTTP 200) | Confirmed IDOR -- authorization check is missing or broken |
| 403 Forbidden or 401 Unauthorized | Properly protected -- the server checked ownership and rejected it |
| 404 Not Found | Could mean properly protected (the app deliberately hides existence of others' objects), or could mean the ID itself is wrong -- double check the ID is correct by confirming it works under Account B's own session first |
| Generic error / empty response | Ambiguous -- compare against the 404 case above to determine which it is |
3.4 Always confirm the "control" case first
Before concluding anything from Step 3.3, confirm the swapped ID is actually valid by requesting it under Account B's own session:
curl -s -i "https://target.com/api/orders/1002" \
-H "Cookie: session=ACCOUNT_B_SESSION"
If this succeeds and returns real data, but the same ID under Account A's session in Step 3.2 also succeeded -- that's your confirmed IDOR. If Account A's request got a 403/404 while Account B's own request succeeded, the app is correctly checking ownership.
3.5 Testing query-parameter and body-based IDs
Not every ID is in the URL path -- some are query parameters or JSON body fields. Same swap logic applies:
curl -s -i "https://target.com/api/invoice?invoiceId=5567" \
-H "Cookie: session=ACCOUNT_A_SESSION"
curl -s -i -X PUT "https://target.com/api/profile/update" \
-H "Cookie: session=ACCOUNT_A_SESSION" \
-H "Content-Type: application/json" \
-d '{"userId": 43, "bio": "testing IDOR"}'
(here userId: 43 is Account B's ID, but the request is authenticated as Account A -- test whether the server uses the userId from the body/token correctly, or blindly trusts the body value)
Step 4 -- Repeat Across Read, Update, Delete, and All ID Formats
Goal: A single successful read-based IDOR doesn't mean you've covered the whole surface. Systematically repeat the test across every CRUD operation and every object type/ID format you found in Step 1.
4.1 Test matrix -- operations
For each object type, test all of these (using Account A's session, Account B's object ID):
Example -- testing the update operation:
curl -s -i -X PUT "https://target.com/api/orders/1002" \
-H "Cookie: session=ACCOUNT_A_SESSION" \
-H "Content-Type: application/json" \
-d '{"item": "Modified by Account A", "quantity": 99}'
Then verify under Account B's own session whether the order was actually changed:
curl -s "https://target.com/api/orders/1002" \
-H "Cookie: session=ACCOUNT_B_SESSION"
Example -- testing the delete operation (be careful, this is destructive to your own test data):
curl -s -i -X DELETE "https://target.com/api/orders/1002" \
-H "Cookie: session=ACCOUNT_A_SESSION"
Then confirm under Account B's session whether the object is now gone.
4.2 Test matrix -- ID formats
Repeat the same logic for each distinct ID format the app uses, since protections are sometimes applied inconsistently across endpoints:
Sequential numeric: /api/orders/1002
UUID: /api/documents/f47ac10b-58cc-4372-a567-0e02b2c3d479
Encoded/hashed ID: /api/messages/YWNjb3VudF9iX21zZ18x
Nested/composite ID: /api/accounts/42/orders/1002
For encoded/hashed IDs: first figure out if it's just encoded (not hashed) -- try decoding it:
echo "YWNjb3VudF9iX21zZ18x" | base64 -d
If it decodes to something predictable (like account_b_msg_1), you may be able to construct Account B's other object IDs yourself, without ever directly observing them -- this is a more severe finding since it doesn't even require the IDs to be "leaked" anywhere first.
4.3 Test matrix -- nested and related objects
Some objects reference other objects -- comments on a post, line items within an order, attachments on a message. Test whether swapping the nested ID while keeping the parent ID consistent with Account A also breaks access control:
curl -s -i "https://target.com/api/orders/1001/items/9988" \
-H "Cookie: session=ACCOUNT_A_SESSION"
(Account A's own order 1001, but 9988 is actually a line-item ID belonging to Account B's order)
4.4 Test matrix -- bulk/list endpoints
Check whether list or search endpoints leak other accounts' data through filters or pagination, even if individual object-by-ID requests are properly protected:
curl -s "https://target.com/api/orders?userId=43" \
-H "Cookie: session=ACCOUNT_A_SESSION"
curl -s "https://target.com/api/orders?page=1&limit=100" \
-H "Cookie: session=ACCOUNT_A_SESSION"
(check whether the unfiltered list endpoint returns ALL orders across all accounts instead of only Account A's own)
Step 5 -- Document Each Confirmed Endpoint
Goal: For every endpoint where cross-account access succeeded, capture clear before/after evidence that leaves no doubt.
5.1 Save the full request/response pair
curl -v -i "https://target.com/api/orders/1002" \
-H "Cookie: session=ACCOUNT_A_SESSION" > evidence_idor_orders_read.log 2>&1
5.2 Capture the "control" comparison
Always save the matching proof that the ID was genuinely valid and belonged to Account B -- i.e., the same request succeeding under Account B's own session -- so the finding can't be dismissed as "that ID doesn't exist."
5.3 For write/delete findings, capture both before and after states
# Before: Account B's original data (proves what existed)
curl -s "https://target.com/api/orders/1002" -H "Cookie: session=ACCOUNT_B_SESSION" > before_state.json
# The cross-account modification (as Account A)
curl -s -X PUT "https://target.com/api/orders/1002" \
-H "Cookie: session=ACCOUNT_A_SESSION" \
-H "Content-Type: application/json" \
-d '{"item": "Modified by Account A"}'
# After: confirm the change actually persisted, viewed again from Account B's session
curl -s "https://target.com/api/orders/1002" -H "Cookie: session=ACCOUNT_B_SESSION" > after_state.json
diff before_state.json after_state.json
5.4 Document any ID-prediction findings separately
If Step 4.2 revealed that IDs are predictable/sequential or decodable, note this as a contributing factor -- it increases severity because an attacker doesn't need to already know a victim's ID, they can just enumerate or construct it.
Evidence Table Template:
| No. | Endpoint | Method | ID Format | Account A Accessing Account B's Object | Result | Write/Delete Confirmed Persisted? | Conclusion |
|---|---|---|---|---|---|---|---|
| 1 | /api/orders/{id} | GET | Sequential numeric | Yes | Full order data returned | N/A | Confirmed (read) |
| 2 | /api/orders/{id} | PUT | Sequential numeric | Yes | Update accepted (200 OK) | Yes -- verified under Account B's session | Confirmed (write) |
| 3 | /api/orders/{id} | DELETE | Sequential numeric | Yes | Delete accepted (200 OK) | Yes -- object gone under Account B's session | Confirmed (delete) |
| 4 | /api/documents/{uuid} | GET | UUID | No | 403 Forbidden | N/A | Not vulnerable -- properly protected |
| 5 | /api/orders?userId={id} | GET | Numeric (query param) | Yes | Returned Account B's full order list | N/A | Confirmed (list/filter bypass) |
| 6 | /api/messages/{encodedId} | GET | Base64-encoded, decodable | Yes | Decoded and constructed Account B's message ID directly, data returned | N/A | Confirmed (read + predictable ID) |
Proof of Concept
[Insert the exact request and payload that demonstrate the vulnerability, and the resulting response.]
Evidence
[Insert screenshot or HTTP request/response excerpt -- Figure F-12-1.]
Remediation
Enforce server-side authorization checks that verify the authenticated user owns or is entitled to the requested object, on every request.
Avoid relying on identifier unpredictability (e.g. UUIDs) as the sole access control.
Centralize authorization logic (e.g. a policy/middleware layer) rather than duplicating checks per endpoint.
Add automated authorization tests (horizontal access control) to the regression suite.
Re-test all affected endpoints after remediation.
Retest Notes
[ ] Not yet retested [ ] Retested -- Resolved [ ] Retested -- Not resolved. [Retest date and tester name.]
References
CWE-639 OWASP Top 10:2021 OWASP WSTG
Broken Object Level Authorization (BOLA) Hands-on Lab
Launch your local laboratory environment to verify this vulnerability.