Nexus Void Research

Broken Access Control, OWASP Top 10, Authorization, Privilege Escalation, IDOR, JWT, CORS, How-to

How to Fix Broken Access Control: OWASP #1 Risk, Step by Step

How to fix broken access control: deny by default, function and object-level checks, no client-trusted roles, field allow-lists, multi-role tests.

To fix broken access control, enforce authorization on the server for every request: deny by default, check that the user may perform this action (function level) on this specific record (object level), keep the checks in one central layer, never trust roles or IDs sent by the client, and log and test access failures. Fix the most exposed routes first, such as admin actions, data exports and anything that changes money or permissions.

Broken access control is ranked first in the OWASP Top 10 web application risks. It covers every way a user can act outside their intended permissions: reading another customer's data, calling an admin endpoint, escalating their own role, or reaching pages that should require login. It is the category scanners struggle with most, because the vulnerable code is usually a check that is missing rather than code that is wrong. Attackers use these flaws in practice: improper authentication (CWE-287) and missing authentication for a critical function (CWE-306) were among the most common weaknesses in CISA's 2026 Known Exploited Vulnerabilities additions, according to our 2026 vulnerability statistics.

What are the types of broken access control?

Type

Example

Typical weakness

Insecure direct object reference (IDOR)

Change /orders/1042 to /orders/1043 and see another user's order

CWE-639

Missing function-level authorization

A normal user calls POST /admin/users/58/delete

CWE-862 Missing Authorization

Privilege escalation

A user sets "role": "admin" in their profile update

CWE-269

Forced browsing

/admin or /internal/reports loads without login

CWE-425

Metadata and token tampering

Editing a JWT, cookie or hidden field to change identity or role

CWE-639, CWE-565

CORS misconfiguration

API reflects any Origin with credentials allowed

CWE-942

Path traversal

?file=../../etc/passwd reads files outside the intended folder

CWE-22

Step 1: Find every route and what it should allow

You cannot fix what you have not listed. Build an inventory of every endpoint, page and background job that acts on behalf of a user, with three columns: who may call it, what it does, and what data it touches. Routes nobody can explain, old versions (/v1/) and debug endpoints are the usual places access control breaks.

Step 2: Deny by default

Make "no access" the outcome whenever a check is missing or fails. In practice:

  • Apply authentication middleware globally, then explicitly mark the few public routes, instead of adding it route by route.

  • Treat an unknown role, a missing tenant or a null owner as "deny".

  • Disable directory listing and remove debug, test and admin tooling from production builds.

// Express: authenticate everything, then allow-list public routes
const PUBLIC = new Set(["/health", "/login", "/signup"]);
app.use((req, res, next) => (PUBLIC.has(req.path) ? next() : requireLogin(req, res, next)));
// Express: authenticate everything, then allow-list public routes
const PUBLIC = new Set(["/health", "/login", "/signup"]);
app.use((req, res, next) => (PUBLIC.has(req.path) ? next() : requireLogin(req, res, next)));
// Express: authenticate everything, then allow-list public routes
const PUBLIC = new Set(["/health", "/login", "/signup"]);
app.use((req, res, next) => (PUBLIC.has(req.path) ? next() : requireLogin(req, res, next)));

Step 3: Check function-level permissions

Every action needs a permission check on the server, not just a hidden button in the UI. Hiding the "Delete user" button does nothing if the endpoint accepts the request.

# Django REST Framework: permission classes on every view
from rest_framework.permissions import IsAdminUser

class UserAdminViewSet(viewsets.ModelViewSet):
    permission_classes = [IsAdminUser]
# Django REST Framework: permission classes on every view
from rest_framework.permissions import IsAdminUser

class UserAdminViewSet(viewsets.ModelViewSet):
    permission_classes = [IsAdminUser]
# Django REST Framework: permission classes on every view
from rest_framework.permissions import IsAdminUser

class UserAdminViewSet(viewsets.ModelViewSet):
    permission_classes = [IsAdminUser]

Use a clear role or permission model (RBAC, or attribute-based rules when access depends on data such as department or plan) and keep the mapping from roles to actions in one place.

Step 4: Check object-level permissions

Function-level checks answer "may this user edit invoices?". Object-level checks answer "may this user edit this invoice?". Both are needed. Scope every lookup by owner or tenant:

UPDATE invoices SET status = $1 WHERE id = $2 AND org_id = $3;
UPDATE invoices SET status = $1 WHERE id = $2 AND org_id = $3;
UPDATE invoices SET status = $1 WHERE id = $2 AND org_id = $3;

This is the IDOR fix, covered step by step in how to prevent IDOR.

Step 5: Never trust identity or roles from the client

  • Roles and permissions must come from your server-side session or database, never from a request field, a cookie value or a hidden form input.

  • JWTs must be verified with a fixed, expected algorithm and key on every request. Reject alg: none, and do not read claims from a token you have not verified.

  • Mass assignment: allow-list the fields each endpoint accepts, so a user cannot add role, isAdmin, ownerId or price to an update.

