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.

Jul 26, 2025 - 16:53
Updated: 
105.8k

Web & API Security in Cybersecurity & Ethical Hacking · Explainer

Security Tools, Authorized Labs & CTFs

Broken Access Control Explained: How IDOR Bugs Are Found and Fixed

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?

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?

TypeExample
Horizontal (IDOR/BOLA)GET /api/orders/1043 returns another user's order
Vertical privilege escalationNormal user calls POST /api/admin/users
Function level (BFLA)Changing GET to DELETE on a resource works for anyone
Parameter tamperingSetting "role":"admin" or "price":1 in a request body
Forced browsingVisiting /admin/ directly without a link
Token or cookie manipulationEditing an unsigned isAdmin=true cookie or a JWT with alg: none
CORS misconfigurationAny 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?

  1. Create at least two users per role (user A, user B, admin) in the test environment.
  2. Browse every feature as admin and user A through a proxy such as Burp Suite, building a map of endpoints.
  3. Replay each request with user B's session, then with no session. Compare responses.
  4. Change IDs, HTTP methods and body fields such as role, account_id or price.
  5. 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

A flaw that lets users act outside their permissions, such as viewing other users’ data or using admin functions.

IDOR is one type of broken access control, where the app trusts a user-supplied identifier without checking ownership.

It was ranked first, as A01, in the OWASP Top 10 2021.

No. They make IDs harder to guess, but IDs leak elsewhere. Only a server-side ownership check prevents IDOR.

BOLA is unauthorized access to a specific object; BFLA is unauthorized use of a function or endpoint, such as an admin API.

They replay each request with a different user’s session, or none, and change IDs, methods and role fields.

Returning 404 for objects the user does not own avoids revealing that the object exists.

No. Test only your own systems, labs or bug bounty programmes whose scope covers you.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.