This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org
Difference between revisions of "Top 10-2017 A5-Broken Access Control"
m (T.Gigler moved page Top 10 2017-A4-Broken Access Control to Top 10-2017 A4-Broken Access Control: OWASP Top 10-2017 Release) |
m (Editorial changes e.g. line feeds) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Top_10_2013:TopTemplate | {{Top_10_2013:TopTemplate | ||
− | | | + | |useprev=2017PrevLink |
− | | | + | |prev=A4-{{Top_10_2010:ByTheNumbers |
− | + | |4 | |
− | + | |year=2017 | |
− | + | |language=en | |
− | | | + | }} |
− | | | + | |usenext=2017NextLink |
− | + | |next=A6-{{Top_10_2010:ByTheNumbers | |
− | + | |6 | |
− | + | |year=2017 | |
+ | |language=en | ||
+ | }} | ||
|year=2017 | |year=2017 | ||
|language=en | |language=en | ||
}} | }} | ||
− | + | <!--- 2017 Broken Access Control ---> | |
{{Top_10_2010:SummaryTableHeaderBeginTemplate|year=2017|language=en}} | {{Top_10_2010:SummaryTableHeaderBeginTemplate|year=2017|language=en}} | ||
− | + | {{Top_10-2017:SummaryTableTemplate|exploitability=2 |prevalence=2 |detectability=2 |impact=3 |year=2017|language=en}} | |
{{Top_10_2010:SummaryTableHeaderEndTemplate|year=2017}} | {{Top_10_2010:SummaryTableHeaderEndTemplate|year=2017}} | ||
− | + | <td colspan=2 {{Template:Top_10_2010:SummaryTableRowStyleTemplate|year=2017}}> | |
− | <!--- Threat | + | <!--- Threat Agent: ---> |
− | + | Exploitation of access control is a core skill of attackers. <u>[[Source_Code_Analysis_Tools|SAST]]</u> and <u>[[:Category:Vulnerability_Scanning_Tools|DAST]]</u> tools can detect the absence of access control but cannot verify if it is functional when it is present. Access control is detectable using manual means, or possibly through automation for the absence of access controls in certain frameworks. </td> | |
− | + | <td colspan=2 {{Template:Top_10_2010:SummaryTableRowStyleTemplate|year=2017}}> | |
− | </ | + | <!--- Security Weakness: ---> |
− | + | Access control weaknesses are common due to the lack of automated detection, and lack of effective functional testing by application developers.<br/>Access control detection is not typically amenable to automated static or dynamic testing. Manual testing is the best way to detect missing or ineffective access control, including HTTP method (GET vs PUT, etc), controller, direct object references, etc. </td> | |
− | < | + | <td colspan=2 {{Template:Top_10_2010:SummaryTableRowStyleTemplate|year=2017}}> |
− | + | <!--- Impacts: ---> | |
− | + | The technical impact is attackers acting as users or administrators, or users using privileged functions, or creating, accessing, updating or deleting every record.<br/>The business impact depends on the protection needs of the application and data. </td> | |
− | </td> | ||
− | |||
− | <!--- Security Weakness ---> | ||
− | |||
− | |||
− | </td> | ||
− | |||
− | <!--- | ||
− | |||
− | |||
− | </ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </td> | ||
{{Top_10_2010:SummaryTableEndTemplate|year=2017}} | {{Top_10_2010:SummaryTableEndTemplate|year=2017}} | ||
− | {{Top_10:SubsectionTableBeginTemplate | + | {{Top_10:SubsectionTableBeginTemplate|type=main}} |
− | + | {{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|subsection=isTheApplicationVulnerable|position=firstLeft|year=2017|language=en}} | |
− | + | 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 of the limits of the user. Common access control vulnerabilities include: | |
− | + | * Bypassing access control checks by modifying the URL, internal application state, or the HTML page, or simply using a custom API attack tool. | |
− | + | * Allowing the primary key to be changed to another's users record, permitting viewing or editing someone else's account. | |
− | + | * Elevation of privilege. Acting as a user without being logged in, or acting as an admin when logged in as a user. | |
+ | * Metadata manipulation, such as replaying or tampering with a JSON Web Token (JWT) access control token or a cookie or hidden field manipulated to elevate privileges, or abusing JWT invalidation | ||
+ | * CORS misconfiguration allows unauthorized API access. | ||
+ | * Force browsing to authenticated pages as an unauthenticated user or to privileged pages as a standard user. Accessing API with missing access controls for POST, PUT and DELETE. | ||
− | {{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|subsection= | + | {{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|subsection=howToPrevent|position=right|year=2017|language=en}} |
− | + | Access control is only effective if enforced in trusted server-side code or server-less API, where the attacker cannot modify the access control check or metadata. | |
− | + | * With the exception of public resources, deny by default. | |
− | + | * Implement access control mechanisms once and re-use them throughout the application, including minimizing CORS usage. | |
− | + | * Model access controls should enforce record ownership, rather than accepting that the user can 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). | ||
+ | * Rate limit API and controller access to minimize the harm from automated attack tooling. | ||
+ | * JWT tokens should be invalidated on the server after logout. | ||
+ | Developers and QA staff should include functional access control unit and integration tests. | ||
− | {{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|subsection= | + | {{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|subsection=exampleAttackScenarios|position=left|year=2017|language=en}} |
− | |||
+ | <b>Scenario #1</b>: The application uses unverified data in a SQL call that is accessing account information: | ||
{{Top_10_2010:ExampleBeginTemplate|year=2017}}<b><span style="color:red;"><nowiki> | {{Top_10_2010:ExampleBeginTemplate|year=2017}}<b><span style="color:red;"><nowiki> | ||
pstmt.setString(1, request.getParameter("acct"));</nowiki></span><br/><nowiki> | pstmt.setString(1, request.getParameter("acct"));</nowiki></span><br/><nowiki> | ||
ResultSet results = pstmt.executeQuery( );</nowiki></b> | ResultSet results = pstmt.executeQuery( );</nowiki></b> | ||
{{Top_10_2010:ExampleEndTemplate}} | {{Top_10_2010:ExampleEndTemplate}} | ||
− | An attacker simply modifies the | + | An attacker simply modifies the 'acct' parameter in the browser to send whatever account number they want. If not properly verified, the attacker can access any user's account. |
{{Top_10_2010:ExampleBeginTemplate|year=2017}}<b><nowiki> | {{Top_10_2010:ExampleBeginTemplate|year=2017}}<b><nowiki> | ||
http://example.com/app/accountInfo?acct=</nowiki><span style="color:red;">notmyacct</span></b> | http://example.com/app/accountInfo?acct=</nowiki><span style="color:red;">notmyacct</span></b> | ||
{{Top_10_2010:ExampleEndTemplate}}<br> | {{Top_10_2010:ExampleEndTemplate}}<br> | ||
− | < | + | <b>Scenario #2</b>: An attacker simply force browses to target URLs. Admin rights are required for access to the admin page. |
{{Top_10_2010:ExampleBeginTemplate|year=2017}}<b><nowiki> | {{Top_10_2010:ExampleBeginTemplate|year=2017}}<b><nowiki> | ||
http://example.com/app/getappInfo</nowiki><br/><nowiki> | http://example.com/app/getappInfo</nowiki><br/><nowiki> | ||
http://example.com/app/</nowiki><span style="color:red;">admin_getappInfo</span></b> | http://example.com/app/</nowiki><span style="color:red;">admin_getappInfo</span></b> | ||
{{Top_10_2010:ExampleEndTemplate}} | {{Top_10_2010:ExampleEndTemplate}} | ||
− | If an unauthenticated user can access either page, it’s a flaw. If a non-admin can access the admin page, this is | + | 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. |
− | {{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|subsection=references|position=right | + | {{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|subsection=references|position=right|year=2017|language=en}} |
− | {{Top_10_2010:SubSubsectionOWASPReferencesTemplate|year=2017}} | + | {{Top_10_2010:SubSubsectionOWASPReferencesTemplate|year=2017|language=en}} |
− | * <u>[[ | + | * <u>[[OWASP_Proactive_Controls#6:_Implement_Access_Controls|OWASP Proactive Controls: Access Controls]]</u> |
− | * <u>[[ | + | * <u>[[:Category:OWASP_Application_Security_Verification_Standard_Project#tab=Home|OWASP Application Security Verification Standard: V4 Access Control]]</u> |
− | * <u>[ | + | * <u>[[Testing_for_Authorization|OWASP Testing Guide: Authorization Testing]]</u> |
− | * | + | * <u>[[Access_Control_Cheat_Sheet|OWASP Cheat Sheet: Access Control]]</u> |
− | |||
{{Top_10_2010:SubSubsectionExternalReferencesTemplate|year=2017|language=en}} | {{Top_10_2010:SubSubsectionExternalReferencesTemplate|year=2017|language=en}} | ||
− | * <u>[ | + | * <u>[https://cwe.mitre.org/data/definitions/22.html CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')]</u> |
− | * <u>[ | + | * <u>[https://cwe.mitre.org/data/definitions/284.html CWE-284: Improper Access Control (Authorization)]</u> |
− | * <u>[ | + | * <u>[https://cwe.mitre.org/data/definitions/285.html CWE-285: Improper Authorization]</u> |
+ | * <u>[https://cwe.mitre.org/data/definitions/639.html CWE-639: Authorization Bypass Through User-Controlled Key]</u> | ||
+ | * <u>[https://portswigger.net/blog/exploiting-cors-misconfigurations-for-bitcoins-and-bounties PortSwigger: Exploiting CORS misconfiguration]</u> | ||
{{Top_10_2013:BottomAdvancedTemplate | {{Top_10_2013:BottomAdvancedTemplate | ||
− | |type= | + | |type=box |
− | | | + | |useprev=2017PrevLink |
− | | | + | |prev=A4-{{Top_10_2010:ByTheNumbers |
− | + | |4 | |
− | + | |year=2017 | |
− | + | |language=en | |
− | | | + | }} |
− | | | + | |usenext=2017NextLink |
− | + | |next=A6-{{Top_10_2010:ByTheNumbers | |
− | + | |6 | |
− | + | |year=2017 | |
+ | |language=en | ||
+ | }} | ||
|year=2017 | |year=2017 | ||
|language=en | |language=en | ||
}} | }} | ||
− | [[Category:OWASP Top Ten Project]] | + | <!-- [[Category:OWASP Top Ten Project]] --> |
Latest revision as of 16:38, 1 January 2018
Threat Agents / Attack Vectors | Security Weakness | Impacts | |||
---|---|---|---|---|---|
App Specific | Exploitability: 2 |
Prevalence: 2 |
Detectability: 2 |
Technical: 3 |
Business ? |
Exploitation of access control is a core skill of attackers. SAST and DAST tools can detect the absence of access control but cannot verify if it is functional when it is present. Access control is detectable using manual means, or possibly through automation for the absence of access controls in certain frameworks. |
Access control weaknesses are common due to the lack of automated detection, and lack of effective functional testing by application developers. Access control detection is not typically amenable to automated static or dynamic testing. Manual testing is the best way to detect missing or ineffective access control, including HTTP method (GET vs PUT, etc), controller, direct object references, etc. |
The technical impact is attackers acting as users or administrators, or users using privileged functions, or creating, accessing, updating or deleting every record. The business impact depends on the protection needs of the application and data. |
Is the Application Vulnerable?
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 of the limits of the user. Common access control vulnerabilities include:
|
How to Prevent
Access control is only effective if enforced in trusted server-side code or server-less API, where the attacker cannot modify the access control check or metadata.
Developers and QA staff should include functional access control unit and integration tests. |
Example Attack Scenarios
Scenario #1: The application uses unverified data in a SQL call that is accessing account information:
pstmt.setString(1, request.getParameter("acct"));
ResultSet results = pstmt.executeQuery( ); An attacker simply modifies the 'acct' parameter in the browser to send whatever account number they want. If not properly verified, the attacker can access any user's account.
http://example.com/app/accountInfo?acct=notmyacct
Scenario #2: An attacker simply force browses to target URLs. Admin rights are required for access to the admin page.
http://example.com/app/getappInfo
http://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. |
References
OWASP
External |