1️⃣A01:2021 – Broken Access Control
What is Broken Access Control?
Broken access control vulnerabilities occur when applications do not correctly enforce policies that restrict users' actions to those intended by the system’s administrators. These vulnerabilities can lead to unauthorized information disclosure, modification, or destruction of data, or performing unauthorized business functions.
Here are some common types of broken access control vulnerabilities:
Violation of the Principle of Least Privilege or Deny by Default
Description: Access should be granted only to specific users, roles, or capabilities, but instead, it is available to anyone. This often happens when the system does not properly restrict access to resources, leading to users gaining more permissions than necessary.
Impact: Users can access or modify data and functionalities that they should not be allowed to, leading to potential data breaches and system compromise.
Bypassing Access Control Checks
Description: Users can manipulate application inputs such as URLs, parameters, or internal states to bypass access control mechanisms. This includes parameter tampering, force browsing, and modifying HTML pages or API requests.
Impact: Unauthorized users can gain access to restricted areas or data, compromising the integrity and confidentiality of the system.
Insecure Direct Object References (IDOR)
Description: Users can access resources by modifying the unique identifiers used by the application, such as changing a user ID in a URL. The application does not verify if the user is authorized to access the specified resource.
Impact: Users can access or modify data that belongs to other users, leading to data leakage and potential data corruption.
Missing Access Controls for API Methods
Description: APIs lack proper access controls for critical operations such as POST, PUT, DELETE, leading to unauthorized users performing these actions.
Impact: Unauthorized users can create, update, or delete resources, causing data integrity issues and potential system disruption.
Elevation of Privilege
Description: Users can elevate their privileges without proper authorization, such as accessing admin functionalities while logged in as a standard user, or acting as a user without being logged in.
Impact: Attackers can gain administrative control, manipulate critical data, and potentially compromise the entire system.
Metadata Manipulation
Description: Manipulating metadata such as JSON Web Tokens (JWT), cookies, or hidden fields to elevate privileges or bypass access controls. This includes replaying or tampering with tokens.
Impact: Attackers can gain unauthorized access or elevated privileges, leading to data breaches and unauthorized actions within the application.
CORS Misconfiguration
Description: Cross-Origin Resource Sharing (CORS) settings allow unauthorized or untrusted origins to access the API. This misconfiguration can expose sensitive endpoints to malicious websites.
Impact: Attackers can exploit the API from untrusted origins, leading to unauthorized actions and data leakage.
Force Browsing
Description: Users can access authenticated or privileged pages without proper authentication or authorization by directly navigating to these pages.
Impact: Unauthorized users can access restricted functionalities and data, compromising the security and integrity of the application.
Mitigation Strategies
To prevent broken access control vulnerabilities, implement the following strategies:
Enforce the principle of least privilege.
Implement comprehensive access control checks on both client and server sides.
Use secure coding practices to prevent IDOR.
Ensure proper access controls for all API methods.
Validate and securely handle JWT tokens.
Configure CORS correctly to restrict access to trusted origins.
Implement proper authentication and session management mechanisms.
Practical Scenario
Scenario: Online Banking Application
1. Violation of the Principle of Least Privilege
Description: A user should only have access to their own account details and not those of others. However, the application grants access to all users' accounts to any logged-in user.
Example:
Intended Functionality: User Alice should only access
https://bankapp.com/account/alice
.Broken Functionality: User Alice can also access
https://bankapp.com/account/bob
.
2. Bypassing Access Control Checks
Description: A user can bypass access control by manipulating the URL.
Example:
Intended Functionality: Only the account owner can view their transactions.
Broken Functionality: Any user can view another user's transactions by changing the URL.
3. Insecure Direct Object References (IDOR)
Description: Users can access resources by manipulating the unique identifier.
Example:
Intended Functionality: User Alice can view and edit only her profile.
Broken Functionality: User Alice can access Bob's profile by changing the user ID in the request.
4. Missing Access Controls for API Methods
Description: APIs lack proper access controls for critical operations like POST, PUT, DELETE.
Example:
Intended Functionality: Only the owner can delete their account.
Broken Functionality: Any user can delete any account.
5. Elevation of Privilege
Description: A user can elevate their privileges without proper authorization.
Example:
Intended Functionality: Standard users cannot access admin functionalities.
Broken Functionality: A standard user can elevate their privileges to admin.
6. Metadata Manipulation (JWT Tampering)
Description: Manipulating the JWT token to elevate privileges.
Example:
Intended Functionality: Users cannot modify their JWT tokens.
Broken Functionality: Users can tamper with their tokens to gain admin access.
7. CORS Misconfiguration
Description: API accessible from unauthorized/untrusted origins due to improper CORS settings.
Example:
Intended Functionality: Only requests from
https://trustedapp.com
are allowed.Broken Functionality: Requests from any origin are allowed.
8. Force Browsing
Description: Accessing pages meant for authenticated users as an unauthenticated user or accessing privileged pages as a standard user.
Example:
Intended Functionality: Only authenticated users can access their dashboard.
Broken Functionality: Unauthenticated users can access the dashboard.
REFERENCES
Mapped CWEs
Violation of the Principle of Least Privilege or Deny by Default
CWE-284: Improper Access Control
Bypassing Access Control Checks
CWE-22: Path Traversal
CWE-425: Direct Request ('Forced Browsing')
Insecure Direct Object References (IDOR)
Missing Access Controls for API Methods
CWE-284: Improper Access Control
Elevation of Privilege
CWE-269: Improper Privilege Management
Metadata Manipulation (JWT Tampering)
CORS Misconfiguration
Force Browsing
CWE-425: Direct Request ('Forced Browsing')
Last updated