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.

390 Chapter 10 n Attacking Back-End Components<br />

Preventing SOAP Injection<br />

You can prevent SOAP injection by employing boundary validation filters at any<br />

point where user-supplied data is inserted into a SOAP message (see Chapter<br />

2). This should be performed both on data that has been immediately received<br />

from <strong>the</strong> user in <strong>the</strong> current request and on any data that has been persisted from<br />

earlier requests or generated from o<strong>the</strong>r processing that takes user data as input.<br />

To prevent <strong>the</strong> attacks described, <strong>the</strong> <strong>application</strong> should HTML-encode any<br />

XML metacharacters appearing in user input. HTML encoding involves replacing<br />

literal characters with <strong>the</strong>ir corresponding HTML entities. This ensures that <strong>the</strong><br />

XML interpreter treats <strong>the</strong>m as part of <strong>the</strong> data value of <strong>the</strong> relevant element and<br />

not as part of <strong>the</strong> structure of <strong>the</strong> message itself. Here are <strong>the</strong> HTML encodings<br />

of some common problematic characters:<br />

n < — &lt;<br />

n > — &gt;<br />

n / — &#47;<br />

Injecting into Back-end HTTP Requests<br />

The preceding section described how some <strong>application</strong>s incorporate user-supplied<br />

data into back-end SOAP requests to services that are not directly accessible<br />

to <strong>the</strong> user. More generally, <strong>application</strong>s may embed user input in any kind of<br />

back-end HTTP request, including those that transmit parameters as regular<br />

name/value pairs. This kind of behavior is often vulnerable to attack, since <strong>the</strong><br />

<strong>application</strong> often effectively proxies <strong>the</strong> URL or parameters supplied by <strong>the</strong> user.<br />

Attacks against this functionality can be divided into <strong>the</strong> following categories:<br />

n Server-side HTTP redirection attacks allow an attacker to specify an arbitrary<br />

resource or URL that is <strong>the</strong>n requested by <strong>the</strong> front-end <strong>application</strong> server.<br />

n HTTP parameter injection (HPI) attacks allow an attacker to inject arbitrary<br />

parameters into a back-end HTTP request made by <strong>the</strong> <strong>application</strong><br />

server. If an attacker injects a parameter that already exists in <strong>the</strong> back-end<br />

request, HTTP parameter pollution (HPP) attacks can be used to override<br />

<strong>the</strong> original parameter value specified by <strong>the</strong> server.<br />

Server-side HTTP Redirection<br />

Server-side redirection vulnerabilities arise when an <strong>application</strong> takes usercontrollable<br />

input and incorporates it into a URL that it retrieves using a backend<br />

HTTP request. The user-supplied input may comprise <strong>the</strong> entire URL that<br />

is retrieved, or <strong>the</strong> <strong>application</strong> may perform some processing on it, such as<br />

adding a standard suffix.

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

Saved successfully!

Ooh no, something went wrong!