Testing Guide 4 - OWASP

Transcription

1Testing Guide 4.0Project Leaders: Matteo Meucci and Andrew MullerCreative Commons (CC) Attribution Share-AlikeFree version at http://www.owasp.org

2THE ICONS BELOW REPRESENT WHATOTHER VERSIONS ARE AVAILABLE IN PRINTFOR THIS BOOK TITLE.ALPHA: “Alpha Quality” book content is aworking draft. Content is very rough and indevelopment until the next level of publishing.BETA: “Beta Quality” book content is the nexthighest level. Content is still in developmentuntil the next publishing.RELEASE: “Release Quality” book contentis the highest level of quality in a book title’slifecycle, and is a final product.YOU ARE FREE:To Share - to copy, distribute andtransmit the workTo Remix - to adapt the workUNDER THE FOLLOWING CONDITIONS:Attribution. You must attribute the workin the manner specified by the author orlicensor (but not in any way that suggeststhat they endorse you or your use of thework).Share Alike. If you alter, transform, orbuild upon this work, you may distributethe resulting work only under the same,similar or a compatible license.ALPHABETARELEASEThe Open Web Application Security Project (OWASP) is a worldwide free and open community focused on improving the security of application software. Our mission is to makeapplication security “visible”, so that people and organizations can make informed decisionsabout application security risks. Every one is free to participate in OWASP and all of ourmaterials are available under a free and open software license. The OWASP Foundationis a 501c3 not-for-profit charitable organization that ensures the ongoing availability andsupport for our work.

Testing Guide Foreword - Table of contents3-45-60Foreword by Eoin Keary1FrontispieceAbout the OWASP Testing Guide ProjectAbout The Open Web Application Security Project7 - 212IntroductionThe OWASP Testing ProjectPrinciples of TestingTesting Techniques ExplainedDeriving Security Test RequirementsSecurity Tests Integrated in Development and Testing WorkflowsSecurity Test Data Analysis and Reporting22 - 243The OWASP Testing FrameworkOverviewPhase 1: Before Development BeginsPhase 2: During Definition and DesignPhase 3: During DevelopmentPhase 4: During DeploymentPhase 5: Maintenance and OperationsA Typical SDLC Testing Workflow25 - 2074Web Application Security TestingIntroduction and ObjectivesTesting ChecklistInformation GatheringConduct Search Engine Discovery and Reconnaissance for Information Leakage (OTG-INFO-001)Fingerprint Web Server (OTG-INFO-002)Review Webserver Metafiles for Information Leakage (OTG-INFO-003)Enumerate Applications on Webserver (OTG-INFO-004)Review Webpage Comments and Metadata for Information Leakage (OTG-INFO-005)Identify application entry points (OTG-INFO-006)Map execution paths through application (OTG-INFO-007)Fingerprint Web Application Framework (OTG-INFO-008)Fingerprint Web Application (OTG-INFO-009)Map Application Architecture (OTG-INFO-010)Configuration and Deployment Management TestingTest Network/Infrastructure Configuration (OTG-CONFIG-001)Test Application Platform Configuration (OTG-CONFIG-002)

Testing Guide Foreword - Table of contentsTest File Extensions Handling for Sensitive Information (OTG-CONFIG-003)Review Old, Backup and Unreferenced Files for Sensitive Information (OTG-CONFIG-004)Enumerate Infrastructure and Application Admin Interfaces (OTG-CONFIG-005)Test HTTP Methods (OTG-CONFIG-006)Test HTTP Strict Transport Security (OTG-CONFIG-007)Test RIA cross domain policy (OTG-CONFIG-008)Identity Management TestingTest Role Definitions (OTG-IDENT-001)Test User Registration Process (OTG-IDENT-002)Test Account Provisioning Process (OTG-IDENT-003)Testing for Account Enumeration and Guessable User Account (OTG-IDENT-004)Testing for Weak or unenforced username policy (OTG-IDENT-005)Authentication TestingTesting for Credentials Transported over an Encrypted Channel (OTG-AUTHN-001)Testing for default credentials (OTG-AUTHN-002)Testing for Weak lock out mechanism (OTG-AUTHN-003)Testing for bypassing authentication schema (OTG-AUTHN-004)Test remember password functionality (OTG-AUTHN-005)Testing for Browser cache weakness (OTG-AUTHN-006)Testing for Weak password policy (OTG-AUTHN-007)Testing for Weak security question/answer (OTG-AUTHN-008)Testing for weak password change or reset functionalities (OTG-AUTHN-009)Testing for Weaker authentication in alternative channel (OTG-AUTHN-010)Authorization TestingTesting Directory traversal/file include (OTG-AUTHZ-001)Testing for bypassing authorization schema (OTG-AUTHZ-002)Testing for Privilege Escalation (OTG-AUTHZ-003)Testing for Insecure Direct Object References (OTG-AUTHZ-004)Session Management TestingTesting for Bypassing Session Management Schema (OTG-SESS-001)Testing for Cookies attributes (OTG-SESS-002)Testing for Session Fixation (OTG-SESS-003)Testing for Exposed Session Variables (OTG-SESS-004)Testing for Cross Site Request Forgery (CSRF) (OTG-SESS-005)Testing for logout functionality (OTG-SESS-006)Test Session Timeout (OTG-SESS-007)Testing for Session puzzling (OTG-SESS-008)Input Validation TestingTesting for Reflected Cross Site Scripting (OTG-INPVAL-001)Testing for Stored Cross Site Scripting (OTG-INPVAL-002)Testing for HTTP Verb Tampering (OTG-INPVAL-003)Testing for HTTP Parameter pollution (OTG-INPVAL-004)Testing for SQL Injection (OTG-INPVAL-005)Oracle TestingMySQL TestingSQL Server TestingTesting PostgreSQL (from OWASP BSP)MS Access Testing

