Broken Access Control Overview
Broken Access Control Overview
Broken access control vulnerabilities occur when an application fails to properly restrict what authenticated users are allowed to do. These vulnerabilities can allow attackers to access unauthorized functionality or data, such as accessing other users’ accounts, viewing sensitive files, modifying data, or changing access rights.Access control enforces policy such that users cannot act outside of their intended permissions. Failures typically lead to unauthorized information disclosure, modification, or destruction of data, or performing business functions outside the user’s limits.Preventing broken access control requires implementing proper authentication, authorization, and access control mechanisms throughout the application.
Insecure Direct Object References (IDOR)
Insecure Direct Object References (IDOR)
- Implement proper authorization checks for all object references
- Use indirect references that are mapped on the server side
- Validate that the authenticated user has permission to access the requested object
- Implement access control at both the data and function levels
- Consider using UUIDs instead of sequential IDs for sensitive resources
- Log and monitor access control failures
- Implement proper error handling for authorization failures
Missing Function Level Access Control
Missing Function Level Access Control
- Enforce authorization checks for all sensitive functions
- Implement role-based access control
- Use centralized authorization mechanisms
- Apply the principle of least privilege
- Hide or disable UI elements for unauthorized functions
- Implement server-side authorization checks (never rely on client-side checks alone)
- Regularly audit and test access controls
- Log and monitor access control failures
Horizontal Privilege Escalation
Horizontal Privilege Escalation
- Verify that the authenticated user owns or has access to the requested resource
- Implement proper data access controls
- Use indirect references that are mapped to user-specific resources
- Implement proper error handling that doesn’t reveal sensitive information
- Log and monitor access attempts
- Consider implementing resource-based access control
- Regularly test for horizontal privilege escalation vulnerabilities
Vertical Privilege Escalation
Vertical Privilege Escalation
- Implement proper role-based access control
- Verify the user’s authority for all privilege-changing operations
- Implement proper input validation for role assignments
- Use the principle of least privilege
- Consider implementing approval workflows for sensitive operations
- Log and monitor privilege changes
- Regularly audit user privileges
- Implement proper error handling for authorization failures
Bypassing Access Controls
Bypassing Access Controls
- Implement server-side access controls for all sensitive operations
- Never rely on client-side access controls for security
- Implement proper authentication and session management
- Use a centralized authorization mechanism
- Deny access by default
- Regularly test access controls with different user roles
- Implement proper logging and monitoring
- Keep authorization logic simple and consistent
Improper Access Control in APIs
Improper Access Control in APIs
- Implement proper authentication for all API endpoints
- Use token-based authentication with appropriate scopes
- Implement proper authorization checks for all resources
- Filter sensitive data based on the user’s role
- Use rate limiting to prevent abuse
- Implement proper error handling
- Document access control requirements
- Regularly test API access controls
Forced Browsing
Forced Browsing
- Implement proper authentication and authorization for all pages
- Use role-based access control
- Implement proper URL authorization checks
- Avoid predictable resource locations
- Implement proper error handling for unauthorized access
- Consider using a web application firewall
- Regularly scan for unprotected resources
- Implement proper logging and monitoring
Path Traversal
Path Traversal
- Validate and sanitize user input used in file paths
- Use path normalization functions
- Verify that the final path is within the intended directory
- Use a whitelist of allowed files or directories
- Implement proper access controls for file operations
- Consider using a file access abstraction layer
- Avoid exposing direct file paths to users
- Implement proper error handling for file operations
Missing Authorization Checks
Missing Authorization Checks
Broken Access Control in Single Page Applications
Broken Access Control in Single Page Applications
- Implement server-side access controls for all API endpoints
- Never rely on client-side access controls for security
- Use proper authentication mechanisms (e.g., JWT, session cookies)
- Implement proper authorization checks for all resources
- Consider using an API gateway with authorization capabilities
- Implement proper error handling for unauthorized requests
- Regularly test API endpoints with different user roles
- Keep client-side and server-side authorization logic in sync
Broken Access Control Prevention Checklist
Broken Access Control Prevention Checklist
- Implement proper authentication and session management
- Use a centralized authorization mechanism
- Enforce the principle of least privilege
- Deny access by default
- Implement proper function and data level access controls
- Regularly test and audit access controls
- Log and monitor access control failures
- Keep authorization logic simple and consistent