28.10.2014 Views

SQL Injection Attacks and Defense - 2009

SQL Injection Attacks and Defense - 2009

SQL Injection Attacks and Defense - 2009

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Summary<br />

Reviewing Code for <strong>SQL</strong> <strong>Injection</strong> • Chapter 3 133<br />

In this chapter, you learned how to review source code using manual static code analysis<br />

techniques to identify taint-style vulnerabilities. You will need to practice the techniques<br />

<strong>and</strong> methods you learned before you become proficient in the art of code auditing; however,<br />

these skills will help you better underst<strong>and</strong> how <strong>SQL</strong> injection vulnerabilities are still a<br />

common occurrence in code some 10 years after they were brought to the attention of the<br />

public. The tools, utilities, <strong>and</strong> products we discussed should help you put together an<br />

effective toolbox for scrutinizing source code, not only for <strong>SQL</strong> injection vulnerabilities but<br />

also for other common coding errors that can lead to exploitable vectors.<br />

To help you practice your skills, try testing them against publicly available vulnerable<br />

applications that have exploitable published security vulnerabilities, such as WebGoat.<br />

This deliberately insecure J2EE Web application maintained by the Open Web Application<br />

Security Project (OWASP) is designed to teach Web application security lessons; you can<br />

download it from www.owasp.org/index.php/Category:OWASP_WebGoat_Project.<br />

In addition, you can try Hacme Bank, which simulates a real-world Web services-enabled<br />

online banking application built with a number of known <strong>and</strong> common vulnerabilities;<br />

you can download Hacme Bank from www.foundstone.com/us/resources/termsofuse.<br />

asp?file=hacmebank2_source.zip. You can also try obtaining vulnerable versions of Free<br />

<strong>and</strong> Open Source Software (FOSS); the Damn Vulnerable Linux Live CD contains an ample<br />

set of these, <strong>and</strong> you can download the CD from www.damnvulnerablelinux.org.<br />

Try as many of the automated tools listed in this chapter as you can until you find a tool<br />

that works for you. Don’t be afraid to get in touch with the developers <strong>and</strong> provide them<br />

constructive feedback with regard to how you think the tools could be improved, or to<br />

highlight a condition that reduces its effectiveness. I have found them to be receptive <strong>and</strong><br />

committed to improving their tools. Happy hunting!<br />

Solutions Fast Track<br />

Reviewing Source Code for <strong>SQL</strong> <strong>Injection</strong><br />

˛˛ There are two main methods of analyzing source code for vulnerabilities: static<br />

code analysis <strong>and</strong> dynamic code analysis. Static code analysis, in the context of Web<br />

application security, is the process of analyzing source code without actually executing<br />

the code. Dynamic code analysis is the analysis of code performed at runtime.<br />

˛˛ Tainted data is data that has been received from an untrusted source (sink source),<br />

whether it is a Web form, cookie, or input parameter. Tainted data can potentially<br />

cause security problems at vulnerable points in a program (sinks). A sink is a<br />

security-sensitive function (e.g., a function that executes <strong>SQL</strong> statements).

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

Saved successfully!

Ooh no, something went wrong!