BOLA (broken object level authorization) and IDOR (insecure direct object reference) describe overlapping access-control failures. IDOR focuses on a direct reference to a record without a proper permission check; BOLA focuses on whether a caller may perform an action on a particular API object. The same API flaw can be described using either term (often written together as BOLA/IDOR).
BOLA vs IDOR: what is the difference?
- BOLA: an API fails to check whether the authenticated caller may perform the requested action on the specific object. Object IDs may appear in a path, query, header or request body.
- IDOR: a user-controlled reference, such as an invoice ID, filename or account number, gives access to an object without the required authorization. IDOR can occur in web applications as well as APIs.
- Overlap: if an API accepts another customer's invoice ID and returns it without checking permissions, the same behavior can be called BOLA and IDOR. Document the caller, object, action and expected policy rather than relying on the label alone.
Example: an invoice API
Imagine user A is allowed to read invoice 500 but not invoice 501, which belongs to another customer. The application sends GET /api/v1/invoices/500. If the server fetches an invoice by ID alone and then returns it, user A may be able to request /api/v1/invoices/501 and receive a record they are not permitted to read. Authentication alone does not establish permission for that invoice.
The expected outcome depends on the application's actual policy: an accountant, support user or shared-access recipient may be allowed to read someone else's invoice. A proper fix checks the authenticated identity, requested action and specific object against that policy on the server. An organization-scoped query can help where the policy is tenant-based, but it may still need role and sharing checks.
How to test BOLA and IDOR with two accounts
- Get written authorization and use a safe test environment or approved scope. Create two test accounts with known roles and separate test records; establish the expected access rules and any legitimate sharing first.
- As account A, request A's own record and record the response as the allowed baseline. Identify the object reference in the request.
- Using A's session, request B's test record by changing that reference. Compare the response and returned content with the expected policy; avoid accessing or changing real customer data.
- Repeat for relevant roles and permitted read or write actions within the agreed scope. Preserve request and response evidence safely, including any failed or incomplete checks.
- After the fix, repeat both the allowed and denied cases. Confirm legitimate shared access still works and that denied responses do not disclose the protected record.
A 200 response alone does not prove unauthorized access, and a 403 or 404 alone does not prove every route is protected. Compare the returned data with the intended permissions and retest each relevant action.
How to prevent object-level authorization failures
- Enforce object- and action-level authorization on the server for every endpoint that accesses a record, including downloads and background operations.
- Use trusted identity and tenant context, and apply the application's role, ownership and delegated-access policy. Comparing a session user ID with one request parameter covers only some cases.
- Scope data access to authorized records where appropriate, and add automated regression tests for allowed, denied and shared-access cases.
- Use unpredictable identifiers as defense in depth, not as the authorization check. UUIDs can still be exposed through links, logs or responses.
- MyPentest supports read-access comparisons on reachable resources using suitable supplied test accounts. Coverage depends on the routes and accounts available and does not establish that every authorization path is secure.