As the number of Web application vulnerabilities continues to skyrocket, developers are beginning to take security more seriously. In this week's column, Jason Schmitt explains that most developers still are not equipped with the time, tools, or training needed to reliably develop secure Web applications. Yet Jason believes that utilizing hybrid analysis tools can help developers release more secure products.
To increase the reliability of security testing results, developers are finding that security testing should be a combination of analysis techniques-utilizing source code analysis information to direct a second, more practical approach called dynamic analysis. This enables developers to identify vulnerabilities more accurately and confidently than with either technique individually. This combination approach, known as hybrid analysis, produces the accurate and reliable security information that developers need to assess the security of their code.
The Guessing Game
Source code analysis products use a technique called variable tracing. Developers use these tools to inject test data into the application to study the software's potential values and behaviors through the call graphs that represent data flows through the application. By injecting test data this way, the source code analysis product infers what behavior may occur for a certain scenario and variable value–some refer to this technology as an inference engine.
The danger of this approach is that it produces inferences, or guesses, as to how the system might behave during run-time and production configuration conditions. Source code analysis can only determine possible security vulnerabilities in the application, which usually results in high false positive rates.
Trusting inferred results of such an analysis is analogous to trusting that an application will function according to design when it compiles cleanly. If all code is syntactically and semantically correct, then it will compile. But do you have confidence that it will meet the functional requirements simply because it compiled? Similarly, developers who rely on source code analysis to infer security problems in the application must also perform additional security testing in order to validate the application's real run-time behavior with respect to the potential vulnerabilities.
Also known as automated penetration or fuzz testing, dynamic analysis occurs when a security tool actively attacks the running application based on thousands of known vulnerabilities and attack patterns. A dynamic analysis tool executes thousands of hack attempts on the application in a matter of minutes, just as a hacker would over days or weeks.
The danger of taking only the dynamic analysis approach is that it can be less thorough than source code analysis because it does not have access to or detailed knowledge of the application source code. Dynamic analysis tools crawl an application like a Web spider to discover all of its pages and files and then use this site map to direct automated hack attempts. If the tool is unable to "guess" where some pages or files are located, or is blocked by complex authentication or session management, then it would not be able to effectively attack and assess the security of those hidden resources. The developer can then end up with a false sense of security.
A Three-way Match
Consider the example of a cross-site scripting vulnerability whereby an attacker is able to embed malicious code into an application and trick a user into executing the code on their own machine. A source code analysis product might be able to identify the potential of a cross-site scripting vulnerability by finding un-validated inputs or poor session handling--if the particular language and compiler is supported. This information is useful to a developer when pinpointing potential problems. But efforts can be misdirected or wasted when developers spend time fixing a potential vulnerability that in reality is not even exploitable in the application.
A hybrid analysis tool, which will know about the cross-site scripting possibility from an analysis of the source code, will target this potential vulnerability during the dynamic analysis phase. The tool can accurately determine whether the page is exploitable by attempting to hack it.