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.

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

When <strong>the</strong> <strong>application</strong> server processes this request, it URL-decodes <strong>the</strong> parameter<br />

values in <strong>the</strong> normal way. So <strong>the</strong> value of <strong>the</strong> ToAccount parameter that <strong>the</strong><br />

front-end <strong>application</strong> receives is as follows:<br />

08447656&clearedfunds=true<br />

If <strong>the</strong> front-end <strong>application</strong> does not validate this value and passes it through<br />

unsanitized into <strong>the</strong> back-end request, <strong>the</strong> following back-end request is made,<br />

which successfully bypasses <strong>the</strong> check for cleared funds:<br />

POST /doTransfer.asp HTTP/1.0<br />

Host: mdsec-mgr.int.mdsec.net<br />

Content-Length: 62<br />

fromacc=18281008&amount=1430&toacc=08447656&clearedfunds=true<br />

TRY IT!<br />

http://mdsec.net/bank/48/<br />

NOTE Unlike with SOAP injection, injecting arbitrary unexpected parameters<br />

into a back-end request is unlikely to cause any kind of error. Therefore, a successful<br />

attack normally requires exact knowledge of <strong>the</strong> back-end parameters<br />

that are being used. Although this may be hard to determine in a blackbox<br />

context, it may be straightforward if <strong>the</strong> <strong>application</strong> uses any third-party components<br />

whose code can be obtained and researched.<br />

HTTP Parameter Pollution<br />

HPP is an attack technique that arises in various contexts (see Chapters 12 and<br />

13 for o<strong>the</strong>r examples) and that often applies in <strong>the</strong> context of HPI attacks.<br />

The HTTP specifications provide no guidelines as to how <strong>web</strong> servers should<br />

behave when a request contains multiple parameters with <strong>the</strong> same name. In<br />

practice, different <strong>web</strong> servers behave in different ways. Here are some common<br />

behaviors:<br />

n Use <strong>the</strong> first instance of <strong>the</strong> parameter.<br />

n Use <strong>the</strong> last instance of <strong>the</strong> parameter.<br />

n Concatenate <strong>the</strong> parameter values, maybe adding a separator between <strong>the</strong>m.<br />

n Construct an array containing all <strong>the</strong> supplied values.<br />

In <strong>the</strong> preceding HPI example, <strong>the</strong> attacker could add a new parameter to<br />

a back-end request. In fact, it is more likely in practice that <strong>the</strong> request into<br />

which <strong>the</strong> attacker can inject already contains a parameter with <strong>the</strong> name he

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

Saved successfully!

Ooh no, something went wrong!