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.

Blind <strong>SQL</strong> <strong>Injection</strong> Exploitation • Chapter 5 259<br />

■■<br />

■■<br />

■■<br />

■■<br />

■■<br />

URL: www.0x90.org/releases/absinthe/<br />

Requirements: Windows/Linux/Mac (.NET Framework or Mono)<br />

Scenario: Generic error page, controlled output<br />

Supported databases: Oracle, Postgre<strong>SQL</strong>, <strong>SQL</strong> Server, <strong>and</strong> Sybase<br />

Methods: Inference response-based binary search; classic errors<br />

Absinthe provides a h<strong>and</strong>y GUI that enables an attacker to extract the full contents of<br />

a database; in addition, it contains enough configuration options to satisfy most injection<br />

scenarios <strong>and</strong> can utilize both classic error methods <strong>and</strong> response-based inference methods<br />

for data extraction. The response string that differentiates between two inference states<br />

must be easy for Absinthe to identify. One drawback to the tool is that the user cannot<br />

provide a customized signature for TRUE or FALSE states. Instead, the tool attempts to<br />

perform a diff on a TRUE <strong>and</strong> FALSE request, <strong>and</strong> this causes the tool to fail in cases<br />

where the page includes other data not influenced by the inference question. One example<br />

is in search pages that echo the search string back in the response. If two separate but<br />

equivalent inference exploits are provided, the two responses will each contain a unique<br />

search string rendering the diff meaningless. There is a tolerance you can fiddle with, but<br />

this is not as efficient as providing signatures.<br />

Figure 5.11 shows the main Absinthe screen. First, you select the injection type, either<br />

Blind <strong>Injection</strong> or Error Based, <strong>and</strong> then choose the database from a list of supported<br />

plug-ins. Enter the Target URL along with whether the request is formatted as a POST or<br />

a GET. Finally, enter in the Name textbox each parameter that should be contained in the<br />

request, along with a Default Value. If the parameter is susceptible to <strong>SQL</strong> injection, select<br />

the Injectable Parameter check box; also, select the Treat Value as String check box if<br />

the parameter is of type string in the <strong>SQL</strong> query. Do not forget to add in all parameters<br />

needed for the vulnerable page to process the request; this includes hidden fields such as<br />

__VIEWSTATE on .NET pages.<br />

Once the configuration is complete, click Initialize <strong>Injection</strong>. This sends a bunch of<br />

test requests to determine the response difference on which the inference will be based.<br />

If no errors are reported, click the DB Schema tab, which displays two active buttons:<br />

Retrieve Username <strong>and</strong> Load Table Info. The first button will retrieve <strong>and</strong> display the<br />

database login used by the vulnerable page <strong>and</strong> the second button will retrieve a list of userdefined<br />

tables from the current database. Once table information has been loaded, click a<br />

table name in the tree view of database objects <strong>and</strong> then click Load Field Info, which will<br />

retrieve a list of all column names in the selected table. As soon as that has completed, click<br />

the Download Records tab, provide an output filename in the Filename textbox, select<br />

the columns you wish to retrieve by clicking the column name <strong>and</strong> then clicking Add,<br />

<strong>and</strong> finally click Download Fields to XML. This will dump the selected columns to the<br />

output file, producing an XML document containing all rows from the selected columns in<br />

the target table.

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

Saved successfully!

Ooh no, something went wrong!