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

<strong>web</strong>site may contain an HTML form that uses <strong>the</strong> POST method and that<br />

has <strong>the</strong> vulnerable <strong>application</strong> as its target URL. JavaScript or navigational<br />

controls on <strong>the</strong> page can be used to submit <strong>the</strong> form, successfully exploiting<br />

<strong>the</strong> vulnerability.<br />

n In a variation on <strong>the</strong> third-party <strong>web</strong>site attack, some attackers have been<br />

known to pay for banner advertisements that link to a URL containing<br />

an XSS payload for a vulnerable <strong>application</strong>. If a user is logged in to <strong>the</strong><br />

vulnerable <strong>application</strong> and clicks <strong>the</strong> ad, her session with that <strong>application</strong><br />

is compromised. Because many providers use keywords to assign<br />

advertisements to pages that are related to <strong>the</strong>m, cases have even arisen<br />

where an ad attacking a particular <strong>application</strong> is assigned to <strong>the</strong> pages of<br />

that <strong>application</strong> itself! This not only lends credibility to <strong>the</strong> attack but also<br />

guarantees that someone who clicks <strong>the</strong> ad is using <strong>the</strong> vulnerable <strong>application</strong><br />

at <strong>the</strong> moment <strong>the</strong> attack strikes. Fur<strong>the</strong>rmore, since <strong>the</strong> targeted<br />

URL is now “on-site,” <strong>the</strong> attack can bypass browser-based mechanisms<br />

employed to defend against XSS (described in detail later in this chapter).<br />

Because many banner ad providers charge on a per-click basis, this<br />

technique effectively enables an attacker to “buy” a specific number of<br />

user sessions.<br />

n Many <strong>web</strong> <strong>application</strong>s implement a function to “tell a friend” or send<br />

feedback to site administrators. This function often enables a user to<br />

generate an e-mail with arbitrary content and recipients. An attacker<br />

may be able to leverage this functionality to deliver an XSS attack via an<br />

e-mail that actually originates from <strong>the</strong> organization’s own server. This<br />

increases <strong>the</strong> likelihood that even technically knowledgeable users and<br />

anti-malware software will accept it.<br />

Delivering Stored XSS Attacks<br />

The two kinds of delivery mechanisms for stored XSS attacks are in-band and<br />

out-of-band.<br />

In-band delivery applies in most cases and is used when <strong>the</strong> data that is<br />

<strong>the</strong> subject of <strong>the</strong> vulnerability is supplied to <strong>the</strong> <strong>application</strong> via its main <strong>web</strong><br />

interface. Common locations where user-controllable data may eventually be<br />

displayed to o<strong>the</strong>r users include <strong>the</strong> following:<br />

n Personal information fields — name, address, e-mail, telephone, and <strong>the</strong> like<br />

n Names of documents, uploaded files, and o<strong>the</strong>r items<br />

n Feedback or questions for <strong>application</strong> administrators<br />

n Messages, status updates, comments, questions, and <strong>the</strong> like for o<strong>the</strong>r<br />

<strong>application</strong> users

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

Saved successfully!

Ooh no, something went wrong!