19.09.2017 Views

the-web-application-hackers-handbook

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 21 n A Web Application Hacker’s Methodology 793<br />

<strong>the</strong> following thought in mind: <strong>the</strong> tasks we describe are largely standard and<br />

orthodox; <strong>the</strong> most impressive attacks against <strong>web</strong> <strong>application</strong>s always involve<br />

thinking beyond <strong>the</strong>m.<br />

General Guidelines<br />

You should always keep in mind some general considerations when carrying out<br />

<strong>the</strong> detailed tasks involved in attacking a <strong>web</strong> <strong>application</strong>. These may apply to all<br />

<strong>the</strong> different areas you need to examine and techniques you need to carry out.<br />

n Remember that several characters have special meaning in different parts<br />

of <strong>the</strong> HTTP request. When you are modifying <strong>the</strong> data within requests,<br />

you should URL-encode <strong>the</strong>se characters to ensure that <strong>the</strong>y are interpreted<br />

in <strong>the</strong> way you intend:<br />

n & is used to separate parameters in <strong>the</strong> URL query string and message<br />

body. To insert a literal & character, you should encode this as %26.<br />

n = is used to separate <strong>the</strong> name and value of each parameter in <strong>the</strong> URL<br />

query string and message body. To insert a literal = character, you<br />

should encode this as %3d.<br />

n ? is used to mark <strong>the</strong> beginning of <strong>the</strong> URL query string. To insert a<br />

literal ? character, you should encode this as %3f.<br />

n A space is used to mark <strong>the</strong> end of <strong>the</strong> URL in <strong>the</strong> first line of requests<br />

and can indicate <strong>the</strong> end of a cookie value in <strong>the</strong> Cookie header. To<br />

insert a literal space, you should encode this as %20 or +.<br />

n Because + represents an encoded space, to insert a literal + character,<br />

you should encode this as %2b.<br />

n ; is used to separate individual cookies in <strong>the</strong> Cookie header. To insert<br />

a literal ; character, you should encode this as %3b.<br />

n # is used to mark <strong>the</strong> fragment identifier within <strong>the</strong> URL. If you enter<br />

this character into <strong>the</strong> URL within your browser, it effectively truncates<br />

<strong>the</strong> URL that is sent to <strong>the</strong> server. To insert a literal # character, you<br />

should encode this as %23.<br />

n % is used as <strong>the</strong> prefix in <strong>the</strong> URL-encoding scheme. To insert a literal<br />

% character, you should encode this as %25.<br />

n Any nonprinting characters such as null bytes and newlines must, of<br />

course, be URL-encoded using <strong>the</strong>ir ASCII character code — in this<br />

case, as %00 and %0a, respectively.<br />

n Fur<strong>the</strong>rmore, note that entering URL-encoded data into a form usually<br />

causes your browser to perform ano<strong>the</strong>r layer of encoding. For example,

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

Saved successfully!

Ooh no, something went wrong!