Broken Access Control Explained: How IDOR Bugs Are Found and Fixed
Broken access control means an application lets a user do something their role or ownership should not allow, such as reading another customer's order, calling an admin API as a normal user, or changing a price field. It was ranked first in the OWASP Top 10 2021. IDOR (insecure direct object reference) is the best-known form: the app trusts an ID in the request instead of checking ownership.
Topic: Web & API Security in Cybersecurity & Ethical Hacking · Explainer
Also covers: Security Tools, Authorized Labs & CTFs
Quick answer: Broken access control means an application lets a user do something their role or ownership should not allow, such as reading another customer's order, calling an admin API as a normal user, or changing a price field. It was ranked first in the OWASP Top 10 2021. IDOR (insecure direct object reference) is the best-known form: the app trusts an ID in the request instead of checking ownership. Testers find these bugs by repeating requests as different users and roles; developers prevent them by checking authorization on the server for every request, denying by default, and testing those checks automatically.
Key takeaways
- Hiding a button is not access control; the server must check every request.
- Horizontal flaws cross users at the same level; vertical flaws cross roles.
- In APIs, OWASP calls these BOLA (object level) and BFLA (function level).
- Two test accounts and a proxy find most access control bugs.
- Centralised, deny-by-default authorization with automated tests prevents regressions.
Table of Contents
- What Is Broken Access Control?
- What Forms Does It Take?
- How Does IDOR Fit In?
- How Do Authorised Testers Find It?
- How Is a Finding Reported Responsibly?
- How Do Developers Prevent It?
- How Do You Test Authorization Automatically?
- What About Legality in India?
- References
What Is Broken Access Control?
Access control enforces policy so users cannot act outside their intended permissions. OWASP's A01 category maps to weaknesses such as CWE-284 (improper access control), CWE-862 (missing authorization), CWE-863 (incorrect authorization) and CWE-639 (authorization bypass through a user-controlled key). Authentication bugs let the wrong person log in; access control bugs let the right person do the wrong thing.
What Forms Does It Take?
| Type | Example |
|---|---|
| Horizontal (IDOR/BOLA) | GET /api/orders/1043 returns another user's order |
| Vertical privilege escalation | Normal user calls POST /api/admin/users |
| Function level (BFLA) | Changing GET to DELETE on a resource works for anyone |
| Parameter tampering | Setting "role":"admin" or "price":1 in a request body |
| Forced browsing | Visiting /admin/ directly without a link |
| Token or cookie manipulation | Editing an unsigned isAdmin=true cookie or a JWT with alg: none |
| CORS misconfiguration | Any origin allowed with credentials, so other sites read API data |
For APIs, see OWASP API Security Top 10 2023, where BOLA is API1 and BFLA is API5.
How Does IDOR Fit In?
IDOR is horizontal broken access control caused by trusting an identifier. Sequential numbers make it easy to spot, but random IDs such as UUIDs do not fix it, because IDs leak in URLs, emails and other API responses. The only fix is an ownership check. Our IDOR guide covers the basics and this article shows how to write an IDOR report.
How Do Authorised Testers Find It?
- Create at least two users per role (user A, user B, admin) in the test environment.
- Browse every feature as admin and user A through a proxy such as Burp Suite, building a map of endpoints.
- Replay each request with user B's session, then with no session. Compare responses.
- Change IDs, HTTP methods and body fields such as
role,account_idorprice. - Check that responses do not include data the UI hides.
Burp extensions such as Autorize automate step 3 by replaying every request with a lower-privileged cookie. PortSwigger's access control labs are a legal place to practise.
How Is a Finding Reported Responsibly?
- Use only your own test accounts; do not download or keep real users' data.
- Stop once you have proved the issue with the minimum access needed.
- Report the endpoint, both users' roles, the exact request and response, and the impact.
- Follow the programme's disclosure guidelines; do not publish before the fix and approval.
How Do Developers Prevent It?
The OWASP Authorization Cheat Sheet recommends deny by default, least privilege and checks on every request. In practice, scope database queries to the current user and centralise policy:
# Flask-style example: deny by default, check ownership in the query
@app.get("/api/orders/<int:order_id>")
@login_required
def get_order(order_id):
order = Order.query.filter_by(id=order_id, owner_id=current_user.id).first()
if order is None:
abort(404) # same response whether missing or not yours
return jsonify(order.to_dict())
@app.post("/api/admin/users")
@login_required
@require_role("admin") # function-level check
def create_user():
data = request.get_json()
data.pop("role", None) # never accept privilege fields from the client
...
- Keep roles and permissions on the server, never in editable client state.
- Use the framework's policy layer (for example Spring Security, Django permissions, ASP.NET Core policies) rather than ad-hoc checks.
- Log authorization failures and alert on spikes.
How Do You Test Authorization Automatically?
# pytest: user B must not read user A's order
def test_order_is_private(client, user_a, user_b):
order = make_order(owner=user_a)
login(client, user_b)
r = client.get(f"/api/orders/{order.id}")
assert r.status_code == 404
def test_admin_endpoint_requires_admin(client, user_a):
login(client, user_a)
r = client.post("/api/admin/users", json={"email": "[email protected]"})
assert r.status_code in (403, 404)
Write one such test per sensitive endpoint, and run them in CI so a refactor cannot silently remove a check.
What About Legality in India?
Accessing data you are not authorised to see can breach Sections 43 and 66 of the Information Technology Act 2000, even if the application allowed it technically. Test only systems you own, labs, or programmes whose scope and safe-harbour terms cover you. WebAsha's ethical hacking courses include supervised access control testing.
References
Frequently Asked Questions
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Wow
0
Sad
0
Angry
0