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

preceding bypasses may be successful, and <strong>the</strong> following attacks should also<br />

be tested:<br />

http://http://mdattacker.net<br />

http://mdattacker.net/http://mdattacker.net<br />

hthttp://tp://mdattacker.net<br />

Sometimes, <strong>the</strong> <strong>application</strong> may verify that <strong>the</strong> user-supplied string ei<strong>the</strong>r<br />

starts with or contains an absolute URL to its own domain name. In this situation,<br />

<strong>the</strong> following bypasses may be effective:<br />

http://mdsec.net.mdattacker.net<br />

http://mdattacker.net/?http://mdsec.net<br />

http://mdattacker.net/%23http://mdsec.net<br />

TRY IT!<br />

http://mdsec.net/updates/52/<br />

http://mdsec.net/updates/57/<br />

http://mdsec.net/updates/59/<br />

http://mdsec.net/updates/66/<br />

http://mdsec.net/updates/69/<br />

Addition of an Absolute Prefix<br />

The <strong>application</strong> may form <strong>the</strong> target of <strong>the</strong> redirect by appending <strong>the</strong> usercontrollable<br />

string to an absolute URL prefix:<br />

GET /updates/72/?redir=/updates/update29.html HTTP/1.1<br />

Host: mdsec.net<br />

HTTP/1.1 302 Object moved<br />

Location: http://mdsec.net/updates/update29.html<br />

In this situation, <strong>the</strong> <strong>application</strong> may or may not be vulnerable. If <strong>the</strong> prefix<br />

used consists of http:// and <strong>the</strong> <strong>application</strong>’s domain name but does not include<br />

a slash character after <strong>the</strong> domain name, it is vulnerable. For example, <strong>the</strong> URL:<br />

http://mdsec.net/updates/72/?redir=.mdattacker.net<br />

causes a redirect to:<br />

http://mdsec.net.mdattacker.net<br />

This URL is under <strong>the</strong> attacker’s control, assuming that he controls <strong>the</strong> DNS<br />

records for <strong>the</strong> domain mdattacker.net.<br />

However, if <strong>the</strong> absolute URL prefix includes a trailing slash, or a subdirectory<br />

on <strong>the</strong> server, <strong>the</strong> <strong>application</strong> probably is not vulnerable to a redirection attack

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

Saved successfully!

Ooh no, something went wrong!