Authorization Bypass
Authorization bypass vulnerabilities occur when applications fail to properly enforce access controls, allowing users to access resources or perform actions they shouldn’t be authorized to perform. This is distinct from authentication bypass (breaking login mechanisms) - authorization bypass assumes the user is already authenticated but gains unauthorized access.What is Authorization Bypass?
Authorization controls determine what authenticated users are allowed to do and what data they can access. When these controls are missing, improperly implemented, or can be circumvented, attackers can:- Access other users’ data (horizontal privilege escalation)
- Perform administrative functions (vertical privilege escalation)
- Modify protected resources
- Bypass business logic restrictions
Types of Authorization Issues
-
Horizontal Privilege Escalation: Accessing resources of other users at the same privilege level
- Example: User A viewing User B’s profile or orders
-
Vertical Privilege Escalation: Gaining higher privileges than assigned
- Example: Regular user accessing admin functions
-
Context-Dependent Access Control: Bypassing workflow or state-based restrictions
- Example: Approving your own expense report
How the Attack Works
The DVWA Authorization Bypass module simulates a user management system that should only be accessible to administrators. The challenge is to access and modify user data while logged in as a regular user (e.g.,gordonb / abc123).
Application Structure
The module consists of three main components:- Main Page (
index.php): Displays the user interface - Data Retrieval (
get_user_data.php): API endpoint that returns user information - Data Modification (
change_user_details.php): API endpoint that updates user data
Frontend Implementation
The interface uses JavaScript to fetch and display user data:- No authorization checks whatsoever
- “Security through obscurity” (hiding menu link)
- APIs completely open
- No role-based access control (RBAC)
Medium Security
Improvement: Added authorization check on main page only. Main Page (medium.php):
change_user_details.php endpoint also remains unprotected.
Exploitation:
While the main page now blocks non-admin access, the underlying APIs don’t:
- Direct API Access:
{"result":"ok"}
Weaknesses:
- Inconsistent authorization (page protected, APIs not)
- Client-side vs server-side security gap
- Missing defense in depth
- No authorization on data modification
High Security
Improvement: Protected both page and GET API endpoint. Main Page (high.php):
change_user_details.php) - STILL UNPROTECTED:
- Incomplete authorization coverage
- Forgot to protect write operations
- SQL injection vulnerability
- No input validation
- No output encoding
Impossible Security
Improvement: Comprehensive authorization on all endpoints. Main Page (impossible.php):
change_user_details.php):
6. API vs UI Inconsistency
UI protected, API unprotected:2. Role-Based Access Control (RBAC)
4. Attribute-Based Access Control (ABAC)
Testing for Authorization Bypass
Manual Testing Checklist
-
Test with different user roles
- Create accounts with different privilege levels
- Test each function with each role
- Verify appropriate access restrictions
-
Direct object reference testing
- Access resources with sequential IDs
- Try accessing other users’ resources
- Test with modified parameters
-
Parameter manipulation
- Modify user IDs, role parameters
- Add admin parameters
- Change resource identifiers
-
API endpoint discovery
- Map all API endpoints
- Test authorization on each
- Check for consistency with UI restrictions
-
HTTP method testing
- Try GET, POST, PUT, DELETE, PATCH
- Test HEAD, OPTIONS, TRACE
- Check for method-specific bypasses
Automated Testing
Burp Suite:- Use “Autorize” extension
- Configure low-privilege user token
- Proxy high-privilege requests
- Automatically checks if low-privilege user can access
- Enable “Access Control Testing” add-on
- Configure user contexts
- Run active scan with different users
- Review access control findings