3Testing Guide Foreword - Table of contentsTesting for NoSQL injectionTesting for LDAP Injection (OTG-INPVAL-006)Testing for ORM Injection (OTG-INPVAL-007)Testing for XML Injection (OTG-INPVAL-008)Testing for SSI Injection (OTG-INPVAL-009)Testing for XPath Injection (OTG-INPVAL-010)IMAP/SMTP Injection (OTG-INPVAL-011)Testing for Code Injection (OTG-INPVAL-012)Testing for Local File InclusionTesting for Remote File InclusionTesting for Command Injection (OTG-INPVAL-013)Testing for Buffer overflow (OTG-INPVAL-014)Testing for Heap overflowTesting for Stack overflowTesting for Format stringTesting for incubated vulnerabilities (OTG-INPVAL-015)Testing for HTTP Splitting/Smuggling (OTG-INPVAL-016)Testing for Error HandlingAnalysis of Error Codes (OTG-ERR-001)Analysis of Stack Traces (OTG-ERR-002)Testing for weak CryptographyTesting for Weak SSL/TLS Ciphers, Insufficient Transport Layer Protection (OTG-CRYPST-001)Testing for Padding Oracle (OTG-CRYPST-002)Testing for Sensitive information sent via unencrypted channels (OTG-CRYPST-003)Business Logic TestingTest Business Logic Data Validation (OTG-BUSLOGIC-001)Test Ability to Forge Requests (OTG-BUSLOGIC-002)Test Integrity Checks (OTG-BUSLOGIC-003)Test for Process Timing (OTG-BUSLOGIC-004)Test Number of Times a Function Can be Used Limits (OTG-BUSLOGIC-005)Testing for the Circumvention of Work Flows (OTG-BUSLOGIC-006)Test Defenses Against Application Mis-use (OTG-BUSLOGIC-007)Test Upload of Unexpected File Types (OTG-BUSLOGIC-008)Test Upload of Malicious Files (OTG-BUSLOGIC-009)Client Side TestingTesting for DOM based Cross Site Scripting (OTG-CLIENT-001)Testing for JavaScript Execution (OTG-CLIENT-002)Testing for HTML Injection (OTG-CLIENT-003)Testing for Client Side URL Redirect (OTG-CLIENT-004)Testing for CSS Injection (OTG-CLIENT-005)Testing for Client Side Resource Manipulation (OTG-CLIENT-006)Test Cross Origin Resource Sharing (OTG-CLIENT-007)Testing for Cross Site Flashing (OTG-CLIENT-008)Testing for Clickjacking (OTG-CLIENT-009)Testing WebSockets (OTG-CLIENT-010)Test Web Messaging (OTG-CLIENT-011)Test Local Storage (OTG-CLIENT-012)

4Testing Guide Foreword - Table of contents208 - 2225ReportingAppendix A: Testing ToolsBlack Box Testing ToolsAppendix B: Suggested ReadingWhitepapersBooksUseful WebsitesAppendix C: Fuzz VectorsFuzz CategoriesAppendix D: Encoded InjectionInput EncodingOutput Encoding

