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.

Testing for <strong>SQL</strong> <strong>Injection</strong> • Chapter 2 51<br />

Application Response<br />

In the previous section, you saw the kinds of errors that applications typically display when<br />

the back-end database fails to execute a query. If you see one of those errors, you can be<br />

almost certain that the application is vulnerable to some kind of <strong>SQL</strong> injection. However,<br />

applications react differently when they receive an error from the database, <strong>and</strong> sometimes<br />

identifying <strong>SQL</strong> injection vulnerabilities is not as easy as previously shown. In this section,<br />

you will see other examples of errors not directly displayed in the browser, which represent<br />

different levels of complexity.<br />

No t e<br />

There is no golden rule to determine whether certain input triggered an<br />

<strong>SQL</strong> injection vulnerability, as the possible scenarios are endless.<br />

It is simply important that you remain focused <strong>and</strong> pay attention to detail<br />

when investigating potential <strong>SQL</strong> injections. It is recommended that you use<br />

a Web proxy, as your Web browser will hide details such as HTML source<br />

code, HTTP redirects, <strong>and</strong> so forth. Besides, when working at a lower level<br />

<strong>and</strong> watching the HTML source code you are more likely to discover other<br />

vulnerabilities apart from <strong>SQL</strong> injection.<br />

The process of finding <strong>SQL</strong> injection vulnerabilities involves identifying user data entry,<br />

tampering with the data sent to the application, <strong>and</strong> identifying changes in the results<br />

returned by the server. You have to keep in mind that tampering with the parameters can<br />

generate an error which could have nothing to do with <strong>SQL</strong> injection.<br />

Generic Errors<br />

In the previous section, you saw the typical errors returned from the database. In that kind of<br />

scenario, it is very easy to determine whether a parameter is vulnerable to <strong>SQL</strong> injection. In<br />

other scenarios, the application will return a generic error page regardless of the kind of failure.<br />

A good example of this is the Microsoft .NET engine, which by default returns the<br />

Server Error page shown in Figure 2.6 in the event of runtime errors.

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

Saved successfully!

Ooh no, something went wrong!