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 239<br />

perform some malicious action, such as send spam e-mail, harvest personal<br />

information, or change passwords.<br />

NOTE Current versions of Internet Explorer do not include a Referer header<br />

when following off-site links contained in a page that was accessed over<br />

HTTPS. In this situation, Firefox includes <strong>the</strong> Referer header provided that <strong>the</strong><br />

off-site link is also being accessed over HTTPS, even if it belongs to a different<br />

domain. Hence, sensitive data placed in URLs is vulnerable to leakage in<br />

Referer logs even where SSL is being used.<br />

HACK STEPS<br />

1. Identify all <strong>the</strong> functionality within <strong>the</strong> <strong>application</strong>, and locate any logging<br />

or monitoring functions where session tokens can be viewed. Verify<br />

who can access this functionality–for example, administrators, any<br />

au<strong>the</strong>nticated user, or any anonymous user. See Chapter 4 for techniques<br />

for discovering hidden content that is not directly linked from <strong>the</strong> main<br />

<strong>application</strong>.<br />

2. Identify any instances within <strong>the</strong> <strong>application</strong> where session tokens are<br />

transmitted within <strong>the</strong> URL. It may be that tokens are generally transmitted<br />

in a more secure manner but that developers have used <strong>the</strong> URL in<br />

specific cases to work around particular difficulties. For example, this<br />

behavior is often observed where a <strong>web</strong> <strong>application</strong> interfaces with an<br />

external system.<br />

3. If session tokens are being transmitted in URLs, attempt to find any <strong>application</strong><br />

functionality that enables you to inject arbitrary off-site links into<br />

pages viewed by o<strong>the</strong>r users. Examples include functionality implementing<br />

a message board, site feedback, question-and-answer, and so on. If<br />

so, submit links to a <strong>web</strong> server you control and wait to see whe<strong>the</strong>r any<br />

users’ session tokens are received in your Referer logs.<br />

4. If any session tokens are captured, attempt to hijack user sessions by<br />

using <strong>the</strong> <strong>application</strong> as normal but substituting a captured token for your<br />

own. You can do this by intercepting <strong>the</strong> next response from <strong>the</strong> server<br />

and adding a Set-Cookie header of your own with <strong>the</strong> captured cookie<br />

value. In Burp, you can apply a single Suite-wide configuration that sets<br />

a specific cookie in all requests to <strong>the</strong> target <strong>application</strong> to allow easy<br />

switching between different session contexts during testing.<br />

6. If a large number of tokens are captured, and session hijacking allows you<br />

to access sensitive data such as personal details, payment information,<br />

or user passwords, you can use <strong>the</strong> automated techniques described in<br />

Chapter 14 to harvest all desired data belonging to o<strong>the</strong>r <strong>application</strong> users.

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

Saved successfully!

Ooh no, something went wrong!