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.

Summary<br />

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

Underst<strong>and</strong>ing <strong>and</strong> exploiting blind <strong>SQL</strong> injection is what separates regular attackers from<br />

the pros. In the face of a defense as trivial as disabling verbose error messages, most script<br />

kiddies move on to the next target. However, blind <strong>SQL</strong> injection vulnerabilities provide<br />

just as much possible ownage through a range of techniques that allow the attacker to<br />

utilize timing, responses, <strong>and</strong> alternative channels such as DNS to extract the data. By asking<br />

a simple question in the shape of an <strong>SQL</strong> query that returns either TRUE or FALSE <strong>and</strong><br />

repeating thous<strong>and</strong>s of times, the keys to the database kingdom are ours.<br />

Blind <strong>SQL</strong> injection vulnerabilities are often missed because they hide in the shadows.<br />

Once you have discovered the vulnerabilities, a range of possible exploits are at your fingertips.<br />

Know when to choose response-based exploits as opposed to timing exploits <strong>and</strong> when to<br />

haul out the heavyweight alternative channel tools; this fine-grained knowledge will save<br />

you time. Given how highly prone to automation most blind <strong>SQL</strong> injection vulnerabilities<br />

are, a wide variety of tools are available for both the novice <strong>and</strong> expert covering graphical as<br />

well as comm<strong>and</strong>-line tools with a wide spectrum of supported databases.<br />

With the basics of <strong>SQL</strong> injection <strong>and</strong> blind <strong>SQL</strong> injection behind you, it is time to<br />

move on to the business of further exploitation: What happens once a comfortable injection<br />

point is identified <strong>and</strong> exploited? Can you move on to exploiting the underlying operating<br />

system? Find out in Chapter 6!<br />

Solutions Fast Track<br />

Finding <strong>and</strong> Confirming Blind <strong>SQL</strong> <strong>Injection</strong><br />

˛˛ Invalid data returns a generic error message rather than a verbose error, so you can<br />

confirm <strong>SQL</strong> injection by inducing side effects such as a timed delay. You can also<br />

split <strong>and</strong> balance a parameter; if a numeric field contains 5, submit 2 + 3 or 6 – 1;<br />

if a string parameter contains “MadBob” submit ‘Mad’||‘Bob’.<br />

˛˛ Consider the attribute of the vulnerability: Can any errors be forced, <strong>and</strong> is any of<br />

the content on a non-error page controllable?<br />

˛˛ You can infer a single bit of information by asking in <strong>SQL</strong> whether the bit is 1 or<br />

0. A number of inference techniques accomplish this.<br />

Using Time-Based Techniques<br />

˛˛ You can extract data through a bit-by-bit method or via a binary search method<br />

with delays indicating the value. Delays are introduced either with explicit<br />

SLEEP( )-type functions or through the use of long-running queries.

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

Saved successfully!

Ooh no, something went wrong!