Security Testing Documentation
Security Testing Documentation
Try to focus on the security holes that are a real risk to your business. Try to contextualize risk in
terms of the application and its use cases.
“Tools do not make software secure! They help scale the process and help enforce policy.”
The Role of Automated Tools
Most importantly, these tools are generic - meaning that they are not designed for your custom code,
but for applications in general. That means that while they can find some generic problems, they do
not have enough knowledge of your application to allow them to detect most flaws. In my
experience, the most serious security issues are the ones that are not generic, but deeply intertwined
in your business logic and custom application design.
2. INTRODUCTION
The OWASP Testing Project
Writing the Testing Guide was challenging due to the need for consensus and content development
that allows practical application across different environments and cultures. Shifting the focus of
web application testing from penetration testing to integration within the software development life
cycle was another significant challenge.
Despite these difficulties, the project outcomes are highly satisfactory. Industry experts and security
professionals, including those from major companies, have validated the testing framework. This
framework aids organizations in testing their web applications to build reliable and secure software,
highlighting weaknesses and integrating appropriate testing techniques and technologies.
While not everyone may agree with all the decisions made, OWASP aims to influence culture
change over time through awareness and education based on consensus and experience.
What is Testing?
Testing in the Security Industry:
Often, security testing is done against a set of mental criteria that are not well-defined or complete.
This leads to the perception of security testing as a "black art."
When to test?
Current Ineffective Practices:
Testing often occurs only during the deployment phase, which is ineffective and costly.
Adopting an SDLC:
If an SDLC is not in use, organizations should adopt one to improve their development process.
Security as an Integral Part:
Companies should ensure that security is an integral part of the SDLC.
Security tests should be included to ensure comprehensive coverage and effective controls
throughout development.
What to test?
Holistic Approach to Testing:
Software development involves people, process, and technology.
Effective testing must address all three factors to ensure comprehensive coverage.
Testing only the technical aspects will miss management or operational vulnerabilities.
A holistic approach helps identify root causes of defects and eradicates bugs early.
Principles of Testing
Importance of SDLC:
Integrating security into each SDLC phase allows for a holistic approach to application security.
Each phase (define, design, develop, deploy, maintain) has specific security considerations.
Secure SDLC Frameworks:
Secure SDLC frameworks provide both descriptive (real-world usage) and prescriptive (how it
should work) advice.
Examples include BSIMM-V (descriptive) and OWASP’s OpenSAMM and ISO/IEC 27034
(prescriptive).
Scope of Security:
Projects should classify information and assets to determine required security measures.
Legal requirements must be met, varying by region (e.g., Gramm-Leach-Bliley Act in the USA,
Directive 96/46/EC in the EU).
Mindset and Understanding:
Security testing requires thinking "outside of the box" and considering an attacker's perspective.
Accurate documentation of the application’s architecture and use cases is essential.
Use of Tools:
Tools are important but should not be relied upon exclusively.
Understanding the capabilities and limitations of tools is necessary to avoid misuse.
Detailed Review:
Superficial security reviews can instill a false sense of security.
Findings must be carefully reviewed to eliminate false positives.
Developing Metrics:
Metrics help track security trends and assess the effectiveness of security measures.
Metrics should indicate training needs, understanding of security mechanisms, and the trend of
security issues.
Advantages:
No Supporting Technology Required: Can be conducted without additional tools or technology.
Versatile: Can be applied to a wide range of situations and aspects of the software development
process.
Promotes Teamwork: Encourages collaboration and communication among team members.
Early Application: Can be used early in the Software Development Life Cycle (SDLC) to catch
issues before they become ingrained.
Disadvantages:
Time-Consuming: Can require significant time and effort, particularly for large and complex
systems.
Material Availability: Supporting materials such as documentation might not always be available.
Human Skill Requirement: Requires significant human expertise and analytical skills to be
effective.
Threat Modeling
Overview:
A process to help system designers identify potential security threats and develop mitigation
strategies.
Involves decomposing the application, classifying assets, exploring vulnerabilities and threats, and
creating mitigation strategies.
Follows standards like NIST 800-30 for risk assessment.
Advantages:
Attacker's Perspective: Provides a practical view of potential security threats from an attacker’s
perspective.
Flexibility: Can be adapted to different systems and situations.
Early SDLC Integration: Can be integrated early in the SDLC to preemptively address security
concerns.
Disadvantages:
New Technique: Still a relatively new approach in the industry.
No Guarantee: A well-developed threat model doesn’t automatically result in secure software.
Penetration Testing
Overview:
A method of testing the security of a running application by simulating attacks from an outsider's
perspective, without knowing the inner workings of the application.
Often used to find and exploit vulnerabilities, providing insights into the security posture of the
application.
Advantages:
Speed: Can be conducted relatively quickly and is often less expensive than other techniques.
Lower Skill Requirement: Requires a lower skill set compared to source code review.
Real-World Testing: Tests the application in its deployed state, providing a realistic assessment of
its security.
Disadvantages:
Timing: Typically performed late in the SDLC, which can be too late to address some issues cost-
effectively.
Limited Scope: Often focuses on immediate, visible issues rather than deep, systemic
vulnerabilities.
Key Points
Each technique has its unique advantages and disadvantages, making them suitable for different
stages of the SDLC and various aspects of security testing.
A comprehensive security testing program often combines multiple techniques to ensure a thorough
assessment.
The choice of techniques should be based on the specific needs of the project, available resources,
and the stage in the development process.
This categorization helps document security requirements for various aspects, including architecture
design and secure coding standards. For instance, common coding errors in authentication controls,
such as inadequate hashing practices, can be identified and addressed through secure coding
standards and code reviews during the development phase of the Software Development Life Cycle
(SDLC).
Unit Testing: Developers should incorporate security into their unit tests to validate compliance
with secure coding standards.
Security Test Suites: Developers should build security test cases into their existing unit testing
frameworks, derived from use and misuse cases.
Static and Dynamic Analysis: Utilize tools integrated into IDEs for continuous security validation
during development.
**2. Framework and Tools:
Tools: Unit testing frameworks like Junit, Nunit, and CUnit can be adapted for security testing.
Focus Areas: Security tests at the unit level should cover input validation, access control,
encryption, session management, and error handling.
Documentation: Procedures and security test cases should be documented to guide the testing of
components, particularly for common vulnerabilities.
In summary, security testing should be integrated throughout the software development lifecycle,
from development through to system integration and user acceptance testing. Developers should use
both static and dynamic analysis tools during development, while testing engineers should perform
thorough security assessments at the system level. Effective security testing includes unit tests,
secure code reviews, penetration testing, and validation in the operational environment.
Framework Characteristics
Non-Prescriptive: The framework is designed to be adaptable, allowing organizations to tailor it to
fit their development methodology and culture.
Strategic Approach: It focuses on building a complete, end-to-end testing process that covers all
phases of development, from initial planning to maintenance, rather than only tactical or specific
areas of testing.
During Development:
Conducting static and dynamic analysis of the code.
Implementing secure coding practices.
Performing security unit tests and secure code reviews.
During Deployment:
Testing the integrated system for security vulnerabilities.
Conducting penetration testing and validating security controls in a staging environment.
Key Points
Non-Prescriptive Framework: This framework is flexible and can be adapted to fit various
development methodologies and organizational cultures.
End-to-End Security: Security is integrated at each phase of development rather than relying solely
on post-development testing, leading to better overall software security.
Early Identification: Identifying security issues early in the design and development phases is more
cost-effective and easier to address than fixing them post-deployment.
Test Objectives
Identity Requirements Alignment: Ensure that user registration identity requirements match
business and security expectations.
Registration Process Validation: Confirm the effectiveness and security of the registration process.
How to Test
Identity Requirements Validation:
• Determine if anyone can register.
• Identify if registrations are manually vetted or automatically provisioned.
• Check if the same person or identity can register multiple times.
• Assess if users can register for various roles or permissions.
• Evaluate the proof of identity required for registration.
• Verify if registered identities are authenticated.
Registration Process Validation:
• Assess if identity information can be easily forged.
• Check if identity information exchange can be manipulated during registration.
Example
WordPress: Requires only an accessible email address for registration.
Google: Requires name, date of birth, country, mobile phone number, email address, and
CAPTCHA response. Email and mobile number are verified, offering stricter identity requirements
compared to WordPress.
Tools
An HTTP proxy can be useful for testing the registration process.
Remediation
Implement identity and verification requirements that align with the security needs of the system
and the information the credentials will protect.
Test Objectives
Verify Account Provisioning: Determine which accounts or roles can provision other accounts and
the types of accounts they can provision.
How to Test
Account Provisioning:
• Identify roles with the ability to provision users.
• Evaluate the types of accounts these roles can provision.
• Verify if provisioning requests undergo any verification, vetting, and authorization.
• Assess if de-provisioning requests are similarly verified, vetted, and authorized.
Administrative Capabilities:
Remediation
Ensure that provisioning and de-provisioning processes include appropriate verification, vetting,
and authorization steps to align with security policies. Manage de-provisioned user resources
effectively to prevent unauthorized access or data loss.
Overview
This test examines whether an application’s authentication mechanism can be exploited to
gather valid usernames. This information can facilitate brute force attacks, where attackers
attempt to find passwords for known usernames. Applications often unintentionally reveal
whether a username exists through their responses to authentication attempts.
Objective
Determine if the authentication mechanism allows the collection of valid usernames by
providing different responses for valid and invalid credentials.
How to Test
Example
Invalid Username: The server might respond with “User not recognized.”
Valid Username with Wrong Password: The server might respond with “The
password is not correct.”
Analysis
If responses differ between valid and invalid usernames (e.g., different error messages or
response lengths), the application may inadvertently reveal valid usernames.
Tools
Remediation
Ensure that authentication responses do not differentiate between invalid usernames and
incorrect passwords. Provide a uniform error message for all authentication failures to
avoid leaking information about username validity.
Overview
Usernames often follow predictable patterns, making them easy to guess and potentially
exposing the application to account enumeration attacks. Attackers can exploit these
patterns along with the application’s error messages to discover valid usernames.
Test Objectives
How to Test
Remediation
Implement generic and consistent error messages for all invalid login attempts (e.g.,
"Invalid credentials") to prevent revealing the validity of usernames.
Avoid predictable naming conventions for usernames to reduce the risk of account
enumeration.