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.

Chapter 7 n Attacking Session Management 243<br />

c. If <strong>the</strong> page is displayed as normal, <strong>the</strong> token is still active.<br />

d. Use trial and error to determine how long any session expiration timeout<br />

is, or whe<strong>the</strong>r a token can still be used days after <strong>the</strong> last request<br />

using it. Burp Intruder can be configured to increment <strong>the</strong> time interval<br />

between successive requests to automate this task.<br />

2. Determine whe<strong>the</strong>r a logout function exists and is prominently made<br />

available to users. If not, users are more vulnerable, because <strong>the</strong>y have no<br />

way to cause <strong>the</strong> <strong>application</strong> to invalidate <strong>the</strong>ir session.<br />

3. Where a logout function is provided, test its effectiveness. After logging out,<br />

attempt to reuse <strong>the</strong> old token and determine whe<strong>the</strong>r it is still valid. If so,<br />

users remain vulnerable to some session hijacking attacks even after <strong>the</strong>y<br />

have “logged out.” You can use Burp Suite to test this, by selecting a recent<br />

session-dependent request from <strong>the</strong> proxy history and sending it to Burp<br />

Repeater to reissue after you have logged out from <strong>the</strong> <strong>application</strong>.<br />

TRY IT!<br />

http://mdsec.net/auth/423/<br />

http://mdsec.net/auth/439/<br />

http://mdsec.net/auth/447/<br />

http://mdsec.net/auth/452/<br />

http://mdsec.net/auth/457/<br />

Client Exposure to Token Hijacking<br />

An attacker can target o<strong>the</strong>r users of <strong>the</strong> <strong>application</strong> in an attempt to capture<br />

or misuse <strong>the</strong> victim’s session token in various ways:<br />

n An obvious payload for cross-site scripting attacks is to query <strong>the</strong> user’s<br />

cookies to obtain her session token, which can <strong>the</strong>n be transmitted to an<br />

arbitrary server controlled by <strong>the</strong> attacker. All <strong>the</strong> various permutations<br />

of this attack are described in detail in Chapter 12.<br />

n Various o<strong>the</strong>r attacks against users can be used to hijack <strong>the</strong> user’s session<br />

in different ways. With session fixation vulnerabilities, an attacker feeds<br />

a known session token to a user, waits for her to log in, and <strong>the</strong>n hijacks<br />

her session. With cross-site request forgery attacks, an attacker makes<br />

a crafted request to an <strong>application</strong> from a <strong>web</strong> site he controls, and he<br />

exploits <strong>the</strong> fact that <strong>the</strong> user’s browser automatically submits her current<br />

cookie with this request. These attacks are also described in Chapter 12.

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

Saved successfully!

Ooh no, something went wrong!