Skip to main content
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) occur when an application exposes a reference to an internal implementation object, such as a database key, without proper access control checks.To prevent IDOR vulnerabilities:
  • 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 occurs when applications do not properly restrict access to sensitive functionality based on the user’s role or permissions.To implement proper 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 occurs when a user can access resources belonging to another user with the same privilege level.To prevent 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 occurs when a user can gain access to functionality or data intended for users with higher privilege levels.To prevent 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
Access controls can be bypassed when they are implemented incorrectly, such as relying on client-side checks, using security through obscurity, or having flaws in the authorization logic.To prevent access control bypassing:
  • 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
APIs require special attention for access control as they are often designed to be consumed by multiple clients and may expose sensitive functionality or data.To implement proper 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 occurs when attackers directly access URLs that are not linked from the application but still accessible without proper authorization.To prevent 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 vulnerabilities allow attackers to access files and directories outside of the intended directory by manipulating file paths.To prevent 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 occur when an application fails to verify that the authenticated user has the necessary permissions to perform an action or access a resource.To implement proper authorization checks:
  • Verify user permissions for all sensitive operations
  • Implement role-based or attribute-based access control
  • Check resource ownership before allowing modifications
  • Implement proper data filtering based on user permissions
  • Use a centralized authorization mechanism
  • Implement proper error handling for authorization failures
  • Log and monitor authorization failures
  • Regularly test authorization controls
Single Page Applications (SPAs) require special consideration for access control, as they often implement UI-based access controls that can be bypassed if not properly secured on the server.To implement proper access control in SPAs:
  • 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
Preventing broken access control requires a comprehensive approach that addresses authentication, authorization, and proper implementation of access controls throughout the application.Key prevention strategies:
  • 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