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.

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

Accept: text/xml,application/xml,application/xhtml+xml,<br />

text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5<br />

Accept-Language: en-gb,en;q=0.5<br />

Accept-Encoding: gzip,deflate<br />

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br />

Keep-Alive: 300<br />

Proxy-Connection: keep-alive<br />

This kind of request sends parameters within the URLs in the following format:<br />

?parameter1=value1&parameter2=value2&parameter3=value3...<br />

In the preceding example, you can see three parameters: text, cat, <strong>and</strong> num. The remote<br />

application will retrieve the values of the parameters <strong>and</strong> use them for whatever purpose<br />

they have been designed. For GET requests, you can manipulate the parameters by simply<br />

changing them in your browser’s navigation toolbar. Alternatively, you can also use a proxy<br />

tool, which I’ll explain shortly.<br />

POST Requests<br />

POST is an HTTP method used to send information to the Web server. The action the<br />

server performs is determined by the target URL. This is normally the method used when<br />

you fill in a form in your browser <strong>and</strong> click the Submit button. Although your browser does<br />

everything for you, this is an example of what is sent to the remote Web server:<br />

POST /contact/index.asp HTTP/1.1<br />

Host:www.victim.com<br />

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.19) Gecko/20081216<br />

Ubuntu/8.04 (hardy) Firefox/2.0.0.19<br />

Accept: text/xml,application/xml,application/xhtml+xml,<br />

text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5<br />

Accept-Language: en-gb,en;q=0.5<br />

Accept-Encoding: gzip,deflate<br />

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br />

Keep-Alive: 300<br />

Referer: http://www.victim.com/contact/index.asp<br />

Content-Type: application/x-www-form-urlencoded<br />

Content-Length: 129<br />

first=John&last=Doe&email=john@doe.com&phone=555123456&title=Mr&country=US&comments=<br />

I%20would%20like%20to%20request%20information

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

Saved successfully!

Ooh no, something went wrong!