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

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

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

378 Chapter 9 • Platform-Level <strong>Defense</strong>s<br />

Introduction<br />

In Chapter 8, we discussed practices <strong>and</strong> defenses that you can employ at the code level<br />

to prevent <strong>SQL</strong> injection. In this chapter, we’ll shift our focus to platform-level defenses<br />

that detect, mitigate, <strong>and</strong> prevent <strong>SQL</strong> injection. A platform-level defense is any runtime<br />

enhancement or configuration change that can be made to increase the application’s<br />

overall security. The scope of protection we’ll cover in this chapter varies; however, as a<br />

whole the techniques we’ll discuss can help you to achieve a multilayered security<br />

architecture.<br />

First we’ll examine runtime protection technologies <strong>and</strong> techniques, such as Web server<br />

plug-ins <strong>and</strong> leveraging application framework features. We’ll follow this with strategies for<br />

securing the data in the database, as well as the database itself, to help reduce the impact<br />

of exploitable <strong>SQL</strong> injection vulnerabilities. Lastly, we’ll look at what you can do at the<br />

infrastructure level to reduce the threat.<br />

It is important to remember that the solutions discussed in this chapter are not a<br />

substitute for writing secure code, but are complementary. A hardened database does not<br />

stop <strong>SQL</strong> injection, but makes it significantly more difficult to exploit. A security filter<br />

can serve as a virtual patch between vulnerability detection <strong>and</strong> code correction as well<br />

as a formidable defense against zero-day threats, such as the “uc8010” automated <strong>SQL</strong><br />

injection attack that infected well over 100,000 Web sites in a few days. Platform-level<br />

security is an important component to the overall security strategy for both existing <strong>and</strong><br />

new applications.<br />

Using Runtime Protection<br />

In this section, we’ll consider runtime protection to be any security solution that you can<br />

use to detect, mitigate, or prevent <strong>SQL</strong> injection that is deployable without recompiling<br />

the vulnerable application’s source code. The solutions covered here are primarily software<br />

plug-ins for Web servers <strong>and</strong> development frameworks (e.g., the .NET Framework, J2EE,<br />

PHP, etc.) or techniques for leveraging/extending features of the Web or application<br />

platform. Most of the software solutions we’ll discuss are free <strong>and</strong> are available for download<br />

on the Internet. We will not cover commercial products, although some may implement<br />

one or more of the strategies <strong>and</strong> techniques discussed here.<br />

Runtime protection is a valuable tool for mitigating <strong>and</strong> preventing exploitation of known<br />

<strong>SQL</strong> injection vulnerabilities. Fixing the vulnerable source code is always the ideal solution;<br />

however, the development effort required is not always feasible, practical, cost-effective, or<br />

unfortunately a high priority. Commercial off-the-shelf (COTS) applications are often<br />

purchased in compiled format, which eliminates the possibility of fixing the code. Even if<br />

uncompiled code is available for a COTS application, customizations may violate support<br />

contracts <strong>and</strong>/or prevent the software vendor from providing updates according to its normal

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

Saved successfully!

Ooh no, something went wrong!