<?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>Security Dissection and Rants &#187; XSS</title>
	<atom:link href="http://www.iglobalonline.com/tag/xss/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.iglobalonline.com</link>
	<description>Penetrating security, one app at a time</description>
	<lastBuildDate>Fri, 09 Apr 2010 18:08:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Firefox 3.6 FileAPI Exif Injection</title>
		<link>http://www.iglobalonline.com/2010/03/26/firefox-3-6-fileapi-exif-injection/</link>
		<comments>http://www.iglobalonline.com/2010/03/26/firefox-3-6-fileapi-exif-injection/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 16:14:26 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[Browser Security]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[EXIF]]></category>
		<category><![CDATA[exiv2]]></category>
		<category><![CDATA[FileAPI]]></category>
		<category><![CDATA[Firefox 3.6]]></category>
		<category><![CDATA[injection]]></category>
		<category><![CDATA[metadata]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://www.iglobalonline.com/?p=155</guid>
		<description><![CDATA[W3C File API gives web applications the functionality to work with objects and their data elements through drag and drop.  Firefox 3.6 now supports File API. Given its potential, I decided to test the waters using Exif meta data. Most web applications read Exif meta data from JPEG images as a normal strings so in [...]]]></description>
			<content:encoded><![CDATA[<p>W3C File API gives web applications the functionality to work with objects and their data elements through drag and drop.  Firefox 3.6 now supports File API. Given its potential, I decided to test the waters using Exif meta data. Most web applications read Exif meta data from JPEG images as a normal strings so in my demonstration today I will inject an iframe into the Exif description of my sample JPEG image.</p>
<h2>The tools of the trade</h2>
<ul>
<li>Firefox 3.6</li>
<li>A basic JPEG image</li>
<li>exiv2 &#8211; <a title="http://www.exiv2.org/" href="http://www.exiv2.org/" target="_blank">http://www.exiv2.org/</a></li>
<li>Mozilla&#8217;s demo Exif web application<a title="http://www.exiv2.org/" href="http://www.exiv2.org/" target="_blank"><br />
</a></li>
</ul>
<h2>A simple XSS construction</h2>
<p>I start with writing a real quick alert onload into a basic HTML file I will be hosting on the web. This will launch an alert box when the HTML loads in the users browser.</p>
<p><a href="http://www.iglobalonline.com/wp-content/ups/2010/03/XSS-Construction.bmp"><img class="aligncenter size-full wp-image-156" title="XSS Construction" src="http://www.iglobalonline.com/wp-content/ups/2010/03/XSS-Construction.bmp" alt="XSS Construction" /></a></p>
<h2>Contaminating the Exif metadata</h2>
<p>Using a image metadata tool called <a title="http://www.exiv2.org/" href="http://www.exiv2.org/" target="_blank">exiv2</a>, I inject the iframe into the JPEG image by simply writing to the ImageDescription. By calling exiv2 with the -pv flag, you notice the ImageDescription was successfully written.</p>
<p><a href="http://www.iglobalonline.com/wp-content/ups/2010/03/Exif-Injection.bmp"><img class="aligncenter size-full wp-image-160" title="Exif Injection" src="http://www.iglobalonline.com/wp-content/ups/2010/03/Exif-Injection.bmp" alt="Exif Injection" /></a></p>
<p>Link: <a title="http://www.iglobalonline.com/wp-content/ups/2010/03/iglobal.jpg" href="http://www.iglobalonline.com/wp-content/ups/2010/03/iglobal.jpg" target="_blank">Sample image used in example</a></p>
<h2>Testing the payload</h2>
<p>For testing, we will use Mozilla&#8217;s own demo page using FileAPI and an Exif parser written by Jacob Seidelin. The page is located at: <a title="http://demos.hacks.mozilla.org/openweb/FileAPI/" href="http://demos.hacks.mozilla.org/openweb/FileAPI/" target="_blank">http://demos.hacks.mozilla.org/openweb/FileAPI/</a></p>
<p>When you drag and drop the contaminated image into the box in the web app, you immediately notice that the Exif data is parsed and processed without filtering. Since our injection was an iframe, it then loads content from our hosted file.</p>
<p><a href="http://www.iglobalonline.com/wp-content/ups/2010/03/Proof-of-Concept.bmp"><img class="aligncenter size-full wp-image-162" title="Exif Injection - Proof of Concept" src="http://www.iglobalonline.com/wp-content/ups/2010/03/Proof-of-Concept.bmp" alt="Exif Injection - Proof of Concept" width="911" height="636" /></a></p>
<h2>A quick and easy developer work around</h2>
<p>Ok, since this exploitation isn&#8217;t really in FileAPI or Firefox 3.6 but rather the Exif parser within the web application, there isn&#8217;t much that can be done. Developers should always process strings through a filter before rendering it on a page. By doing this, you take complete control of how and what renders within your users browser eliminating the possibility of malicious code being executed.</p>
<h2>UPDATE: 03/28/2010</h2>
<p>After releasing to Full Disclosure, it was reported to Mozilla and they have since removed access to the demo site until it is fixed. I probably should have notified Mozilla myself but since it was just a silly XSS in a demo site, it didnt cross my mind.</p>
<p>Ref: <a title="https://bugzilla.mozilla.org/show_bug.cgi?id=555574" href="https://bugzilla.mozilla.org/show_bug.cgi?id=555574" target="_blank">https://bugzilla.mozilla.org/show_bug.cgi?id=555574</a></p>

	All Tags: <a href="http://www.iglobalonline.com/tag/browser/" title="browser" rel="tag nofollow">browser</a>, <a href="http://www.iglobalonline.com/tag/exif/" title="EXIF" rel="tag nofollow">EXIF</a>, <a href="http://www.iglobalonline.com/tag/exiv2/" title="exiv2" rel="tag nofollow">exiv2</a>, <a href="http://www.iglobalonline.com/tag/fileapi/" title="FileAPI" rel="tag nofollow">FileAPI</a>, <a href="http://www.iglobalonline.com/tag/firefox-3-6/" title="Firefox 3.6" rel="tag nofollow">Firefox 3.6</a>, <a href="http://www.iglobalonline.com/tag/injection/" title="injection" rel="tag nofollow">injection</a>, <a href="http://www.iglobalonline.com/tag/metadata/" title="metadata" rel="tag nofollow">metadata</a>, <a href="http://www.iglobalonline.com/tag/xss/" title="XSS" rel="tag nofollow">XSS</a><br />
]]></content:encoded>
			<wfw:commentRss>http://www.iglobalonline.com/2010/03/26/firefox-3-6-fileapi-exif-injection/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
