<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title><![CDATA[[SecurityRatty] tag: jpeg]]></title>
    <link>http://securityratty.com/tag/jpeg</link>
    <description></description>
    <pubDate>Wed, 19 Sep 2007 20:20:27 +0000</pubDate>
    <generator>iRatty Engine</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <item>
      <title><![CDATA[Auditing open source software]]></title>
      <link>http://securityratty.com/article/59467548fd840375c0d60473f6181fe5</link>
      <guid>http://securityratty.com/article/59467548fd840375c0d60473f6181fe5</guid>
      <description><![CDATA[Written by Chris Evans, Security Team

Google encourages its employees to contribute back to the open source community, and there is no exception in Google's Security Team. Let's look at some...]]></description>
      <content:encoded><![CDATA[<span class="byline-author">Written by Chris Evans, Security Team</span><br /><br />Google encourages its employees to contribute back to the open source community, and there is no exception in Google's Security Team. Let's look at some interesting open source vulnerabilities that were located and fixed by members of Google's Security team. It is interesting to classify and aggregate the code flaws leading to the vulnerabilities, to see if any particular type of flaw is more prevalent.<br /><ol><li><b>JDK</b>. In May 2007, I <a title="released details" href="http://scary.beasts.org/security/CESA-2006-004.html" id="ro-g">released details</a> on an interesting bug in the ICC profile parser in Sun's JDK. The bug is particularly interesting because it could be exploited by an evil image. Most previous JDK bugs involve a user having to run a whole evil applet. The key parts of code which demonstrate the bug are as follows:<br /><blockquote><code style="font-size: 120%"><br />TagOffset = SpGetUInt32 (&Ptr);<br />if (ProfileSize &lt TagOffset)<br />&nbsp;&nbsp;return SpStatBadProfileDir;<br />...<br />TagSize = SpGetUInt32 (&Ptr);<br />if (ProfileSize &lt TagOffset + TagSize)<br />&nbsp;&nbsp;return SpStatBadProfileDir;<br />...<br />Ptr = (KpInt32_t *) malloc ((unsigned int)numBytes+HEADER);<br /></code></blockquote><br />Both TagSize and TagOffset are untrusted unsigned 32-bit values pulled out of images being parsed. They are added together, causing a classic integer overflow condition and the bypass of the size check. A subsequent additional integer overflow in the allocation of a buffer leads to a heap-based buffer overflow. </li><br /><li><b>gunzip</b>. In September 2006, my colleague Tavis Ormandy <a title="reported some interesting vulnerabilities" href="http://www.scary.beasts.org/security/tavis_gzip.txt" id="qbd9">reported some interesting vulnerabilities</a> in the gunzip decompressor. They were triggered when an evil compressed archive is decompressed. A lot of programs will automatically pass compressed data through gunzip, making it an interesting attack. The key parts of the code which demonstrate one of the bugs are as follows:<br /><blockquote><code style="font-size: 120%"><br />ush count[17], weight[17], start[18], *p;<br />...<br />for (i = 0; i &lt (unsigned)nchar; i++) count[bitlen[i]]++;<br /></code></blockquote><br />Here, the stack-based array "count" is indexed by values in the "bitlen" array. These values are under the control of data in the incoming untrusted compressed data, and were not checked for being within the bounds of the "count" array. This led to corruption of data on the stack.</li><br /><br /><li><b>libtiff</b>. In August 2006, Tavis <a title="reported a range of security vulnerabilities" href="http://www.scary.beasts.org/security/tavis_libtiff.txt" id="lkkz">reported a range of security vulnerabilities</a> in the libtiff image parsing library. A lot of image manipulation programs and services will be using libtiff if they handle TIFF format files. So, an evil TIFF file could compromise a lot of desktops or even servers. The key parts of the code which demonstrate one of the bugs are as follows:<br /><blockquote><code style="font-size: 120%"><br />if (sp-&gt;cinfo.d.image_width != segment_width ||<br />&nbsp;&nbsp;&nbsp;&nbsp;sp-&gt;cinfo.d.image_height != segment_height) {<br />&nbsp;&nbsp;TIFFWarningExt(tif-&gt;tif_clientdata, module,<br />&nbsp;&nbsp;&nbsp;&nbsp;"Improper JPEG strip/tile size, expected %dx%d, got %dx%d",<br /></code></blockquote><br />Here, a TIFF file containing a JPEG image is being processed. In this case, both the TIFF header and the embedded JPEG image contain their own copies of the width and height of the image in pixels. This check above notices when these values differ, issues a warning, and continues. The destination buffer for the pixels is allocated based on the TIFF header values, and it is filled based on the JPEG values. This leads to a buffer overflow if a malicious image file contains a JPEG with larger dimensions than those in the TIFF header. Presumably the intent here was to support broken files where the embedded JPEG had smaller dimensions than those in the TIFF header. However, the consequences of larger dimensions that those in the TIFF header had not been considered.</li></ol><br />We can draw some interesting conclusions from these bugs. The specific vulnerabilities are integer overflows, out-of-bounds array accesses and buffer overflows. However, the general theme is using an integer from an untrusted source without adequately sanity checking it. Integer abuse issues are still very common in code, particular code which is decoding untrusted binary data or protocols. We recommend being careful using any such code until it has been vetted for security (by extensive code auditing, fuzz testing, or preferably both). It is also important to watch for security updates for any decoding software you use, and keep patching up to date.<img src="http://feeds.feedburner.com/~r/GoogleOnlineSecurityBlog/~4/167194174" height="1" width="1"/>]]></content:encoded>
      <pubDate>Mon, 08 Oct 2007 12:13:00 +0000</pubDate>
      <category domain="http://securityratty.com/tag/image">image</category>
      <category domain="http://securityratty.com/tag/malicious image file">malicious image file</category>
      <category domain="http://securityratty.com/tag/libtiff image">libtiff image</category>
      <category domain="http://securityratty.com/tag/values">values</category>
      <category domain="http://securityratty.com/tag/jpeg image">jpeg image</category>
      <category domain="http://securityratty.com/tag/tiff header values">tiff header values</category>
      <category domain="http://securityratty.com/tag/source">source</category>
      <category domain="http://securityratty.com/tag/evil tiff file">evil tiff file</category>
      <category domain="http://securityratty.com/tag/evil">evil</category>
      <source url="http://feeds.feedburner.com/~r/GoogleOnlineSecurityBlog/~3/167194174/auditing-open-source-software.html">Auditing open source software</source>
    </item>
    <item>
      <title><![CDATA[Forensic Metadata in Word Docs and Jpegs supporting Exif]]></title>
      <link>http://securityratty.com/article/b343f711353fd5c843ba4f43888c9039</link>
      <guid>http://securityratty.com/article/b343f711353fd5c843ba4f43888c9039</guid>
      <description><![CDATA[New Video: Forensic Metadata in Word Docs and Jpegs supporting Exif
Metadata is data about data. Different file formats store extra data about themselves in different ways. This video will cover...]]></description>
      <content:encoded><![CDATA[New Video:
<a href="http://www.irongeek.com/i.php?page=videos/forensic-metadata-in-word-docs-and-jpegs-supporting-exif">
Forensic Metadata in Word Docs and Jpegs supporting Exif</a><br>
Metadata is data about data. Different file formats store extra data about 
themselves in different ways. This video will cover metadata that can be used 
during a forensic investigation, namely MS Word doc metadata and the metadata 
stored in a Jpeg's Exif data. Also, if you are an educational institution that 
uses my videos in class, please let me know so I can add you to the
<a href="http://www.irongeek.com/i.php?page=university-campuses-that-use-irongeek-for-teaching-infosec-in-higher-education">
Irongeek Campuses page</a>.]]></content:encoded>
      <pubDate>Wed, 19 Sep 2007 20:20:27 +0000</pubDate>
      <category domain="http://securityratty.com/tag/metadata">metadata</category>
      <category domain="http://securityratty.com/tag/forensic metadata">forensic metadata</category>
      <category domain="http://securityratty.com/tag/cover metadata">cover metadata</category>
      <category domain="http://securityratty.com/tag/exif">exif</category>
      <category domain="http://securityratty.com/tag/word doc metadata">word doc metadata</category>
      <category domain="http://securityratty.com/tag/data">data</category>
      <category domain="http://securityratty.com/tag/exif data">exif data</category>
      <category domain="http://securityratty.com/tag/word docs">word docs</category>
      <category domain="http://securityratty.com/tag/irongeek campuses page">irongeek campuses page</category>
      <source url="http://www.irongeek.com/i.php?page=videos/forensic-metadata-in-word-docs-and-jpegs-supporting-exif">Forensic Metadata in Word Docs and Jpegs supporting Exif</source>
    </item>
  </channel>
</rss>
