19.09.2017 Views

the-web-application-hackers-handbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

HACK STEPS<br />

1. Obtain a valid token by whatever means <strong>the</strong> <strong>application</strong> enables you to<br />

obtain one.<br />

2. Access <strong>the</strong> login form, and perform a login using this token.<br />

3. If <strong>the</strong> login is successful and <strong>the</strong> <strong>application</strong> does not issue a new token,<br />

it is vulnerable to session fixation.<br />

If <strong>the</strong> <strong>application</strong> does not support au<strong>the</strong>ntication but does allow users to submit<br />

and <strong>the</strong>n review sensitive information, you should verify whe<strong>the</strong>r <strong>the</strong> same session<br />

token is used before and after <strong>the</strong> initial submission of user-specific information. If<br />

it is, an attacker can obtain a token and feed it to a target user. When <strong>the</strong> user submits<br />

sensitive details, <strong>the</strong> attacker can use <strong>the</strong> token to view <strong>the</strong> user’s information.<br />

HACK STEPS<br />

1. Obtain a session token as a completely anonymous user, and <strong>the</strong>n walk<br />

through <strong>the</strong> process of submitting sensitive data, up until any page at<br />

which <strong>the</strong> sensitive data is displayed back.<br />

2. If <strong>the</strong> same token originally obtained can now be used to retrieve <strong>the</strong> sensitive<br />

data, <strong>the</strong> <strong>application</strong> is vulnerable to session fixation.<br />

3. If any type of session fixation is identified, verify whe<strong>the</strong>r <strong>the</strong> server<br />

accepts arbitrary tokens it has not previously issued. If it does, <strong>the</strong> vulnerability<br />

is considerably easier to exploit over an extended period.<br />

Preventing Session Fixation Vulnerabilities<br />

At any point when a user interacting with <strong>the</strong> <strong>application</strong> transitions from being<br />

anonymous to being identified, <strong>the</strong> <strong>application</strong> should issue a fresh session token.<br />

This applies both to a successful login and to cases in which an anonymous<br />

user first submits personal or o<strong>the</strong>r sensitive information.<br />

As a defense-in-depth measure to fur<strong>the</strong>r protect against session fixation<br />

attacks, many security-critical <strong>application</strong>s employ per-page tokens to supplement<br />

<strong>the</strong> main session token. This technique can frustrate most kinds of session<br />

hijacking attacks. See Chapter 7 for fur<strong>the</strong>r details.<br />

The <strong>application</strong> should not accept arbitrary session tokens that it does not<br />

recognize as having issued itself. The token should be immediately canceled<br />

within <strong>the</strong> browser, and <strong>the</strong> user should be returned to <strong>the</strong> <strong>application</strong>’s start page.<br />

Open Redirection Vulnerabilities<br />

Open redirection vulnerabilities arise when an <strong>application</strong> takes user-controllable<br />

input and uses it to perform a redirection, instructing <strong>the</strong> user’s browser to

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

Saved successfully!

Ooh no, something went wrong!