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

generated by <strong>the</strong> <strong>application</strong>, and it submits this back to <strong>the</strong> <strong>application</strong> when<br />

<strong>the</strong> victim unwittingly clicks <strong>the</strong> confirm button. As far as <strong>the</strong> target <strong>application</strong><br />

is concerned, everything is normal.<br />

To deliver <strong>the</strong> key trick of having <strong>the</strong> victim user see one interface but interact<br />

with a different one, <strong>the</strong> attacker can employ various CSS techniques. The iframe<br />

that loads <strong>the</strong> target interface can be made an arbitrary size, in an arbitrary location<br />

within <strong>the</strong> attacker’s page, and showing an arbitrary location within <strong>the</strong><br />

target page. Using suitable style attributes, it can be made completely transparent<br />

so that <strong>the</strong> user cannot see it.<br />

TRY IT!<br />

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

Developing <strong>the</strong> basic attack fur<strong>the</strong>r, <strong>the</strong> attacker can use complex script code<br />

within his interface to induce more elaborate actions than simply clicking a button.<br />

Suppose an attack requires <strong>the</strong> user to enter some text into an input field<br />

(for example, in <strong>the</strong> amount field of a funds transfer page). The attacker’s user<br />

interface can contain some content that induces <strong>the</strong> user to type (for example,<br />

a form to enter a phone number to win a prize). A script on <strong>the</strong> attacker’s page<br />

can selectively handle keystrokes so that when a desired character is typed,<br />

<strong>the</strong> keystroke event is effectively passed to <strong>the</strong> target interface to populate <strong>the</strong><br />

required input field. If <strong>the</strong> user types a character that <strong>the</strong> attacker does not want<br />

to enter into <strong>the</strong> target interface, <strong>the</strong> keystroke is not passed to that interface,<br />

and <strong>the</strong> attacker’s script waits for <strong>the</strong> next keystroke.<br />

In a fur<strong>the</strong>r variation, <strong>the</strong> attacker’s page can contain content that induces<br />

<strong>the</strong> user to perform mouse-dragging actions, such as a simple game. Script<br />

running on <strong>the</strong> attacker’s page can selectively handle <strong>the</strong> resulting events in<br />

a way that causes <strong>the</strong> user to unwittingly select text within <strong>the</strong> target <strong>application</strong>’s<br />

interface and drag it into an input field in <strong>the</strong> attacker’s interface, or vice<br />

versa. For example, when targeting a <strong>web</strong> mail <strong>application</strong>, <strong>the</strong> attacker could<br />

induce <strong>the</strong> user to drag text from an e-mail message into an input field that<br />

<strong>the</strong> attacker can read. Alternatively, <strong>the</strong> user could be made to create a rule to<br />

forward all e-mail to <strong>the</strong> attacker and drag <strong>the</strong> required e-mail address from<br />

<strong>the</strong> attacker’s interface into <strong>the</strong> relevant input field in <strong>the</strong> form that defines <strong>the</strong><br />

rule. Fur<strong>the</strong>rmore, since links and images are dragged as URLs, <strong>the</strong> attacker<br />

may be able to induce dragging actions to capture sensitive URLs, including<br />

anti-CSRF tokens, from <strong>the</strong> target <strong>application</strong>’s interface.<br />

A useful explanation of <strong>the</strong>se and o<strong>the</strong>r attack vectors, and <strong>the</strong> methods by<br />

which <strong>the</strong>y may be delivered, can be found here:<br />

http://ui-redressing.mniemietz.de/uiRedressing.pdf

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

Saved successfully!

Ooh no, something went wrong!