// Only accept the fields a user is allowed to change
const { displayName, timezone } = req.body;
await db.user.update({ where: { id: req.user.id }, data: { displayName, timezone } });
// Only accept the fields a user is allowed to change
const { displayName, timezone } = req.body;
await db.user.update({ where: { id: req.user.id }, data: { displayName, timezone } });
// Only accept the fields a user is allowed to change
const { displayName, timezone } = req.body;
await db.user.update({ where: { id: req.user.id }, data: { displayName, timezone } });

Step 6: Centralise the logic

Access rules scattered across controllers drift apart. Put decisions in one policy layer, function or library, and call it from every handler or from middleware. Policy libraries and engines (CASL, Pundit, Django Guardian, Open Policy Agent) all follow this pattern. The OWASP Authorization Cheat Sheet recommends the same: enforce on every request, deny by default, centralise, and prefer attribute and relationship-based checks over role checks alone where data ownership matters.

Step 7: Fix CORS and file paths

  • CORS: allow only the exact origins your frontend uses. Never reflect the request's Origin header back while also allowing credentials.

  • File access: never build file paths from user input. Map an ID to a stored path on the server, or resolve the path and confirm it stays inside the allowed directory.

Step 8: Log, rate-limit and test

  • Log access-control failures with the user, route and object, and alert on repeated failures, which often mean someone is probing IDs.

  • Rate-limit sensitive endpoints so enumeration is slow and noisy.

  • Expire sessions and short-lived tokens, and invalidate sessions on logout and on role change.

  • Test with multiple roles: run your integration tests as an anonymous user, a normal user, a user in another tenant and an admin, and assert who gets what. Add access control to every security code review.

Broken access control checklist

Check

Done when

Route inventory

Every endpoint has an owner and a documented rule

Deny by default

Auth is global; public routes are explicit

Function-level checks

Every privileged action is checked server-side

Object-level checks

Every lookup by ID is scoped by owner or tenant

No client-trusted roles

Roles come from the server; JWTs are verified

Field allow-lists

Users cannot set role, owner or price fields

CORS restricted

Exact origins only, no reflected origin with credentials

Logging and alerts

Access failures are logged and alerted on

Multi-role tests

Tests run as anonymous, user, other tenant and admin

How does ARGUS find broken access control?

Broken access control is mostly missing logic, so ARGUS pairs rule-based scanning with passes built to reason about authorization.

  1. API inventory lists every HTTP route your code defines and marks it Authenticated, Open (no auth found, reported as a finding) or Not determined, and treats undetermined routes as open when scoring risk.

  2. A business logic pass looks for IDOR, privilege escalation, authentication bypass, broken sequences and unsafe API chains in Python, JavaScript, TypeScript and Ruby.

  3. Every AI finding is independently challenged, and dropped if it cannot be substantiated, so access-control findings come with reasoning and an attack scenario, not a guess.

  4. Pull request review can run an AI security pass that looks for authorization gaps in new code before it merges.

  5. Fix pull requests: Assign to Agent writes the missing check, verifies it with a build and a re-scan, and opens a pull request for you to review and merge.

Limits: AI passes run when AI scanning is enabled, and the business logic pass covers Python, JavaScript, TypeScript and Ruby. Keep multi-role tests, because no scanner proves access control is complete. See ARGUS SAST, or scan a repository free.

Frequently asked questions

What is broken access control?

Broken access control is any flaw that lets a user act outside their intended permissions, such as viewing another user's data, calling admin functions, changing their own role or reaching pages without logging in. It is ranked first in the OWASP Top 10 web application security risks.

How do you fix a broken access control vulnerability?

Enforce authorization on the server for every request. Deny by default, check both whether the user may perform the action and whether they may access the specific record, centralise the checks, never trust roles or IDs from the client, allow-list writable fields, and test with multiple roles.

What is the difference between authentication and authorization?

Authentication confirms who the user is, for example by password or single sign-on. Authorization decides what that user is allowed to do and which records they may access. Broken access control is an authorization failure: the user is correctly logged in but can do or see more than they should.

What are examples of broken access control?

Changing an ID in a URL to read another user's order (IDOR), a normal user calling an admin API, setting "role": "admin" in a profile update, opening /admin without logging in, tampering with a JWT or cookie to change identity, and an API that accepts requests from any origin with credentials.

How do you test for broken access control?

List every endpoint and its intended rule, then call each one as an anonymous user, a normal user, a user in another tenant and an admin, and confirm only the right roles succeed. Swap object IDs between accounts to test object-level checks, and automate these as integration tests.

Why is broken access control number one in the OWASP Top 10?

Because it is both common and hard to detect automatically. OWASP's data found access-control weaknesses in a large share of tested applications, and the flaws are usually missing checks that look like normal code, so they survive into production more often than pattern-based bugs.

Is IDOR the same as broken access control?

IDOR is one type of broken access control: a missing object-level check that lets a user access a record by changing its ID. Broken access control also includes missing function-level checks, privilege escalation, forced browsing, token tampering, CORS misconfiguration and path traversal.

Can a WAF prevent broken access control?

Not reliably. A web application firewall sees requests, not your business rules, so it cannot know that user 58 should not read invoice 1043. It can slow enumeration with rate limits, but the fix has to be authorization checks in your application.

DATA SOURCES

OWASP Top 10: https://owasp.org/Top10/ ; OWASP Authorization Cheat Sheet: https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html ; CWE-639: https://cwe.mitre.org/data/definitions/639.html

Liked this post? Share it: