Access Control
Access control, also called authorization, determines what an authenticated user is allowed to access or perform inside an application.
Broken access control happens when an application fails to properly enforce these rules. This can allow users to access other users' data, administrative functions, internal resources, or actions outside their assigned permissions.
Warning
Test access control only in authorized labs, bug bounty scopes, or systems where you have explicit permission.
Core Concepts
Access control depends on three related security areas.
| Concept | Question Answered | Example |
|---|---|---|
| Authentication | Who are you? | Login with username and password |
| Session management | Are you the same user who logged in? | Session cookie |
| Access control | Are you allowed to do this? | Admin-only delete function |
Access control checks should happen on the server side for every sensitive action.
Why Access Control Fails
Access control issues often happen because developers assume users will only interact with the application through the intended interface.
Common bad assumptions:
- Users will not manually browse to hidden URLs.
- Users will not change IDs in requests.
- Hidden form fields cannot be modified.
- Cookies cannot be edited.
- JavaScript access checks are enough.
- If a button is hidden, the action is protected.
- Complex URLs are unguessable enough to be safe.
These assumptions are unsafe because attackers can intercept, modify, and replay HTTP requests.
Vertical Privilege Escalation
Vertical privilege escalation occurs when a lower-privileged user gains access to higher-privileged functionality.
Example:
Common targets:
- Admin panels
- User management
- Billing settings
- API key generation
- Debug consoles
- Internal dashboards
- Delete or modify user functions
Unprotected Functionality
Sometimes sensitive functionality is accessible directly if the user knows the URL.
Example:
Or:
If the server does not check whether the current user is an admin, hiding the link in the UI does not protect it.
Testing Idea
Try directly requesting sensitive-looking paths:
Information Leakage
Applications may leak hidden admin paths in places users can access.
Common sources:
- HTML comments
- JavaScript files
- API responses
robots.txt- Sitemap files
- Error messages
- Frontend route definitions
Example robots.txt:
This prevents search engines from indexing the path, but it also reveals the path to anyone who reads the file.
Security by Obscurity
A hidden or random-looking URL is not enough.
Example:
This may seem hard to guess, but it is still insecure if:
- The URL appears in JavaScript
- The URL appears in page source
- The URL appears in logs
- The URL is shared with all users
- The server does not enforce authorization
The rule is simple:
Parameter-Based Access Control
Some applications trust request parameters, cookies, or hidden fields to determine privileges.
Bad examples:
An attacker can modify these values:
Access control decisions should not trust user-controlled input.
Horizontal Privilege Escalation
Horizontal privilege escalation occurs when a user accesses another user's resources without gaining higher privileges.
Example:
This is commonly caused by IDOR vulnerabilities.
IDOR
IDOR stands for Insecure Direct Object Reference.
It happens when an application exposes a direct reference to an object, such as a user ID, file ID, invoice ID, or order ID, without checking whether the current user is allowed to access it.
Example:
The attacker changes the ID:
If the application returns user 456's account data, access control is broken.
Common IDOR Targets
Look for object identifiers in:
- URL paths
- Query parameters
- JSON bodies
- Form fields
- Cookies
- API routes
- File download links
Examples:
GUIDs and UUIDs
Some applications use GUIDs or UUIDs instead of sequential IDs.
Example:
This is harder to guess than 123, but it is not automatically secure.
GUID-based access control can still fail if:
- GUIDs are leaked in public pages
- GUIDs appear in JavaScript
- GUIDs appear in API responses
- GUIDs are predictable
- The application still does not verify ownership
Horizontal to Vertical Escalation
Attackers can sometimes chain horizontal access into vertical escalation.
Example attack path:
- A normal user finds an IDOR in account settings.
- The user changes
id=123toid=456. - User 456 is an administrator.
- The attacker accesses the admin user's account settings.
- The attacker changes the admin email or resets credentials.
- The attacker gains administrative access.
This chain starts as horizontal privilege escalation and becomes vertical privilege escalation.
Testing Checklist
When testing access control, ask:
- Can a normal user access admin URLs directly?
- Are hidden URLs leaked in source code?
- Can IDs be changed to access other users' data?
- Are authorization checks enforced server-side?
- Can cookies or parameters change user role?
- Can lower-privileged users call privileged API endpoints?
- Can users modify or delete objects they do not own?
- Are different HTTP methods protected consistently?
- Are GUIDs or UUIDs leaked anywhere?
- Are API responses exposing more data than the UI shows?
Remediation
Strong access control should be enforced consistently on the server side.
Good practices:
- Deny access by default.
- Check authorization on every sensitive request.
- Do not rely on hidden buttons or hidden URLs.
- Do not trust user-controlled role values.
- Use server-side session identity.
- Verify object ownership before access.
- Use centralized authorization logic.
- Log access control violations.
- Test with multiple user roles.
- Apply least privilege.
Example rule:
Before returning invoice 123,
verify that the current user owns invoice 123
or has an authorized role to view it.
Quick Reference
| Issue | Example | Impact |
|---|---|---|
| Unprotected admin route | /admin accessible to normal user |
Vertical escalation |
| IDOR | Change user_id=1 to user_id=2 |
Horizontal escalation |
| Role parameter trust | admin=false changed to admin=true |
Vertical escalation |
| Leaked admin URL | Path exposed in JavaScript | Admin function discovery |
| GUID leakage | User UUID exposed publicly | IDOR despite unguessable IDs |
Notes to Remember
- Authentication proves identity.
- Session management tracks identity.
- Access control decides permissions.
- Access control must be enforced server-side.
- Hidden links are not security.
- User-controlled parameters must not define privileges.
- IDOR is one of the most common access control flaws.
- GUIDs help prevent guessing but do not replace authorization.