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.

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

Finding and Exploiting Open Redirection Vulnerabilities<br />

The first step in locating open redirection vulnerabilities is to identify every<br />

instance within <strong>the</strong> <strong>application</strong> where a redirect occurs. An <strong>application</strong> can<br />

cause <strong>the</strong> user’s browser to redirect to a different URL in several ways:<br />

n An HTTP redirect uses a message with a 3xx status code and a Location<br />

header specifying <strong>the</strong> target of <strong>the</strong> redirect:<br />

HTTP/1.1 302 Object moved<br />

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

n The HTTP Refresh header can be used to reload a page with an arbitrary<br />

URL after a fixed interval, which may be 0 to trigger an immediate redirect:<br />

HTTP/1.1 200 OK<br />

Refresh: 0; url=http://mdsec.net/updates/update29.html<br />

n The HTML tag can be used to replicate <strong>the</strong> behavior of any HTTP<br />

header and <strong>the</strong>refore can be used for redirection:<br />

HTTP/1.1 200 OK<br />

Content-Length: 125<br />

<br />

<br />

<br />

<br />

<br />

n Various APIs exist within JavaScript that can be used to redirect <strong>the</strong> browser<br />

to an arbitrary URL:<br />

HTTP/1.1 200 OK<br />

Content-Length: 120<br />

<br />

<br />

<br />

document.location=”http://mdsec.net/updates/update29.html”;<br />

<br />

<br />

<br />

In each of <strong>the</strong>se cases, an absolute or relative URL may be specified.

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

Saved successfully!

Ooh no, something went wrong!