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.

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

TRY IT!<br />

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

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

HTTP Parameter Injection<br />

HTTP parameter injection (HPI) arises when user-supplied parameters are<br />

used as parameters within a back-end HTTP request. Consider <strong>the</strong> following<br />

variation on <strong>the</strong> bank transfer functionality that was previously vulnerable to<br />

SOAP injection:<br />

POST /bank/48/Default.aspx HTTP/1.0<br />

Host: mdsec.net<br />

Content-Length: 65<br />

FromAccount=18281008&Amount=1430&ToAccount=08447656&Submit=Submit<br />

This front-end request, sent from <strong>the</strong> user’s browser, causes <strong>the</strong> <strong>application</strong><br />

to make a fur<strong>the</strong>r back-end HTTP request to ano<strong>the</strong>r <strong>web</strong> server within <strong>the</strong><br />

bank’s infrastructure. In this back-end request, <strong>the</strong> <strong>application</strong> copies some of<br />

<strong>the</strong> parameter values from <strong>the</strong> front-end request:<br />

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

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

Content-Length: 44<br />

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

This request causes <strong>the</strong> back-end server to check whe<strong>the</strong>r cleared funds are<br />

available to perform <strong>the</strong> transfer and, if so, to carry it out. However, <strong>the</strong> frontend<br />

server can optionally specify that cleared funds are available, and <strong>the</strong>refore<br />

bypass <strong>the</strong> check, by supplying <strong>the</strong> following parameter:<br />

clearedfunds=true<br />

If <strong>the</strong> attacker is aware of this behavior, he can attempt to perform an HPI<br />

attack to inject <strong>the</strong> clearedfunds parameter into <strong>the</strong> back-end request. To do<br />

this, he adds <strong>the</strong> required parameter onto <strong>the</strong> end of an existing parameter’s<br />

value and URL-encodes <strong>the</strong> characters & and =, which are used to separate<br />

names and values:<br />

POST /bank/48/Default.aspx HTTP/1.0<br />

Host: mdsec.net<br />

Content-Length: 96<br />

FromAccount=18281008&Amount=1430&ToAccount=08447656%26clearedfunds%3dtru<br />

e&Submit=Submit

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

Saved successfully!

Ooh no, something went wrong!