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.

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

paper “HackProofing My<strong>SQL</strong>,” NGS Software’s Chris Anley documented how to create<br />

a UDF to effectively create a My<strong>SQL</strong> xp_cmdshell equivalent. Essentially, adding a UDF<br />

(according to the My<strong>SQL</strong> manual) requires simply that your UDF is compiled as an object<br />

file which is then added <strong>and</strong> removed from the server using the CREATE FUNCTION<br />

<strong>and</strong> DROP FUNCTION statements.<br />

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

You can use the aforementioned scripting.filesystem object method of reading files just as<br />

effectively to write files to the file system. Anley’s paper again demonstrates the method<br />

shown in Figure 6.17.<br />

Figure 6.17 Writing to the File System Using sp_oacreate<br />

Although we used this technique for writing binary files too, it is reported that some<br />

code pages may have errors with this technique. In such cases, you can use an object other<br />

than the filesystemobject, such as ADODB.Stream.

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

Saved successfully!

Ooh no, something went wrong!