Broken Access Control and IDOR: The #1 Web Security Risk
Broken access control sits at the top of the OWASP Top 10 because it is everywhere and scanners rarely find it. Here is what IDOR, privilege escalation, and mass assignment look like, and how to design them out.

Authentication answers “who are you?” Authorization answers “what are you allowed to do?” The second question is where web applications fail most often. Broken access control is the number one category in the OWASP Top 10, and it is the bug class behind some of the largest API breaches on record.
It is also the class automated scanners are worst at, because a scanner has no idea that invoice 1841 belongs to someone else. That makes it both a defender’s nightmare and a bug hunter’s favorite.
Three ways access control breaks
Vertical escalation. A regular user reaches a higher privilege level. Example: an ordinary account calls POST /api/admin/users and the server never checks for the admin role, because the button was only hidden in the UI.
Horizontal escalation. A user reaches another user’s resources at the same privilege level. Example: changing /api/invoices/1842 to /api/invoices/1841 returns someone else’s invoice.
State-based bypasses. A rule that depends on workflow state is skipped. Example: jumping straight to the “confirm order” step without paying, or editing a document after it was locked.
IDOR and BOLA: the most common form
When a user-supplied identifier is used to fetch an object without checking ownership, you have an Insecure Direct Object Reference (IDOR). In API terms it is called Broken Object Level Authorization (BOLA), and it leads the OWASP API Security Top 10.
# VULNERABLE: any logged-in user can read any invoice
@app.get("/api/invoices/<int:invoice_id>")
def get_invoice(invoice_id):
return db.invoices.find_one(id=invoice_id)
# FIXED: the query is scoped to the authenticated user
@app.get("/api/invoices/<int:invoice_id>")
def get_invoice(invoice_id):
invoice = db.invoices.find_one(id=invoice_id, owner_id=current_user.id)
if invoice is None:
abort(404)
return invoice
A common myth is that switching to UUIDs fixes IDOR. It does not. Unpredictable IDs make guessing harder, but IDs leak through URLs, logs, shared links, and other API responses. The missing ownership check is the bug; the ID format just changes how hard it is to exploit.
The 2022 Optus breach is a sobering example. Public reporting described an internet-facing API that required no authentication and returned customer records by an incrementing identifier. Sequential IDs made enumeration trivial, but the root cause was the missing access control.

Other patterns to watch for
- Function-level authorization gaps: admin or internal endpoints with no role check.
- Mass assignment: an update endpoint binds every field in the request body to the model, so a user sends
"role": "admin"along with their new display name. The fix is a strict input schema that lists exactly which fields can be changed. - Tenant isolation failures: in multi-tenant SaaS, a query that forgets the
tenant_idfilter exposes one customer’s data to another. - Path-based bypasses: a reverse proxy blocks
/adminbut the app also accepts/Admin,/admin/, or/api/../admin. Enforcing access control only at the proxy is risky for exactly this reason.
Designing access control that holds up
- Deny by default. Every endpoint should require an explicit permission. New routes start locked.
- Centralize policy. Put authorization logic in one place, such as middleware, a policy engine, or a shared library, rather than scattered
ifstatements. - Scope every query. Fetch through the current user or tenant (
current_user.invoices.get(id)) so the database cannot return what the user does not own. - Use database guardrails. Row-level security can enforce tenant isolation even if application code forgets.
- Write an authorization matrix. List every role against every action and test every cell, especially the “should be denied” ones.
How testers find it
Access control testing is mostly methodical, not clever. Create at least two accounts per role. Perform every action as user A, then replay the same requests with user B’s session and with no session at all. Burp Suite extensions such as Autorize automate the replay and highlight responses that should have been blocked.
Only do this on applications you own or are authorized to test, using accounts you control.
The AI agent version: confused deputies
AI agents create a new kind of access control bug. If a support agent’s tools run with a broad service account, and the model chooses which account_id to look up, then anyone who can talk the model into a different ID can read another customer’s data. The agent becomes a confused deputy: it has the authority, and the attacker supplies the intent.
The fix is the same principle as above: tools must derive the user from the authenticated session held by the server, never from parameters the model produces, and must enforce the same authorization as the rest of the app.
Key takeaways
- Broken access control is the top OWASP risk and is hard for scanners to detect.
- IDOR/BOLA happens when object IDs are trusted without ownership checks. UUIDs do not fix it.
- Watch for function-level gaps, mass assignment, tenant leaks, and path bypasses.
- Deny by default, centralize policy, scope queries, and test an authorization matrix.
- AI agents must carry the user’s permissions into every tool call.
Go deeper with the book
This article is adapted from Web Security in the Age of AI: Attacks, Defenses, Tools, and Bug Hunting for Modern Web Applications and LLM Systems by Rupak (see Chapter 10, “Authorization and Broken Access Control”).
The book pairs every attack with its fix across 27 chapters, from core vulnerabilities and professional tools to bug bounty hunting, attacking and defending LLM applications, and lessons from real breaches. It includes hands-on labs, review questions, a full testing checklist, a security headers reference, and an LLM red teaming playbook.
Related reading
- API Security: JWT, OAuth, and GraphQL Mistakes to Avoid
- Bug Bounty Methodology: How to Find Bugs That Get Paid







