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.

Figure 5.13 Extracting Database Login Using B<strong>SQL</strong> Hacker<br />

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

<strong>SQL</strong>Brute<br />

Attackers who are comfortable with the fundamentals behind inference attacks use the<br />

<strong>SQL</strong>Brute comm<strong>and</strong>-line tool due to its lightweight nature <strong>and</strong> straightforward syntax.<br />

■■<br />

■■<br />

■■<br />

■■<br />

■■<br />

URL: www.gdssecurity.com/l/t.php<br />

Requirements: Python (Windows/Linux/Mac)<br />

Scenarios: Generic error page, controlled output; generic error page, uncontrolled<br />

output; completely blind, no errors<br />

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

Methods: Inference time-based binary search; inference response-based modified<br />

binary search<br />

<strong>SQL</strong>Brute relies only on a Python interpreter, <strong>and</strong> at 31 KB it is tiny compared to the<br />

other tools examined. This makes it ideal for focused injection scenarios or where file size is<br />

important, <strong>and</strong> its thread support boosts speed. A drawback is that it uses a fixed alphabet from<br />

which inference tests are drawn; if a byte in the data is not contained within the alphabet it<br />

cannot be retrieved, which limits the tool to text-based data.<br />

To run the tool, you will need the full path to the vulnerable page along with any data<br />

that must be submitted (either GET or POST parameters). If you’re using the response-based<br />

mode, you must supply a regular expression in the --error argument that indicates when the<br />

inference question returns false; otherwise, the timing-based mode is available. In the example<br />

depicted in Figure 5.14, <strong>SQL</strong>Brute has been run in response-based mode against a vulnerable<br />

<strong>SQL</strong> server, <strong>and</strong> two table names have been extracted from the database. Based on our<br />

exploration, we know that when an inference question returns FALSE, the page contains<br />

“Review count :0”, but this could also be a regular expression instead of a fixed string if<br />

needed. After execution commences, the tool performs a little bit of fingerprinting <strong>and</strong> starts<br />

to extract data <strong>and</strong> print it to the screen.

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

Saved successfully!

Ooh no, something went wrong!