19.09.2017 Views

the-web-application-hackers-handbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13 n Attacking Users: O<strong>the</strong>r Techniques 533<br />

4. If you find that <strong>the</strong> <strong>application</strong> is blocking or sanitizing newline characters,<br />

attempt <strong>the</strong> following bypasses:<br />

foo%00%0d%0abar<br />

foo%250d%250abar<br />

foo%%0d0d%%0a0abar<br />

WARNING Issues such as <strong>the</strong>se are sometimes missed through overreliance<br />

on HTML source code and/or browser plug-ins for information, which do not<br />

show <strong>the</strong> response headers. Ensure that you are reading <strong>the</strong> HTTP response<br />

headers using an intercepting proxy tool.<br />

If it is possible to inject arbitrary headers and message body content into <strong>the</strong><br />

response, this behavior can be used to attack o<strong>the</strong>r users of <strong>the</strong> <strong>application</strong> in<br />

various ways.<br />

TRY IT!<br />

http://mdsec.net/settings/12/<br />

http://mdsec.net/settings/31/<br />

Injecting Cookies<br />

A URL can be constructed that sets arbitrary cookies within <strong>the</strong> browser of any<br />

user who requests it:<br />

GET /settings/12/Default.aspx?Language=English%0d%0aSet-<br />

Cookie:+SessId%3d120a12f98e8; HTTP/1.1<br />

Host: mdsec.net<br />

HTTP/1.1 200 OK<br />

Set-Cookie: PreferredLanguage=English<br />

Set-Cookie: SessId=120a12f98e8;<br />

...<br />

If suitably configured, <strong>the</strong>se cookies may persist across different browser<br />

sessions. Target users can be induced to access <strong>the</strong> malicious URL via <strong>the</strong> same<br />

delivery mechanisms that were described for reflected XSS vulnerabilities<br />

(e-mail, third-party <strong>web</strong>site, and so on).<br />

Delivering O<strong>the</strong>r Attacks<br />

Because HTTP header injection enables an attacker to control <strong>the</strong> entire body<br />

of a response, it can be used as a delivery mechanism for practically any attack<br />

against o<strong>the</strong>r users, including virtual <strong>web</strong>site defacement, script injection, arbitrary<br />

redirection, attacks against ActiveX controls, and so on.

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

Saved successfully!

Ooh no, something went wrong!