Access control and APIs
Unit 3 of 5 in Testing web applications.
You will be able to explain broken object-level and function-level authorization, plan an authorization test as a matrix, and confirm one cross-account read with accounts and objects you own.
Lesson
Why access control is tested first
In the OWASP Top 10:2025, Broken Access Control keeps the number one position. The page reports that 100% of the applications tested had some form of it, and that the category has the highest number of occurrences in the contributed data. It is also the category scanners are least able to find, as the last unit showed, so it is where manual, careful testing earns its keep.
The Top 10's prevention advice is plain: access control only works in trusted server-side code, deny by default except for public resources, implement it once and reuse it, enforce record ownership, and log access control failures.
Object level and function level
OWASP's API Security Top 10 separates two failures that are easy to mix up. Broken object level authorization (BOLA, API1) is about objects: every endpoint that receives an object id and acts on that object should check that the logged-in user is allowed to perform that action on that object. The page stresses that comparing the user id in the session with the id in the request is not a sufficient fix, because it covers only a small subset of cases.
Broken function level authorization (BFLA, API5) is about functions: can a regular user reach an administrative endpoint, or perform a sensitive action just by changing the HTTP method from GET to DELETE, or reach a function meant for another group by guessing the path? The API1 page draws the line itself: reaching an endpoint you should not have access to at all is BFLA, not BOLA. In BOLA the user is meant to have the endpoint, and the violation happens at the object.
Testing it safely: two accounts, objects you own
WSTG-ATHZ-04 describes insecure direct object references: the application takes user-supplied input and uses it to fetch an object without enough authorization checks. To test, map every place where user input refers to an object, then change the value and see whether you can reach objects that belong to someone else.
The guide's advice on how is the safe part: use at least two users who own different objects, so you can try one user's identifiers from the other user's session. Applied to a practice app, that means two accounts you created, objects you created in each, and one request each. You never need to guess at, or touch, anyone else's data, and the test stays inside the scope you wrote. Confirming means comparing what you got with what you expected from each account, including a control that shows the request would normally work. The lab walks through the control comparisons that rule out false positives.
Plan authorization as a matrix
The OWASP Authorization Testing Automation cheat sheet describes an authorization as two dimensions: the feature and the logical role that accesses it, sometimes with a third dimension for business data. Written as a table it is an authorization matrix, and when you test it each logical role is called a point of view.
The cheat sheet suggests keeping the matrix in a file that both a person and a program can read, and building tests that read from it, so that when the matrix changes the tests change with it and a failing test points at the exact role and feature that broke the rule. The crAPI labs build this from an API description: an inventory, then a matrix and a numbered plan ordered so reads come first and deletes last, on objects you own.
The fix, and the test that keeps it fixed
API1's prevention advice is to use an authorization mechanism based on user policies and hierarchy, to check it in every function that takes an id from the client, to prefer random, unpredictable record ids, and to write tests for the authorization mechanism and not deploy changes that make them fail. Random ids make guessing harder but are not a substitute for the check, because an id that leaks is still an id.
API5 adds that the enforcement mechanism should deny all access by default and that administrative controllers should share one place that checks roles. The last lab of this unit has a tiny API with a vulnerable and a fixed mode: the same matrix runs against both, and an audit log shows what a defender would see.
Key points
- Broken access control is the top Top 10 category and the one scanners cannot find; test it by hand.
- BOLA is the wrong object; BFLA is the wrong function. Fixes differ: check every object access, and deny functions by default.
- Use two accounts you own and objects you created; a control request shows the test itself is valid.
- Write the authorization matrix as a file and test from it, so the fix stays fixed.
Sources
- OWASP Top 10:2025, A01 Broken Access Control
- OWASP API Security Top 10 2023, API1 Broken Object Level Authorization
- OWASP API Security Top 10 2023, API5 Broken Function Level Authorization
- OWASP WSTG v4.2: Testing for Insecure Direct Object References (WSTG-ATHZ-04)
- OWASP Cheat Sheet Series: Authorization Testing Automation
Lecture
Authorization models: RBAC, ABAC and OAuth: Roles, attributes and tokens: the models that the access-control checks in this unit are enforcing.
Practice in the labs
Confirm one object-level flaw carefully, then work through the crAPI series: inventory, plan, and a fix with a retest.
- Test for broken access control (IDOR) — on your own app: A short, repeatable test for broken access control on your own app, and the server-side fix.
- Confirm broken object access in Juice Shop and rule out the false positives: It reads the route code first, uses two accounts and four captures, and rules out ignored ids, refused requests and public data before rating the finding.
- Inventory crAPI from its OpenAPI document: which operations are public, take an id, or exist in several versions: You build an inventory from the API's own description and catch operations with no declared security, path-level parameters and old versions of one function.
- Plan crAPI authorization tests from the inventory: a matrix, an order of work, and a ledger: You turn the inventory into a matrix and 66 numbered cases in a safe order, with a ledger that checks your discipline.
- Model, fix and retest object-level authorization in a tiny API, with the audit log a defender needs: You run the same matrix against a vulnerable and a fixed API and read the audit log a defender needs.
Knowledge check
- A regular user can call an administrator-only endpoint by guessing its path. Which API Top 10 category is that? Answer: Broken function level authorization (API5). The wrong function was reachable. The API1 page says that reaching an endpoint you should not have access to at all is BFLA, not BOLA.
- Why is comparing the session user id with the id in the request not a sufficient fix for BOLA? Answer: OWASP says it addresses only a small subset of cases; the check belongs in every function that takes an object id. API1 states this directly and recommends an authorization mechanism checked in every function that uses a client-supplied id.
- What does WSTG-ATHZ-04 recommend to test for insecure direct object references efficiently? Answer: Use at least two users who own different objects and try one's identifiers from the other's session. Two test users who own different objects let you test cross-account access without touching anyone else's data.
- In an authorization matrix, what are the two main dimensions? Answer: The feature and the logical role (point of view). The cheat sheet describes authorization as the feature and the logical role that accesses it, with business data sometimes added as a third dimension.
Back to the syllabus or see all classes.
Related
- Testing web applications
- Test for broken access control (IDOR) — on your own app
- Confirm broken object access in Juice Shop and rule out the false positives
- Inventory crAPI from its OpenAPI document: which operations are public, take an id, or exist in several versions
- Plan crAPI authorization tests from the inventory: a matrix, an order of work, and a ledger
- Model, fix and retest object-level authorization in a tiny API, with the audit log a defender needs
- All classes
- Free cyber labs