Authorization failures are the leading cause of API security incidents. Two vulnerability classes dominate that category: BOLA (Broken Object Level Authorization) and BFLA (Broken Function Level Authorization). They are related, they are often confused, and most security scanners miss both of them. This guide explains the difference, shows real-world examples of each, and covers how to detect them reliably.
This article was created with AI assistance and reviewed by the DastPilot team.
What is BOLA (Broken Object Level Authorization)?
BOLA — listed as API1 in the OWASP API Security Top 10 — occurs when an API endpoint exposes object identifiers (IDs) in requests but does not verify that the requesting user is authorized to access that specific object.
In plain terms: the API checks that you are logged in, but not that the resource you are requesting actually belongs to you.
BOLA example
Consider an e-commerce API with an order detail endpoint:
GET /api/orders/8821
Authorization: Bearer <customer-A-token>
Customer A is authenticated and the API returns their order. Now Customer A changes the ID:
GET /api/orders/8822
Authorization: Bearer <customer-A-token>
If the API returns Customer B's order without checking ownership, that is BOLA. The authentication check passed — Customer A has a valid token — but the authorization check failed because the API did not verify that order 8822 belongs to Customer A.
BOLA is extremely common because it is easy to implement authentication and forget to implement per-object ownership checks. It is also easy to miss in code review because the endpoint looks correct — it requires a valid token — until you test it with a foreign resource ID.
What is BFLA (Broken Function Level Authorization)?
BFLA — listed as API5 in the OWASP API Security Top 10 — occurs when an API endpoint performs a privileged action but does not verify that the requesting user has the role or permission required to invoke that action.
Where BOLA is about accessing the wrong object, BFLA is about invoking the wrong function. The distinction is between data access and capability access.
BFLA example
A SaaS platform has an admin endpoint for deleting user accounts:
DELETE /api/admin/users/4491
Authorization: Bearer <regular-user-token>
If the API processes this request because it only checks that the token is valid — not that the token belongs to an admin — that is BFLA. A regular user has invoked an admin-only function.
BFLA often appears in APIs that were built quickly, where admin endpoints were added without consistent role-checking middleware, or where role checks were applied to the UI but not enforced at the API layer.
BOLA vs BFLA: side-by-side
| Dimension | BOLA (API1) | BFLA (API5) |
|---|---|---|
| What is broken | Object ownership check | Function permission check |
| The question the API fails to ask | "Does this user own this resource?" | "Does this user have permission to call this function?" |
| Typical attack vector | Changing an object ID in the request path or body | Calling an admin or privileged endpoint with a low-privilege token |
| Common root cause | Missing per-object ownership validation | Missing role-based access control on sensitive operations |
| OWASP API Top 10 position | API1 — most critical | API5 — highly critical |
| Detectable by single-user scanner | ✗ No | ✗ No |
| Requires role-aware testing | ✓ Yes | ✓ Yes |
Why most security scanners miss BOLA and BFLA
The reason both vulnerabilities are so prevalent is the same reason they are so hard to detect automatically: they require context that most scanners do not have.
A standard scanner authenticates as one user and fires requests. It can check whether an endpoint requires authentication at all — but it cannot check whether the authenticated user is accessing someone else's data, because it only has one user's perspective. To detect BOLA, you need at least two users: one who owns a resource, and one who should not be able to access it.
Similarly, detecting BFLA requires knowing which roles should and should not have access to which operations. A scanner that operates as a single admin user will never discover that a regular user can call admin endpoints, because it never tries.
This is why role-aware testing is not a nice-to-have for API security — it is the only way to reliably detect the top two vulnerability classes in the OWASP API Security Top 10.
How to test for BOLA and BFLA
Manual testing approach
The manual approach requires two or more test accounts with different roles and resource ownership:
- Create User A (e.g., a regular customer) and User B (another regular customer).
- Have User A create a resource — an order, a document, a profile — and note its ID.
- Authenticate as User B and attempt to access User A's resource using that ID.
- If the API returns the resource, BOLA is confirmed.
- For BFLA: create a regular user and an admin user. Authenticate as the regular user and attempt to call admin-only endpoints. If they succeed, BFLA is confirmed.
Manual testing works but does not scale. With dozens of endpoints and multiple role combinations, the test matrix grows quickly and becomes impractical to run regularly.
Automated testing with DastPilot
DastPilot automates the role-aware test matrix. You provide your OpenAPI spec, define your user roles and their credentials, and map which roles are authorized for which operations. DastPilot then:
- Generates resource IDs by making legitimate requests as authorized users.
- Attempts to access those resources using tokens from unauthorized roles.
- Flags any case where an unauthorized role receives a successful response.
- Tests every operation in your spec against every role combination — not just the ones you remember to check manually.
This approach catches BOLA and BFLA across your entire API surface with each scan run, without requiring a security engineer to manually construct test cases for each endpoint.
How to fix BOLA and BFLA
Fixing BOLA
- Never trust client-supplied object IDs without verifying ownership. Always check that the authenticated user owns or has explicit access to the requested resource.
- Use indirect references where possible — map user-specific tokens or UUIDs to internal IDs server-side rather than exposing sequential or predictable IDs.
- Apply ownership checks at the data layer, not just the route layer. Middleware that checks authentication does not check ownership.
- Write tests that explicitly verify cross-user access is denied, not just that authenticated access is allowed.
Fixing BFLA
- Apply role-based access control (RBAC) consistently at the API layer — not just in the UI or frontend routing.
- Use a centralized authorization middleware or policy engine rather than ad-hoc role checks scattered across handlers.
- Audit every endpoint for its required role and verify that the check is enforced in code, not assumed.
- Include negative tests in your test suite: verify that low-privilege roles receive 403 responses on privileged endpoints, not just that admin roles receive 200.
Final takeaway
BOLA and BFLA are different vulnerabilities with different root causes, but they share a common detection requirement: you need to test from multiple role perspectives. A scanner that operates as a single user will miss both, every time.
If your API serves multiple user types — customers, admins, partners, read-only users — role-aware security testing is not optional. It is the only way to know whether your authorization logic actually works under adversarial conditions.
Test for BOLA and BFLA automatically
DastPilot's role-aware DAST engine tests authorization boundaries across every role combination in your OpenAPI spec. No manual test cases required.
Start Free Trial