# A01:2025 Broken Access Control ![icon](../assets/TOP_10_Icons_Final_Broken_Access_Control.png){: style="height:80px;width:80px" align="right"} ## Background. Maintaining its position at #1 in the Top Ten, 100% of the applications tested were found to have some form of broken access control. Notable CWEs included are *CWE-200: Exposure of Sensitive Information to an Unauthorized Actor*, *CWE-201: Exposure of Sensitive Information Through Sent Data*, *CWE-918 Server-Side Request Forgery (SSRF)*, and *CWE-352: Cross-Site Request Forgery (CSRF)*. This category has the highest number of occurrences in the contributed data, and second highest number of related CVEs. ## Score table.
CWEs Mapped Max Incidence Rate Avg Incidence Rate Max Coverage Avg Coverage Avg Weighted Exploit Avg Weighted Impact Total Occurrences Total CVEs
40 20.15% 3.74% 100.00% 42.93% 7.04 3.84 1,839,701 32,654
## Description. 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 all data, or performing a business function outside the user's limits. Common access control vulnerabilities include: * Violation of the principle of least privilege, commonly known as deny by default, where access should only be granted for particular capabilities, roles, or users, but is available to anyone. * Bypassing access control checks by modifying the URL (parameter tampering or force browsing), internal application state, or the HTML page, or by using an attack tool that modifies API requests. * Permitting viewing or editing someone else's account by providing its unique identifier (insecure direct object references) * An accessible API with missing access controls for POST, PUT, and DELETE. * Elevation of privilege. Acting as a user without being logged in or or gaining privileges beyond those expected of the logged in user (e.g. admin access). * Metadata manipulation, such as replaying or tampering with a JSON Web Token (JWT) access control token, a cookie or hidden field manipulated to elevate privileges, or abusing JWT invalidation. * CORS misconfiguration allows API access from unauthorized or untrusted origins. * Force browsing (guessing URLs) to authenticated pages as an unauthenticated user or to privileged pages as a standard user. ## How to prevent. Access control is only effective when implemented in trusted server-side code or serverless APIs, where the attacker cannot modify the access control check or metadata. * Except for public resources, deny by default. * Implement access control mechanisms once and reuse them throughout the application, including minimizing Cross-Origin Resource Sharing (CORS) usage. * Model access controls should enforce record ownership rather than allowing users to create, read, update, or delete any record. * Unique application business limit requirements should be enforced by domain models. * Disable web server directory listing and ensure file metadata (e.g., .git) and backup files are not present within web roots. * Log access control failures, alert admins when appropriate (e.g., repeated failures). * Implement rate limits on API and controller access to minimize the harm from automated attack tooling. * Stateful session identifiers should be invalidated on the server after logout. Stateless JWT tokens should be short-lived to minimize the window of opportunity for an attacker. For longer-lived JWTs, consider using refresh tokens and following OAuth standards to revoke access. * Use well-established toolkits or patterns that provide simple, declarative access controls. Developers and QA staff should include functional access control in their unit and integration tests. ## Example attack scenarios. **Scenario #1:** The application uses unverified data in an SQL call that is accessing account information: ``` pstmt.setString(1, request.getParameter("acct")); ResultSet results = pstmt.executeQuery( ); ``` An attacker can simply modify the browser's 'acct' parameter to send any desired account number. If not correctly verified, the attacker can access any user's account. ``` https://example.com/app/accountInfo?acct=notmyacct ``` **Scenario #2:** An attacker simply forces browsers to target URLs. Admin rights are required for access to the admin page. ``` https://example.com/app/getappInfo https://example.com/app/admin_getappInfo ``` If an unauthenticated user can access either page, it's a flaw. If a non-admin can access the admin page, this is a flaw. **Scenario #3:** An application puts all of their access control in their front-end. While the attacker cannot get to `https://example.com/app/admin_getappInfo` due to JavaScript code running in the browser, they can simply execute: ``` $ curl https://example.com/app/admin_getappInfo ``` from the command line. ## References. * [OWASP Proactive Controls: C1: Implement Access Control](https://top10proactive.owasp.org/archive/2024/the-top-10/c1-accesscontrol/) * [OWASP Application Security Verification Standard: V8 Authorization](https://github.com/OWASP/ASVS/blob/master/5.0/en/0x17-V8-Authorization.md) * [OWASP Testing Guide: Authorization Testing](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/05-Authorization_Testing/README) * [OWASP Cheat Sheet: Authorization](https://cheatsheetseries.owasp.org/cheatsheets/Authorization_Cheat_Sheet.html) * [PortSwigger: Exploiting CORS misconfiguration](https://portswigger.net/blog/exploiting-cors-misconfigurations-for-bitcoins-and-bounties) * [OAuth: Revoking Access](https://www.oauth.com/oauth2-servers/listing-authorizations/revoking-access/) ## List of Mapped CWEs * [CWE-22 Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')](https://cwe.mitre.org/data/definitions/22.html) * [CWE-23 Relative Path Traversal](https://cwe.mitre.org/data/definitions/23.html) * [CWE-36 Absolute Path Traversal](https://cwe.mitre.org/data/definitions/36.html) * [CWE-59 Improper Link Resolution Before File Access ('Link Following')](https://cwe.mitre.org/data/definitions/59.html) * [CWE-61 UNIX Symbolic Link (Symlink) Following](https://cwe.mitre.org/data/definitions/61.html) * [CWE-65 Windows Hard Link](https://cwe.mitre.org/data/definitions/65.html) * [CWE-200 Exposure of Sensitive Information to an Unauthorized Actor](https://cwe.mitre.org/data/definitions/200.html) * [CWE-201 Exposure of Sensitive Information Through Sent Data](https://cwe.mitre.org/data/definitions/201.html) * [CWE-219 Storage of File with Sensitive Data Under Web Root](https://cwe.mitre.org/data/definitions/219.html) * [CWE-276 Incorrect Default Permissions](https://cwe.mitre.org/data/definitions/276.html) * [CWE-281 Improper Preservation of Permissions](https://cwe.mitre.org/data/definitions/281.html) * [CWE-282 Improper Ownership Management](https://cwe.mitre.org/data/definitions/282.html) * [CWE-283 Unverified Ownership](https://cwe.mitre.org/data/definitions/283.html) * [CWE-284 Improper Access Control](https://cwe.mitre.org/data/definitions/284.html) * [CWE-285 Improper Authorization](https://cwe.mitre.org/data/definitions/285.html) * [CWE-352 Cross-Site Request Forgery (CSRF)](https://cwe.mitre.org/data/definitions/352.html) * [CWE-359 Exposure of Private Personal Information to an Unauthorized Actor](https://cwe.mitre.org/data/definitions/359.html) * [CWE-377 Insecure Temporary File](https://cwe.mitre.org/data/definitions/377.html) * [CWE-379 Creation of Temporary File in Directory with Insecure Permissions](https://cwe.mitre.org/data/definitions/379.html) * [CWE-402 Transmission of Private Resources into a New Sphere ('Resource Leak')](https://cwe.mitre.org/data/definitions/402.html) * [CWE-424 Improper Protection of Alternate Path](https://cwe.mitre.org/data/definitions/424.html) * [CWE-425 Direct Request ('Forced Browsing')](https://cwe.mitre.org/data/definitions/425.html) * [CWE-441 Unintended Proxy or Intermediary ('Confused Deputy')](https://cwe.mitre.org/data/definitions/441.html) * [CWE-497 Exposure of Sensitive System Information to an Unauthorized Control Sphere](https://cwe.mitre.org/data/definitions/497.html) * [CWE-538 Insertion of Sensitive Information into Externally-Accessible File or Directory](https://cwe.mitre.org/data/definitions/538.html) * [CWE-540 Inclusion of Sensitive Information in Source Code](https://cwe.mitre.org/data/definitions/540.html) * [CWE-548 Exposure of Information Through Directory Listing](https://cwe.mitre.org/data/definitions/548.html) * [CWE-552 Files or Directories Accessible to External Parties](https://cwe.mitre.org/data/definitions/552.html) * [CWE-566 Authorization Bypass Through User-Controlled SQL Primary Key](https://cwe.mitre.org/data/definitions/566.html) * [CWE-601 URL Redirection to Untrusted Site ('Open Redirect')](https://cwe.mitre.org/data/definitions/601.html) * [CWE-615 Inclusion of Sensitive Information in Source Code Comments](https://cwe.mitre.org/data/definitions/615.html) * [CWE-639 Authorization Bypass Through User-Controlled Key](https://cwe.mitre.org/data/definitions/639.html) * [CWE-668 Exposure of Resource to Wrong Sphere](https://cwe.mitre.org/data/definitions/668.html) * [CWE-732 Incorrect Permission Assignment for Critical Resource](https://cwe.mitre.org/data/definitions/732.html) * [CWE-749 Exposed Dangerous Method or Function](https://cwe.mitre.org/data/definitions/749.html) * [CWE-862 Missing Authorization](https://cwe.mitre.org/data/definitions/862.html) * [CWE-863 Incorrect Authorization](https://cwe.mitre.org/data/definitions/863.html) * [CWE-918 Server-Side Request Forgery (SSRF)](https://cwe.mitre.org/data/definitions/918.html) * [CWE-922 Insecure Storage of Sensitive Information](https://cwe.mitre.org/data/definitions/922.html) * [CWE-1275 Sensitive Cookie with Improper SameSite Attribute](https://cwe.mitre.org/data/definitions/1275.html)