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 "OWASP Top Ten Cheat Sheet"

From OWASP
Jump to: navigation, search
(OWASP Top Ten Cheat Sheet)
(Updated to 2013 T10. Added references to OTG V4.)
Line 19: Line 19:
 
||'''Controller'''
 
||'''Controller'''
 
||'''Model'''
 
||'''Model'''
||'''Testing (OWASP Testing Guide V4)'''
+
||'''Testing (OWASP Testing Guide V3)'''
  
 
|-
 
|-
Line 53: Line 53:
 
''Tip: '''All '''SQL Injection is due to dynamic SQL queries. Strongly consider prohibiting dynamic SQL queries within your organization ''
 
''Tip: '''All '''SQL Injection is due to dynamic SQL queries. Strongly consider prohibiting dynamic SQL queries within your organization ''
  
||
+
||''4.8.5 SQL Injection (OWASP-DV-005)''
''[https://www.owasp.org/index.php/Testing_for_SQL_Injection_%28OTG-INPVAL-005%29 SQL Injection (OTG-INPVAL-005)]''
+
''4.8.6 LDAP Injection (OWASP-DV-006)''
''[https://www.owasp.org/index.php/Testing_for_LDAP_Injection_(OTG-INPVAL-006) LDAP Injection (OTG-INPVAL-006)]''
+
''4.8.7 ORM Injection (OWASP-DV-007)''
''[https://www.owasp.org/index.php/Testing_for_ORM_Injection_%28OTG-INPVAL-007%29 ORM Injection (OTG-INPVAL-007)]''
+
''4.8.8 XML Injection (OWASP-DV-008)''
''[https://www.owasp.org/index.php/Testing_for_XML_Injection_(OTG-INPVAL-008) XML Injection (OTG-INPVAL-008)]''
+
''4.8.9 SSI Injection (OWASP-DV-009)''
''[https://www.owasp.org/index.php/Testing_for_SSI_Injection_(OTG-INPVAL-009) SSI Injection (OTG-INPVAL-009)]''
+
''4.8.10 XPath Injection (OWASP-DV-010)''
''[https://www.owasp.org/index.php/Testing_for_XPath_Injection_(OTG-INPVAL-010) XPath Injection (OTG-INPVAL-010)]''
+
''4.8.11 IMAP/SMTP Injection (OWASP-DV-011)''
''[https://www.owasp.org/index.php/Testing_for_IMAP/SMTP_Injection_(OTG-INPVAL-011) IMAP/SMTP Injection (OTG-INPVAL-011)]''
+
''4.8.12 Code Injection (OWASP-DV-012)''
''[https://www.owasp.org/index.php/Testing_for_Code_Injection_(OTG-INPVAL-012) Code Injection (OTG-INPVAL-012)]''
+
''4.8.13 OS Commanding (OWASP-DV-013)''
''[https://www.owasp.org/index.php/Testing_for_Command_Injection_(OTG-INPVAL-013) Command Injection (OTG-INPVAL-013)]''
+
''4.8.14 Buffer overflow (OWASP-DV-014)''
''[https://www.owasp.org/index.php/Testing_for_Buffer_Overflow_(OTG-INPVAL-014) Buffer Overflow (OTG-INPVAL-014)]''
 
  
|-
 
|'''A2 Weak authentication and session management'''
 
||''Render:''
 
*Validate user is authenticated.
 
*Validate role is sufficient for this view.
 
*Set "secure" and "HttpOnly" flags for session cookies.
 
*Send CSRF token with forms.
 
 
||''Design:''
 
*Only use inbuilt session management.
 
*Store secondary SSO / framework / custom session identifiers in native session object – do not send as additional headers or cookies.
 
 
*Validate user is authenticated.
 
*Validate role is sufficient to perform this action.
 
*Validate CSRF token.
 
||Validate role is sufficient to create, read, update, or delete data
 
 
''Tip: Consider the use of a "governor" to regulate the maximum number of requests per second / minute / hour that this user may perform. For example, a typical banking user should not perform more than ten transactions a minute, and one hundred per second is dangerous and should be blocked.''
 
 
||
 
''[https://www.owasp.org/index.php/Test_Role_Definitions_(OTG-IDENT-001) Test Role Definitions (OTG-IDENT-001)]''
 
''[https://www.owasp.org/index.php/Test_User_Registration_Process_(OTG-IDENT-002) Test User Registration Process (OTG-IDENT-002)]''
 
''[https://www.owasp.org/index.php/Test_Account_Provisioning_Process_(OTG-IDENT-003) Test Account Provisioning Process (OTG-IDENT-003)]''
 
''[https://www.owasp.org/index.php/Testing_for_Account_Enumeration_and_Guessable_User_Account_(OTG-IDENT-004) Testing for Account Enumeration and Guessable User Account (OTG-IDENT-004)]''
 
''[https://www.owasp.org/index.php/Testing_for_Weak_or_unenforced_username_policy_(OTG-IDENT-005) Testing for Weak or unenforced username policy (OTG-IDENT-005)]''
 
''[https://www.owasp.org/index.php/Testing_for_Credentials_Transported_over_an_Encrypted_Channel_(OTG-AUTHN-001) Testing for Credentials Transported over an Encrypted Channel (OTG-AUTHN-001)]''
 
''[https://www.owasp.org/index.php/Testing_for_default_credentials_(OTG-AUTHN-002) Testing for default credentials (OTG-AUTHN-002)]''
 
''[https://www.owasp.org/index.php/Testing_for_Weak_lock_out_mechanism_(OTG-AUTHN-003) Testing for Weak lock out mechanism (OTG-AUTHN-003)]''
 
''[https://www.owasp.org/index.php/Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004) Testing for bypassing authentication schema (OTG-AUTHN-004)]''
 
''[https://www.owasp.org/index.php/Testing_for_Vulnerable_Remember_Password_(OTG-AUTHN-005) Test remember password functionality (OTG-AUTHN-005)]''
 
''[https://www.owasp.org/index.php/Testing_for_Browser_cache_weakness_(OTG-AUTHN-006) Testing for Browser cache weakness (OTG-AUTHN-006)]''
 
''[https://www.owasp.org/index.php/Testing_for_Weak_password_policy_(OTG-AUTHN-007) Testing for Weak password policy (OTG-AUTHN-007)]''
 
''[https://www.owasp.org/index.php/Testing_for_Weak_security_question/answer_(OTG-AUTHN-008) Testing for Weak security question/answer (OTG-AUTHN-008)]''
 
''[https://www.owasp.org/index.php/Testing_for_weak_password_change_or_reset_functionalities_(OTG-AUTHN-009) Testing for weak password change or reset functionalities (OTG-AUTHN-009)]''
 
''[https://www.owasp.org/index.php/Testing_for_Weaker_authentication_in_alternative_channel_(OTG-AUTHN-010) Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)]''
 
''[https://www.owasp.org/index.php/Testing_for_Bypassing_Authorization_Schema_(OTG-AUTHZ-002) Testing for bypassing authorization schema (OTG-AUTHZ-002)]''
 
''[https://www.owasp.org/index.php/Testing_for_Privilege_escalation_(OTG-AUTHZ-003) Testing for Privilege Escalation (OTG-AUTHZ-003)]''
 
''[https://www.owasp.org/index.php/Testing_for_Session_Management_Schema_(OTG-SESS-001) Testing for Bypassing Session Management Schema (OTG-SESS-001)]''
 
''[https://www.owasp.org/index.php/Testing_for_cookies_attributes_(OTG-SESS-002) Testing for Cookies attributes (OTG-SESS-002)]''
 
''[https://www.owasp.org/index.php/Testing_for_Session_Fixation_(OTG-SESS-003) Testing for Session Fixation (OTG-SESS-003)]''
 
''[https://www.owasp.org/index.php/Testing_for_Exposed_Session_Variables_(OTG-SESS-004) Testing for Exposed Session Variables (OTG-SESS-004)]''
 
''[https://www.owasp.org/index.php/Testing_for_CSRF_(OTG-SESS-005) Testing for Cross Site Request Forgery (CSRF) (OTG-SESS-005)]''
 
''[https://www.owasp.org/index.php/Testing_for_logout_functionality_(OTG-SESS-006) Testing for logout functionality (OTG-SESS-006)]''
 
''[https://www.owasp.org/index.php/Test_Session_Timeout_(OTG-SESS-007) Test Session Timeout (OTG-SESS-007)]''
 
''[https://www.owasp.org/index.php/Testing_for_Session_puzzling_(OTG-SESS-008) Testing for Session puzzling (OTG-SESS-008)]''
 
  
 
|-
 
|-
|'''A3 XSS'''
+
|'''A2 XSS'''
 
||
 
||
  
Line 137: Line 91:
 
''Tip: Use OWASP Scrubbr to clean tainted or hostile data from legacy data''
 
''Tip: Use OWASP Scrubbr to clean tainted or hostile data from legacy data''
  
||
+
||''4.8.1 Testing for Reflected Cross Site Scripting (OWASP-DV-001)''
''[https://www.owasp.org/index.php/Testing_for_Reflected_Cross_site_scripting_(OTG-INPVAL-001) Testing for Reflected Cross Site Scripting (OTG-INPVAL-001)]''
+
''4.8.2 Testing for Stored Cross Site Scripting (OWASP-DV-002)''
''[https://www.owasp.org/index.php/Testing_for_Stored_Cross_site_scripting_(OTG-INPVAL-002) Testing for Stored Cross Site Scripting (OTG-INPVAL-002)]''
+
''4.8.3 Testing for DOM based Cross Site Scripting (OWASP-DV-003)''
''[https://www.owasp.org/index.php/Testing_for_DOM-based_Cross_site_scripting_(OTG-CLIENT-001) Testing for DOM based Cross Site Scripting (OTG-CLIENT-001)]''
+
''4.8.4 Testing for Cross Site Flashing (OWASP-DV004)''
''[https://www.owasp.org/index.php/Testing_for_JavaScript_Execution_(OTG-CLIENT-002) Testing for JavaScript Execution (OTG-CLIENT-002)]''
+
 
''[https://www.owasp.org/index.php/Testing_for_HTML_Injection_(OTG-CLIENT-003) Testing for HTML Injection (OTG-CLIENT-003)]''
+
 
''[https://www.owasp.org/index.php/Testing_for_Cross_site_flashing_(OTG-CLIENT-008) Testing for Cross Site Flashing (OTG-CLIENT-008)]''
+
|-
 +
|'''A3 Weak authentication and session management'''
 +
||''Render:''
 +
*Validate user is authenticated.
 +
*Validate role is sufficient for this view.
 +
*Set "secure" and "HttpOnly" flags for session cookies.
 +
*Send CSRF token with forms.
 +
 
 +
||''Design:''
 +
*Only use inbuilt session management.
 +
*Store secondary SSO / framework / custom session identifiers in native session object – do not send as additional headers or cookies.
 +
 
 +
*Validate user is authenticated.
 +
*Validate role is sufficient to perform this action.
 +
*Validate CSRF token.
 +
||Validate role is sufficient to create, read, update, or delete data
 +
 
 +
''Tip: Consider the use of a "governor" to regulate the maximum number of requests per second / minute / hour that this user may perform. For example, a typical banking user should not perform more than ten transactions a minute, and one hundred per second is dangerous and should be blocked.''
 +
 
 +
||''4.4.2 Testing for user enumeration (OWASP-AT-002)''
 +
''4.4.3 Testing for Guessable (Dictionary) User Account (OWASP-AT-003)''
 +
''4.4.4 Brute Force Testing (OWASP-AT-004)''
 +
''4.4.6 Testing for vulnerable remember password and pwd reset (OWASP-AT-006)''
 +
''4.4.5 Testing for bypassing authentication schema (OWASP-AT-005)''
 +
''4.4.7 Testing for Logout and Browser Cache Management (OWASP-AT-007)''
 +
''4.4.8 Testing for CAPTCHA (OWASP-AT-008)''
 +
''4.4.9 Testing Multiple Factors Authentication (OWASP-AT-009)''
 +
''4.4.10 Testing for Race Conditions (OWASP-AT-010)''
 +
''4.5.1 Testing for Session Management Schema (OWASP-SM-001)''
 +
''4.5.2 Testing for Cookies attributes (OWASP-SM-002)''
 +
''4.5.3 Testing for Session Fixation (OWASP-SM_003)''
 +
''4.5.4 Testing for Exposed Session Variables (OWASP-SM-004)''
 +
''4.5.5 Testing for CSRF (OWASP-SM-005)''
 +
''4.6.2 Testing for bypassing authorization schema (OWASP-AZ-002)''
 +
''4.6.3 Testing for Privilege Escalation (OWASP-AZ-003)''
 +
 
  
 
|-
 
|-
|'''A4 Insecure Direct Object References'''
+
|'''A4 Insecure Direct Object Reference'''
 
||If data is from internal trusted sources, no data is sent.
 
||If data is from internal trusted sources, no data is sent.
  
Line 160: Line 149:
 
||Validate role is sufficient to create, read, update, or delete data.
 
||Validate role is sufficient to create, read, update, or delete data.
  
 +
||''4.6.1 Testing for Path Traversal (OWASP-AZ-001)''
 +
 +
|-
 +
|'''A5 Cross Site Request Forgery'''
 +
||''Pre-render:''
 +
*Validate user is authenticated
 +
*Validate role is sufficient for this view
 +
 +
''Render:''
 +
*Send CSRF token.
 +
*Set "secure" and "HttpOnly" flags for session cookies.
 
||
 
||
''[https://www.owasp.org/index.php/Testing_Directory_traversal/file_include_(OTG-AUTHZ-001) Testing Directory traversal/file include (OTG-AUTHZ-001)]''
+
*Validate CSRF token.
''[https://www.owasp.org/index.php/Testing_for_Insecure_Direct_Object_References_(OTG-AUTHZ-004) Testing for Insecure Direct Object References (OTG-AUTHZ-004)]''
+
*Validate role is sufficient to perform this action.
''[https://www.owasp.org/index.php/Testing_for_Local_File_Inclusion Testing for Local File Inclusion]''
+
*Validate role is sufficient.
''[https://www.owasp.org/index.php/Testing_for_Remote_File_Inclusion Testing for Remote File Inclusion]''
+
 
 +
''Tip: CSRF is '''always '''possible if there is XSS, so make sure XSS is eliminated within your application.''
 +
||Validate role is sufficient to create, read, update, or delete data
 +
 
 +
||''4.5.5 Testing for CSRF (OWASP-SM-005)''
  
 
|-
 
|-
|'''A5 Security Misconfiguration'''
+
|'''A6 Security Misconfiguration'''
 
||Ensure web servers and application servers are hardened.
 
||Ensure web servers and application servers are hardened.
  
Line 176: Line 180:
 
||Ensure database servers are hardened  
 
||Ensure database servers are hardened  
  
||
+
||''4.2.6 Analysis of Error Codes (OWASP-IG-006)''
''[https://www.owasp.org/index.php/Fingerprint_Web_Server_(OTG-INFO-002) Fingerprint Web Server (OTG-INFO-002)]''
+
''4.3.2 DB Listener Testing (OWASP-CM-002)''
''[https://www.owasp.org/index.php/Fingerprint_Web_Application_Framework_(OTG-INFO-008) Fingerprint Web Application Framework (OTG-INFO-008)]''
+
''4.3.3 Infrastructure Configuration Management Testing (OWASP-CM-003)''
''[https://www.owasp.org/index.php/Fingerprint_Web_Application_(OTG-INFO-009) Fingerprint Web Application (OTG-INFO-009)]''
+
''4.3.4 Application Configuration Management Testing (OWASP-CM-004)''
''[https://www.owasp.org/index.php/Test_Network/Infrastructure_Configuration_(OTG-CONFIG-001) Test Network/Infrastructure Configuration (OTG-CONFIG-001)]''
+
''4.3.5 Testing for File Extensions Handling (OWASP-CM-005)''
''[https://www.owasp.org/index.php/Test_Application_Platform_Configuration_(OTG-CONFIG-002) Test Application Platform Configuration (OTG-CONFIG-002)]''
+
''4.3.6 Old, Backup and Unreferenced Files (OWASP-CM-006)''
''[https://www.owasp.org/index.php/Test_File_Extensions_Handling_for_Sensitive_Information_(OTG-CONFIG-003) Test File Extensions Handling for Sensitive Information (OTG-CONFIG-003)]''
+
''4.3.7 Infrastructure and Application Admin Interfaces (OWASP-CM-007)''
''[https://www.owasp.org/index.php/Review_Old,_Backup_and_Unreferenced_Files_for_Sensitive_Information_(OTG-CONFIG-004) Review Old, Backup and Unreferenced Files for Sensitive Information (OTG-CONFIG-004)]''
+
''4.3.8 Testing for HTTP Methods and XST (OWASP-CM-008)''
''[https://www.owasp.org/index.php/Enumerate_Infrastructure_and_Application_Admin_Interfaces_(OTG-CONFIG-005) Enumerate Infrastructure and Application Admin Interfaces (OTG-CONFIG-005)]''
+
 
''[https://www.owasp.org/index.php/Test_HTTP_Methods_(OTG-CONFIG-006) Test HTTP Methods (OTG-CONFIG-006)]''
 
''[https://www.owasp.org/index.php/Test_RIA_cross_domain_policy_(OTG-CONFIG-008) Test RIA cross domain policy (OTG-CONFIG-008)]''
 
''[https://www.owasp.org/index.php/Testing_for_Error_Code_(OTG-ERR-001) Analysis of Error Codes (OTG-ERR-001)]''
 
''[https://www.owasp.org/index.php/Testing_for_Stack_Traces_(OTG-ERR-002) Analysis of Stack Traces (OTG-ERR-002)]''
 
  
 
|-
 
|-
|'''A6 Sensitive Data Exposure'''
+
|'''A7 Insufficient Cryptographic Storage'''
 
||''Design:''
 
||''Design:''
*Use strong ciphers (AES 128 or better) with secure mode of operations (do not use ECB).
+
*Use strong ciphers (AES 128 or better).
 
*Use strong hashes (SHA 256 or better) with salts for passwords.
 
*Use strong hashes (SHA 256 or better) with salts for passwords.
 
*Protect keys more than any other asset.
 
*Protect keys more than any other asset.
*Use TLS 1.2 or later for all web communications.
 
*Buy extended validation (EV) certificates for public web servers.
 
 
''Tip: Use TLS 1.2 always – even internally. Most snooping is done within corporate networks – and it is as easy and unethical as fishing with dynamite.''
 
  
 
''Render:''
 
''Render:''
Line 205: Line 201:
  
 
||''Design:''
 
||''Design:''
*Use strong ciphers (AES 128 or better) with secure mode of operations (do not use ECB).
+
*Use strong ciphers (AES 128 or better).
 
*Use strong hashes (SHA 256 or better) with salts for passwords.
 
*Use strong hashes (SHA 256 or better) with salts for passwords.
 
*Protect keys more than any other asset.
 
*Protect keys more than any other asset.
*Mandate strong encrypted communications between web and database servers and any other servers or administrative users.
 
  
 
''Tip: Only certain personally identifiable information and sensitive values MUST be encrypted. Encrypt data that would be embarrassing or costly if it was leaked or stolen. ''
 
''Tip: Only certain personally identifiable information and sensitive values MUST be encrypted. Encrypt data that would be embarrassing or costly if it was leaked or stolen. ''
Line 215: Line 210:
  
 
||''Design:''
 
||''Design:''
 
*Mandate strong encrypted communications with application servers and any other servers or administrative users.
 
  
 
''Tip: Do not use RDBMS database, row or table level encryption. The data can be retrieved in the clear by anyone with direct access to the server, or over the network using the application credentials. It might even traverse the network in the clear despite being "encrypted" on disk. ''
 
''Tip: Do not use RDBMS database, row or table level encryption. The data can be retrieved in the clear by anyone with direct access to the server, or over the network using the application credentials. It might even traverse the network in the clear despite being "encrypted" on disk. ''
  
 
||
 
||
''[https://www.owasp.org/index.php/Testing_for_Weak_SSL/TLS_Ciphers,_Insufficient_Transport_Layer_Protection_(OTG-CRYPST-001) Testing for Weak SSL/TLS Ciphers, Insufficient Transport Layer Protection (OTG-CRYPST-001)]''
+
 
''[https://www.owasp.org/index.php/Testing_for_Padding_Oracle_(OTG-CRYPST-002) Testing for Padding Oracle (OTG-CRYPST-002)]''
 
''[https://www.owasp.org/index.php/Testing_for_Sensitive_information_sent_via_unencrypted_channels_(OTG-CRYPST-003) Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-003)]''
 
''[https://www.owasp.org/index.php/Test_HTTP_Strict_Transport_Security_(OTG-CONFIG-007) Test HTTP Strict Transport Security (OTG-CONFIG-007)]''
 
''[https://www.owasp.org/index.php/Testing_for_Credentials_Transported_over_an_Encrypted_Channel_(OTG-AUTHN-001) Testing for Credentials Transported over an Encrypted Channel (OTG-AUTHN-001)]''
 
  
 
|-
 
|-
|'''A7 Missing Function Level Access Control'''
+
|'''A8 Failure to Restrict URL access'''
 
||''Design:''
 
||''Design:''
 
*Ensure all non-web data is outside the web root (logs, configuration, etc).
 
*Ensure all non-web data is outside the web root (logs, configuration, etc).
Line 250: Line 239:
 
||Validate role is sufficient to create, read, update, or delete data
 
||Validate role is sufficient to create, read, update, or delete data
  
||
+
||''4.4.5 Testing for bypassing authentication schema (OWASP-AT-005)''
''[https://www.owasp.org/index.php/Testing_Directory_traversal/file_include_(OTG-AUTHZ-001) Testing Directory traversal/file include (OTG-AUTHZ-001)]''
+
''4.6.1 Testing for Path Traversal (OWASP-AZ-001)''
''[https://www.owasp.org/index.php/Testing_for_Bypassing_Authorization_Schema_(OTG-AUTHZ-002) Testing for bypassing authorization schema (OTG-AUTHZ-002)]''
+
''4.6.2 Testing for bypassing authorization schema (OWASP-AZ-002)''
''[https://www.owasp.org/index.php/Testing_for_Bypassing_Authentication_Schema_(OTG-AUTHN-004) Testing for bypassing authentication schema (OTG-AUTHN-004)]''
 
  
 
|-
 
|-
|'''A8 Cross Site Request Forgery'''
+
|'''A9 Insufficient Transport Layer Protection'''
||''Pre-render:''
 
*Validate user is authenticated
 
*Validate role is sufficient for this view
 
 
 
''Render:''
 
*Send CSRF token.
 
*Set "secure" and "HttpOnly" flags for session cookies.
 
 
||
 
||
*Validate CSRF token.
+
*Use TLS 1.2 or later for all web communications.
*Validate role is sufficient to perform this action.
+
*Buy extended validation (EV) certificates for public web servers.
*Validate role is sufficient.
 
 
 
''Tip: CSRF is '''always '''possible if there is XSS, so make sure XSS is eliminated within your application.''
 
||Validate role is sufficient to create, read, update, or delete data
 
  
 +
''Tip: Use TLS 1.2 always – even internally. Most snooping is done within corporate networks – and it is as easy and unethical as fishing with dynamite.''
 
||
 
||
''[https://www.owasp.org/index.php/Testing_for_CSRF_(OTG-SESS-005) Testing for Cross Site Request Forgery (CSRF) (OTG-SESS-005)]''
+
*Mandate strong encrypted communications between web and database servers and any other servers or administrative users.
 
 
|-
 
|'''A9 Using Components with Known Vulnerabilities'''
 
 
||
 
||
 +
*Mandate strong encrypted communications with application servers and any other servers or administrative users.
  
 
+
||''4.3.1 SSL/TLS Testing (OWASP-CM-001)''
||
+
''4.4.1 Credentials transport over an encrypted channel (OWASP-AT-001)''
 
 
 
 
||
 
 
 
 
 
||
 
''[https://www.owasp.org/index.php/Enumerate_Applications_on_Webserver_(OTG-INFO-004) Enumerate Applications on Webserver (OTG-INFO-004)]''  
 
|-
 
  
 
|-
 
|-
Line 313: Line 281:
  
 
||
 
||
''[https://www.owasp.org/index.php/Testing_for_Client_Side_URL_Redirect_(OTG-CLIENT-004) Testing for Client Side URL Redirect (OTG-CLIENT-004)]''
 
  
 
|-
 
|-

Revision as of 11:21, 19 July 2015

Cheatsheets-header.jpg


This page contains out-of-date content. Please help OWASP to FixME.
Last revision (yyyy-mm-dd): 2015/07/19
Comment: The page should be updated.

Introduction

The following is a developer-centric defensive cheat sheet for the OWASP Top Ten Project. It also presents a quick reference based on OWASP Testing Project to help how to identify the risks.

OWASP Top Ten Cheat Sheet

Presentation Controller Model Testing (OWASP Testing Guide V3)
A1 Injection

Render:

  • Set a correct content type
  • Set safe character set (UTF-8)
  • Set correct locale

On Submit:

  • Enforce input field type and lengths.
  • Validate fields and provide feedback.
  • Ensure option selects and radio contain only sent values.
Canonicalize using correct character set

Positive input validation using correct character set

(NR) Negative input validation. (LR) Sanitize input.

Tip: updating a negative list (such as looking for "script", "sCrIpT", "ßCrîpt", etc) will require expensive and constant deployments and will always fail as attackers work out your list of "bad" words. Positive validation is simpler, faster and usually more secure and needs updating far less than any other validation mechanism.

*Parameterized queries
  • Object relational model (Hibernate).
  • Active Record design pattern.
  • Stored procedures.
  • Escape mechanisms such as ESAPI's Encoder:
    • EncodeForLDAP()
    • Encoder.EncodeforOS()

Tip: All SQL Injection is due to dynamic SQL queries. Strongly consider prohibiting dynamic SQL queries within your organization

4.8.5 SQL Injection (OWASP-DV-005)

4.8.6 LDAP Injection (OWASP-DV-006) 4.8.7 ORM Injection (OWASP-DV-007) 4.8.8 XML Injection (OWASP-DV-008) 4.8.9 SSI Injection (OWASP-DV-009) 4.8.10 XPath Injection (OWASP-DV-010) 4.8.11 IMAP/SMTP Injection (OWASP-DV-011) 4.8.12 Code Injection (OWASP-DV-012) 4.8.13 OS Commanding (OWASP-DV-013) 4.8.14 Buffer overflow (OWASP-DV-014)


A2 XSS

Render:

  • Set correct content type
  • Set safe character set (UTF-8)
  • Set correct locale
  • Output encode all user data as per output context
  • Set input constraints

On Submit:

  • Enforce input field type and lengths.
  • Validate fields and provide feedback.
  • Ensure option selects and radio contain only sent values.
Canonicalize using correct character set

Positive input validation using correct character set

(NR) Negative input validation (LR) Sanitize input

Tip: Only process data that is 100% trustworthy. Everything else is hostile and should be rejected.

Tip: Do not store data HTML encoded in the database. This prevents new uses for the data, such as web services, RSS feeds, FTP batches, data warehousing, cloud computing, and so on.

Tip: Use OWASP Scrubbr to clean tainted or hostile data from legacy data

4.8.1 Testing for Reflected Cross Site Scripting (OWASP-DV-001)

4.8.2 Testing for Stored Cross Site Scripting (OWASP-DV-002) 4.8.3 Testing for DOM based Cross Site Scripting (OWASP-DV-003) 4.8.4 Testing for Cross Site Flashing (OWASP-DV004)


A3 Weak authentication and session management Render:
  • Validate user is authenticated.
  • Validate role is sufficient for this view.
  • Set "secure" and "HttpOnly" flags for session cookies.
  • Send CSRF token with forms.
Design:
  • Only use inbuilt session management.
  • Store secondary SSO / framework / custom session identifiers in native session object – do not send as additional headers or cookies.
  • Validate user is authenticated.
  • Validate role is sufficient to perform this action.
  • Validate CSRF token.
Validate role is sufficient to create, read, update, or delete data

Tip: Consider the use of a "governor" to regulate the maximum number of requests per second / minute / hour that this user may perform. For example, a typical banking user should not perform more than ten transactions a minute, and one hundred per second is dangerous and should be blocked.

4.4.2 Testing for user enumeration (OWASP-AT-002)

4.4.3 Testing for Guessable (Dictionary) User Account (OWASP-AT-003) 4.4.4 Brute Force Testing (OWASP-AT-004) 4.4.6 Testing for vulnerable remember password and pwd reset (OWASP-AT-006) 4.4.5 Testing for bypassing authentication schema (OWASP-AT-005) 4.4.7 Testing for Logout and Browser Cache Management (OWASP-AT-007) 4.4.8 Testing for CAPTCHA (OWASP-AT-008) 4.4.9 Testing Multiple Factors Authentication (OWASP-AT-009) 4.4.10 Testing for Race Conditions (OWASP-AT-010) 4.5.1 Testing for Session Management Schema (OWASP-SM-001) 4.5.2 Testing for Cookies attributes (OWASP-SM-002) 4.5.3 Testing for Session Fixation (OWASP-SM_003) 4.5.4 Testing for Exposed Session Variables (OWASP-SM-004) 4.5.5 Testing for CSRF (OWASP-SM-005) 4.6.2 Testing for bypassing authorization schema (OWASP-AZ-002) 4.6.3 Testing for Privilege Escalation (OWASP-AZ-003)


A4 Insecure Direct Object Reference If data is from internal trusted sources, no data is sent.

Or

Render:

  • Send indirect random access reference map value.
Obtain data from internal, trusted sources.

Or

Obtain direct value from random access reference access map.

Validate role is sufficient to create, read, update, or delete data. 4.6.1 Testing for Path Traversal (OWASP-AZ-001)
A5 Cross Site Request Forgery Pre-render:
  • Validate user is authenticated
  • Validate role is sufficient for this view

Render:

  • Send CSRF token.
  • Set "secure" and "HttpOnly" flags for session cookies.
  • Validate CSRF token.
  • Validate role is sufficient to perform this action.
  • Validate role is sufficient.

Tip: CSRF is always possible if there is XSS, so make sure XSS is eliminated within your application.

Validate role is sufficient to create, read, update, or delete data 4.5.5 Testing for CSRF (OWASP-SM-005)
A6 Security Misconfiguration Ensure web servers and application servers are hardened.

PHP: Ensure allow_url_fopen and allow_url_include are both disabled in php.ini. Consider the use of Suhosin extension

Ensure web servers and application servers are hardened

XML: Ensure common web attacks (remote XSLT transforms, hostile XPath queries, recursive DTDs, and so on) are protected by your XML stack. Do not hand craft XML documents or queries – use the XML layer.

Ensure database servers are hardened 4.2.6 Analysis of Error Codes (OWASP-IG-006)

4.3.2 DB Listener Testing (OWASP-CM-002) 4.3.3 Infrastructure Configuration Management Testing (OWASP-CM-003) 4.3.4 Application Configuration Management Testing (OWASP-CM-004) 4.3.5 Testing for File Extensions Handling (OWASP-CM-005) 4.3.6 Old, Backup and Unreferenced Files (OWASP-CM-006) 4.3.7 Infrastructure and Application Admin Interfaces (OWASP-CM-007) 4.3.8 Testing for HTTP Methods and XST (OWASP-CM-008)


A7 Insufficient Cryptographic Storage Design:
  • Use strong ciphers (AES 128 or better).
  • Use strong hashes (SHA 256 or better) with salts for passwords.
  • Protect keys more than any other asset.

Render:

  • Do not send keys or hashes to the browser.
Design:
  • Use strong ciphers (AES 128 or better).
  • Use strong hashes (SHA 256 or better) with salts for passwords.
  • Protect keys more than any other asset.

Tip: Only certain personally identifiable information and sensitive values MUST be encrypted. Encrypt data that would be embarrassing or costly if it was leaked or stolen.

Tip: It is best to encrypt data on the application server, rather than the database server.

Design:

Tip: Do not use RDBMS database, row or table level encryption. The data can be retrieved in the clear by anyone with direct access to the server, or over the network using the application credentials. It might even traverse the network in the clear despite being "encrypted" on disk.


A8 Failure to Restrict URL access Design:
  • Ensure all non-web data is outside the web root (logs, configuration, etc).
  • Use octet byte streaming instead of providing access to real files such as PDFs or CSVs or similar.
  • Ensure every page requires a role, even if it is "guest".

Pre-render:

  • Validate user is authenticated.
  • Validate role is sufficient to view secured URL.

Render:

  • Send CSRF token.
  • Validate user is authenticated.
  • Validate role is sufficient to perform secured action.
  • Validate CSRF token.

Tip: It's impossible to control access to secured resources that the web application server does not directly serve. Therefore, PDF reports or similar should be served by the web application server using binary octet streaming.

Tip: Assume attackers will learn where "hidden" directories and "random" filenames are, so do not store these files in the web root, even if they are not directly linked.

Validate role is sufficient to create, read, update, or delete data 4.4.5 Testing for bypassing authentication schema (OWASP-AT-005)

4.6.1 Testing for Path Traversal (OWASP-AZ-001) 4.6.2 Testing for bypassing authorization schema (OWASP-AZ-002)

A9 Insufficient Transport Layer Protection
  • Use TLS 1.2 or later for all web communications.
  • Buy extended validation (EV) certificates for public web servers.

Tip: Use TLS 1.2 always – even internally. Most snooping is done within corporate networks – and it is as easy and unethical as fishing with dynamite.

  • Mandate strong encrypted communications between web and database servers and any other servers or administrative users.
  • Mandate strong encrypted communications with application servers and any other servers or administrative users.
4.3.1 SSL/TLS Testing (OWASP-CM-001)

4.4.1 Credentials transport over an encrypted channel (OWASP-AT-001)

A10 Unvalidated Redirects and Forwards
  • Design the app without URL redirection parameters.

or

Render:

  • Use random indirect object references for redirection parameters.
  • Design the app without URL redirection parameters.

or

  • Obtain direct redirection parameter from random indirect reference access map.
  • (LR) Positive validation of redirection parameter.
  • (NR) Java – Do not forward() requests as this prevents SSO access control mechanisms.
  • Validate role is sufficient to create, read, update, or delete data.

Authors and Primary Editors

Andrew van der Stock vanderaj[at]owasp.org

Ismael Rocha Gonçalves ismaelrg[at]gmail.com

Jorge Correa [email protected]

Other Cheatsheets