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 13 n Attacking Users: O<strong>the</strong>r Techniques 551<br />

TRY IT!<br />

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

Cached Web Content<br />

Most browsers cache non-SSL <strong>web</strong> content unless a <strong>web</strong>site specifically instructs<br />

<strong>the</strong>m not to. The cached data normally is stored on <strong>the</strong> local file system.<br />

HACK STEPS<br />

1. For any <strong>application</strong> pages that are accessed over HTTP and that contain<br />

sensitive data, review <strong>the</strong> details of <strong>the</strong> server’s response to identify any<br />

cache directives.<br />

2. The following directives prevent browsers from caching a page. Note that<br />

<strong>the</strong>se may be specified within <strong>the</strong> HTTP response headers or within HTML<br />

metatags:<br />

Expires: 0<br />

Cache-control: no-cache<br />

Pragma: no-cache<br />

3. If <strong>the</strong>se directives are not found, <strong>the</strong> page concerned may be vulnerable to<br />

caching by one or more browsers. Note that cache directives are processed on<br />

a per-page basis, so every sensitive HTTP-based page needs to be checked.<br />

4. To verify that sensitive information is being cached, use a default installation<br />

of a standard browser, such as Internet Explorer or Firefox. In <strong>the</strong><br />

browser’s configuration, completely clean its cache and all cookies, and<br />

<strong>the</strong>n access <strong>the</strong> <strong>application</strong> pages that contain sensitive data. Review <strong>the</strong><br />

files that appear in <strong>the</strong> cache to see if any contain sensitive data. If a large<br />

number of files are being generated, you can take a specific string from a<br />

page’s source and search <strong>the</strong> cache for that string.<br />

Here are <strong>the</strong> default cache locations for common browsers:<br />

n<br />

n<br />

n<br />

Internet Explorer—Subdirectories of C:\Documents and Settings\<br />

username\Local Settings\Temporary Internet Files\<br />

Content.IE5<br />

Note that in Windows Explorer, to view this folder you need to enter this<br />

exact path and have hidden folders showing, or browse to <strong>the</strong> folder just<br />

listed from <strong>the</strong> command line.<br />

Firefox (on Windows)—C:\Documents and Settings\username\<br />

Local Settings\Application Data\Mozilla\Firefox\<br />

Profiles\profile name\Cache<br />

Firefox (on Linux)—~/.mozilla/firefox/profile name/Cache

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

Saved successfully!

Ooh no, something went wrong!