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

arbitrary code execution on <strong>the</strong> computer of a victim user. For example,<br />

if a site is running in <strong>the</strong> Trusted Sites zone of Internet Explorer, injecting<br />

<strong>the</strong> following code causes <strong>the</strong> Windows calculator program to launch on<br />

<strong>the</strong> user’s computer:<br />

<br />

var o = new ActiveXObject(‘WScript.shell’);<br />

o.Run(‘calc.exe’);<br />

<br />

n Web <strong>application</strong>s often deploy ActiveX controls containing powerful<br />

methods (see Chapter 13). Some <strong>application</strong>s seek to prevent misuse by<br />

a third party by verifying within <strong>the</strong> control itself that <strong>the</strong> invoking <strong>web</strong><br />

page was issued from <strong>the</strong> correct <strong>web</strong>site. In this situation, <strong>the</strong> control can<br />

still be misused via an XSS attack, because in that instance <strong>the</strong> invoking<br />

code satisfies <strong>the</strong> trust check implemented within <strong>the</strong> control.<br />

COMMON MYTH<br />

“Phishing and XSS only affect <strong>application</strong>s on <strong>the</strong> public Internet.”<br />

XSS bugs can affect any type of <strong>web</strong> <strong>application</strong>, and an attack against<br />

an intranet-based <strong>application</strong>, delivered via a group e-mail, can exploit two<br />

forms of trust. First, <strong>the</strong>re is <strong>the</strong> social trust exploited by an internal e-mail<br />

sent between colleagues. Second, victims’ browsers often trust corporate<br />

<strong>web</strong> servers more than <strong>the</strong>y do those on <strong>the</strong> public Internet. For example,<br />

with Internet Explorer, if a computer is part of a corporate domain, <strong>the</strong><br />

browser defaults to a lower level of security when accessing intranet-based<br />

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

Escalating <strong>the</strong> Client-Side Attack<br />

A <strong>web</strong>site may directly attack users who visit it in numerous ways, such as logging<br />

<strong>the</strong>ir keystrokes, capturing <strong>the</strong>ir browsing history, and port-scanning <strong>the</strong><br />

local network. Any of <strong>the</strong>se attacks may be delivered via a cross-site scripting<br />

flaw in a vulnerable <strong>application</strong>, although <strong>the</strong>y may also be delivered directly<br />

by any malicious <strong>web</strong>site that a user happens to visit. Attacks of this kind are<br />

described in more detail at <strong>the</strong> end of Chapter 13.<br />

Delivery Mechanisms for XSS Attacks<br />

Having identified an XSS vulnerability and formulated a suitable payload to<br />

exploit it, an attacker needs to find some means of delivering <strong>the</strong> attack to o<strong>the</strong>r

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

Saved successfully!

Ooh no, something went wrong!