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.

538 Chapter 13 n Attacking Users: O<strong>the</strong>r Techniques<br />

Application<br />

1. Attacker requests /login.php<br />

and is issued with a session token<br />

3. User logs in using <strong>the</strong> token<br />

received from <strong>the</strong> attacker<br />

4. Attacker hijacks user’s session<br />

using <strong>the</strong> same token as <strong>the</strong> user<br />

2. Attacker feeds <strong>the</strong> session token to <strong>the</strong> user<br />

User<br />

Figure 13-4: The steps involved in a session fixation attack<br />

Attacker<br />

The key stage in this attack is, of course, <strong>the</strong> point at which <strong>the</strong> attacker feeds<br />

to <strong>the</strong> victim <strong>the</strong> session token he has acquired, <strong>the</strong>reby causing <strong>the</strong> victim’s<br />

browser to use it. The ways in which this can be done depend on <strong>the</strong> mechanism<br />

used to transmit session tokens:<br />

n If HTTP cookies are used, <strong>the</strong> attacker can try to use one of <strong>the</strong> cookie<br />

injection techniques, as described in <strong>the</strong> preceding section.<br />

n If session tokens are transmitted within a URL parameter, <strong>the</strong> attacker can<br />

simply feed <strong>the</strong> victim <strong>the</strong> same URL that <strong>the</strong> <strong>application</strong> issued to him:<br />

https://wahh-app.com/login.php?SessId=12d1a1f856ef224ab424c2454208<br />

n Several <strong>application</strong> servers accept use of <strong>the</strong>ir session tokens within <strong>the</strong><br />

URL, delimited by a semicolon. In some <strong>application</strong>s this is done by default,<br />

and in o<strong>the</strong>rs, <strong>the</strong> <strong>application</strong> tolerates explicit use in this manner even if<br />

<strong>the</strong> servers don’t behave in this way by default:<br />

http://wahh-app.com/store/product.do;jsessionid=739105723F7AEE6ABC2<br />

13F812C184204.ASTPESD2<br />

n If <strong>the</strong> <strong>application</strong> uses hidden fields in HTML forms to transmit session<br />

tokens, <strong>the</strong> attacker may be able to use a CSRF attack to introduce his<br />

token into <strong>the</strong> user’s browser.<br />

Session fixation vulnerabilities can also exist in <strong>application</strong>s that do not<br />

contain login functionality. For example, an <strong>application</strong> may allow anonymous

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

Saved successfully!

Ooh no, something went wrong!