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 12 n Attacking Users: Cross-Site Scripting 479<br />

Content-Length: 1098<br />

<br />

<br />

...<br />

<br />

<br />

...<br />

<br />

<br />

As mentioned, this exploit succeeds when <strong>the</strong> response is consumed directly<br />

by <strong>the</strong> browser, and not by <strong>the</strong> original <strong>application</strong> component that would ordinarily<br />

process <strong>the</strong> response.<br />

Attacking Browser XSS Filters<br />

One obstacle to <strong>the</strong> practical exploitation of virtually any reflected XSS vulnerability<br />

arises from various browser features that attempt to protect users from<br />

precisely <strong>the</strong>se attacks. Current versions of <strong>the</strong> Internet Explorer browser include<br />

an XSS filter by default, and similar features are available as plug-ins to several<br />

o<strong>the</strong>r browsers. These filters all work in a similar way: <strong>the</strong>y passively monitor<br />

requests and responses, use various rules to identify possible XSS attacks in<br />

progress, and, when a possible attack is identified, modify parts of <strong>the</strong> response<br />

to neutralize <strong>the</strong> possible attack.<br />

Now, as we have discussed, XSS conditions should be considered vulnerabilities<br />

if <strong>the</strong>y can be exploited via any browser in widespread usage, and <strong>the</strong><br />

presence of XSS filters in some browsers does not mean that XSS vulnerabilities<br />

do not need to be fixed. Never<strong>the</strong>less, in some practical situations, an attacker<br />

may specifically need to exploit a vulnerability via a browser that implements an<br />

XSS filter. Fur<strong>the</strong>rmore, <strong>the</strong> ways in which XSS filters can be circumvented are<br />

interesting in <strong>the</strong>ir own right. In some cases <strong>the</strong>y can be leveraged to facilitate<br />

<strong>the</strong> delivery of o<strong>the</strong>r attacks that o<strong>the</strong>rwise would be impossible.<br />

This section examines Internet Explorer’s XSS filter. Currently it is <strong>the</strong> most<br />

mature and widely adopted filter available.<br />

The core operation of <strong>the</strong> IE XSS filter is as follows:<br />

n In cross-domain requests, each parameter value is inspected to identify<br />

possible attempts to inject JavaScript. This is done by checking <strong>the</strong> value<br />

against a regex-based blacklist of common attack strings.<br />

n If a potentially malicious parameter value is found, <strong>the</strong> response is checked<br />

to see whe<strong>the</strong>r it contains this same value.<br />

n If <strong>the</strong> value appears in <strong>the</strong> response, <strong>the</strong> response is sanitized to prevent<br />

any script from executing. For example, is modified to become<br />

.

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

Saved successfully!

Ooh no, something went wrong!