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.

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

In the following sections, you will see how the information reaches the database server<br />

<strong>and</strong> why the preceding errors where generated.<br />

Information Workf low<br />

In the previous section, you saw some <strong>SQL</strong> injection errors displayed as a result of parameter<br />

manipulation. You may be wondering why the Web server shows an error from the database<br />

if you modify a parameter. Although the errors are displayed in the Web server response, the<br />

<strong>SQL</strong> injection happens at the database layer. Those examples show how you can reach a<br />

database server via the Web application.<br />

It is important to have a clear underst<strong>and</strong>ing of how your data entry influences an <strong>SQL</strong><br />

query <strong>and</strong> what kind of response you could expect from the server. Figure 2.4 shows how<br />

the data sent from the browser is used in creating an <strong>SQL</strong> statement <strong>and</strong> how the results are<br />

returned back to the browser.<br />

Figure 2.4 Flow of Information in a Three-Tier Architecture<br />

Figure 2.4 shows the information workflow between all parties normally involved in a<br />

dynamic Web request:<br />

1. The user sends a request to the Web server.<br />

2. The Web server retrieves user data, creates an <strong>SQL</strong> statement which contains the<br />

entry from the user, <strong>and</strong> then sends the query to the database server.<br />

3. The database server executes the <strong>SQL</strong> query <strong>and</strong> returns the results to the<br />

Web server. Note that the database server doesn’t know about the logic of the<br />

application; it will just execute a query <strong>and</strong> return results.<br />

4. The Web server dynamically creates an HTML page based on the database response.

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

Saved successfully!

Ooh no, something went wrong!