5Testing Guide Foreword - By Eoin Keary0Testing Guide ForewordThe problem of insecure software is perhaps themost important technical challenge of our time. Thedramatic rise of web applications enabling business,social networking etc has only compounded therequirements to establish a robust approach to writingand securing our Internet, Web Applications and Data.Foreword by Eoin Keary, OWASP Global BoardThe problem of insecure software is perhaps the most importanttechnical challenge of our time. The dramatic rise of web applications enabling business, social networking etc has only compounded the requirements to establish a robust approach to writing and securing our Internet, Web Applications and Data.At The Open Web Application Security Project (OWASP), we’retrying to make the world a place where insecure software is theanomaly, not the norm. The OWASP Testing Guide has an important role to play in solving this serious issue. It is vitally importantthat our approach to testing software for security issues is basedon the principles of engineering and science. We need a consistent, repeatable and defined approach to testing web applications.A world without some minimal standards in terms of engineeringand technology is a world in chaos.It goes without saying that you can’t build a secure applicationwithout performing security testing on it. Testing is part of a widerapproach to building a secure system. Many software development organizations do not include security testing as part of theirstandard software development process. What is even worse isthat many security vendors deliver testing with varying degreesof quality and rigor.Security testing, by itself, isn’t a particularly good stand alonemeasure of how secure an application is, because there are an infinite number of ways that an attacker might be able to make anapplication break, and it simply isn’t possible to test them all. Wecan’t hack ourselves secure and we only have a limited time to testand defend where an attacker does not have such constraints.In conjunction with other OWASP projects such as the Code reviewGuide, the Development Guide and tools such as OWASP ZAP, thisis a great start towards building and maintaining secure applications. The Development Guide will show your project how to architect and build a secure application, the Code Review Guide will tellyou how to verify the security of your application’s source code,and this Testing Guide will show you how to verify the security ofyour running application. I highly recommend using these guidesas part of your application security initiatives.Why OWASP?Creating a guide like this is a huge undertaking, requiring the expertise of hundreds of people around the world. There are manydifferent ways to test for security flaws and this guide capturesthe consensus of the leading experts on how to perform this testing quickly, accurately, and efficiently. OWASP gives like mindedsecurity folks the ability to work together and form a leading practice approach to a security problem.The importance of having this guide available in a completely freeand open way is important for the foundations mission. It givesanyone the ability to understand the techniques used to test forcommon security issues. Security should not be a black art orclosed secret that only a few can practice. It should be open to alland not exclusive to security practitioners but also QA, Developers

6Testing Guide Foreword - By Eoin Kearyand Technical Managers. The project to build this guide keeps thisexpertise in the hands of the people who need it - you, me andanyone that is involved in building software.This guide must make its way into the hands of developers andsoftware testers. There are not nearly enough application securityexperts in the world to make any significant dent in the overallproblem. The initial responsibility for application security mustfall on the shoulders of the developers, they write the code. Itshouldn’t be a surprise that developers aren’t producing securecode if they’re not testing for it or consider the types of bugswhich introduce vulnerability.Keeping this information up to date is a critical aspect of this guideproject. By adopting the wiki approach, the OWASP communitycan evolve and expand the information in this guide to keep pacewith the fast moving application security threat landscape.This Guide is a great testament to the passion and energy ourmembers and project volunteers have for this subject. It shall certainly help change the world a line of code at a time.Tailoring and PrioritizingYou should adopt this guide in your organization. You may need totailor the information to match your organization’s technologies,processes, and organizational structure.In general there are several different roles within organizationsthat may use this guide: Developers should use this guide to ensure that they are producing secure code. These tests should be a part of normal code andunit testing procedures. Software testers and QA should use this guide to expand the setof test cases they apply to applications. Catching these vulnerabilities early saves considerable time and effort later. Security specialists should use this guide in combination withother techniques as one way to verify that no security holes havebeen missed in an application. Project Managers should consider the reason this guide existsand that security issues are manifested via bugs in code and design.The most important thing to remember when performing securitytesting is to continuously re-prioritize. There are an infinite number of possible ways that an application could fail, and organizations always have limited testing time and resources. Be sure timeand resources are spent wisely. Try to focus on the security holesthat are a real risk to your business. Try to contextualize risk interms of the application and its use cases.This guide is best viewed as a set of techniques that you can useto find different types of security holes. But not all the techniquesare equally important. Try to avoid using the guide as a checklist,new vulnerabilities are always manifesting and no guide can b

MS Access Testing. 3 Testing Guide Foreword - Table of contents Testing for NoSQL injection Testing for LDAP Injection (OTG-INPVAL-006) Testing for ORM Injection (OTG-INPVAL-007) Testing for XML Injection (OTG-INPVAL-008) Testing for SSI Injection (OTG-INPVAL-009) Testing for XPath Injection (OTG-INPVAL-010) IMAP/SMTP Injection (OTG-INPVAL-011) Testing for Code Injection (OTG