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.

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

encrypted e-mail, to provide this file to trusted partners who may need this information to<br />

communicate with the Web service.<br />

Increase the Verbosity of Web Server Logs<br />

Web server log files can provide some insight into potential <strong>SQL</strong> injection attacks, especially<br />

when application logging mechanisms are below par. If the vulnerability is in a URL parameter,<br />

you are lucky as Apache <strong>and</strong> IIS log this information by default. If you’re defending a Web<br />

application that has poor logging facilities, consider also configuring your Web server to log<br />

the Referer <strong>and</strong> Cookie headers. This will increase the size of the log file, but provides<br />

potential security benefits with insight into Cookie <strong>and</strong> Referer headers, which are another<br />

potential location for <strong>SQL</strong> injection vulnerabilities to materialize. Both Apache <strong>and</strong> IIS<br />

require the installation of addition modules to log POST data. Refer to “Using Runtime<br />

Protection” for techniques <strong>and</strong> solutions to add monitoring <strong>and</strong> intrusion detection facilities<br />

to your Web application.<br />

Deploy the Web <strong>and</strong><br />

Database Servers on Separate Hosts<br />

You should avoid running the Web <strong>and</strong> database server software on the same host.<br />

This significantly increases the attack surface of the Web application <strong>and</strong> may expose the<br />

database server software to attacks that previously were not possible given access to the Web<br />

front end only. For example, the Oracle XML Database (XDB) exposes an HTTP server<br />

service on Transmission Control Protocol (TCP) port 8080. This is now an additional entry<br />

point for probing <strong>and</strong> potential injection. Additionally, the attacker could leverage this<br />

deployment scenario to write query results to a file in a Web-accessible directory <strong>and</strong> view<br />

the results in the Web browser.<br />

Configure Network Access Control<br />

In networks that are properly layered, database servers are typically located on internal<br />

trusted networks. Usually this segregation is beneficial to thwart network-based attacks;<br />

however, this trusted network can be breached via an <strong>SQL</strong> injection vulnerability in an<br />

Internet-facing Web site. With direct access to the database server, the attacker can attempt<br />

to connect to other systems on the same network. Most database server platforms offer one<br />

or more ways for initiating network connections. Given this, consider implementing network<br />

access control that restricts connections to other systems on the internal network. You can<br />

do this at the network layer with firewall <strong>and</strong> router ACLs or by using a host-level mechanism<br />

such as IPSec. Additionally, ensure that proper network access controls are in place to prevent<br />

outbound network connections. This can be leveraged by an attacker to tunnel database<br />

results via an alternative protocol such as DNS or the database server’s own network protocol.

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

Saved successfully!

Ooh no, something went wrong!