19.08.2015 Views

4.0

1IZ1TDd

1IZ1TDd

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

20Testing Guide Introductionassessment is not required (such as for auditing purposes).Since these tests are the last resort for fixing vulnerabilities beforethe application is released to production, it is important thatsuch issues are addressed as recommended by the testing team.The recommendations can include code, design, or configurationchange. At this level, security auditors and information security officersdiscuss the reported security issues and analyze the potentialrisks according to information risk management procedures. Suchprocedures might require the development team to fix all high riskvulnerabilities before the application can be deployed, unless suchrisks are acknowledged and accepted.Developers’ Security TestsSecurity Testing in the Coding Phase: Unit TestsFrom the developer’s perspective, the main objective of securitytests is to validate that code is being developed in compliance withsecure coding standards requirements. Developers’ own codingartifacts (such as functions, methods, classes, APIs, and libraries)need to be functionally validated before being integrated into theapplication build.The security requirements that developers have to follow should bedocumented in secure coding standards and validated with staticand dynamic analysis. If the unit test activity follows a secure codereview, unit tests can validate that code changes required by securecode reviews are properly implemented. Secure code reviewsand source code analysis through source code analysis tools helpdevelopers in identifying security issues in source code as it is developed.By using unit tests and dynamic analysis (e.g., debugging)developers can validate the security functionality of components aswell as verify that the countermeasures being developed mitigateany security risks previously identified through threat modeling andsource code analysis.A good practice for developers is to build security test cases as ageneric security test suite that is part of the existing unit testingframework. A generic security test suite could be derived from previouslydefined use and misuse cases to security test functions,methods and classes. A generic security test suite might includesecurity test cases to validate both positive and negative requirementsfor security controls such as:• Identity, Authentication & Access Control• Input Validation & Encoding• Encryption• User and Session Management• Error and Exception Handling• Auditing and LoggingDevelopers empowered with a source code analysis tool integratedinto their IDE, secure coding standards, and a security unit testingframework can assess and verify the security of the software componentsbeing developed. Security test cases can be run to identifypotential security issues that have root causes in source code: besidesinput and output validation of parameters entering and exitingthe components, these issues include authentication and authorizationchecks done by the component, protection of the data withinthe component, secure exception and error handling, and secureauditing and logging. Unit test frameworks such as Junit, Nunit,and CUnit can be adapted to verify security test requirements. Inthe case of security functional tests, unit level tests can test thefunctionality of security controls at the software component level,such as functions, methods, or classes. For example, a test casecould validate input and output validation (e.g., variable sanitation)and boundary checks for variables by asserting the expected functionalityof the component.The threat scenarios identified with use and misuse cases can beused to document the procedures for testing software components.In the case of authentication components, for example, securityunit tests can assert the functionality of setting an accountlockout as well as the fact that user input parameters cannot beabused to bypass the account lockout (e.g., by setting the accountlockout counter to a negative number).At the component level, security unit tests can validate positive assertionsas well as negative assertions, such as errors and exceptionhandling. Exceptions should be caught without leaving the systemin an insecure state, such as potential denial of service causedby resources not being de-allocated (e.g., connection handles notclosed within a final statement block), as well as potential elevationof privileges (e.g., higher privileges acquired before the exception isthrown and not re-set to the previous level before exiting the function).Secure error handling can validate potential information disclosurevia informative error messages and stack traces.Unit level security test cases can be developed by a security engineerwho is the subject matter expert in software security and isalso responsible for validating that the security issues in the sourcecode have been fixed and can be checked into the integrated systembuild. Typically, the manager of the application builds also makessure that third-party libraries and executable files are security assessedfor potential vulnerabilities before being integrated in theapplication build.Threat scenarios for common vulnerabilities that have root causesin insecure coding can also be documented in the developer’s securitytesting guide. When a fix is implemented for a coding defectidentified with source code analysis, for example, security test casescan verify that the implementation of the code change followsthe secure coding requirements documented in the secure codingstandards.Source code analysis and unit tests can validate that the codechange mitigates the vulnerability exposed by the previously identifiedcoding defect. The results of automated secure code analysiscan also be used as automatic check-in gates for version control, forexample software artifacts cannot be checked into the build withhigh or medium severity coding issues.Functional Testers’ Security TestsSecurity Testing During the Integration and Validation Phase:Integrated System Tests and Operation TestsThe main objective of integrated system tests is to validate the “defensein depth” concept, that is, that the implementation of securitycontrols provides security at different layers. For example, thelack of input validation when calling a component integrated withthe application is often a factor that can be tested with integrationtesting.The integration system test environment is also the first environ-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!