<?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>Hexacorn Ltd</title>
	<atom:link href="http://www.hexacorn.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hexacorn.com/blog</link>
	<description>Hexacorn Ltd</description>
	<lastBuildDate>Sat, 18 May 2013 15:14:32 +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>The Hades haz you. Phantom (유령) &#8211; The DFIR drama from South Korea</title>
		<link>http://www.hexacorn.com/blog/2013/05/18/the-hades-haz-you-phantom-%ec%9c%a0%eb%a0%b9-the-dfir-drama-from-south-korea/</link>
		<comments>http://www.hexacorn.com/blog/2013/05/18/the-hades-haz-you-phantom-%ec%9c%a0%eb%a0%b9-the-dfir-drama-from-south-korea/#comments</comments>
		<pubDate>Sat, 18 May 2013 15:08:55 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Others]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1895</guid>
		<description><![CDATA[The way the movies portray hacking, forensics, security research and coding is obviously metaphoric and usually made as visually rich as possible to ensure the audience &#8216;gets it&#8217; and as [...]]]></description>
				<content:encoded><![CDATA[<p>The way the movies portray hacking, forensics, security research and coding is obviously metaphoric and usually made as visually rich as possible to ensure the audience &#8216;gets it&#8217; and as a bonus can see how cool the process is. Anyone who spent a few sleepless nights with Olly and Ida Pro, worked around the clock on forensic cases, reviewed vulnerability reports or source code, or worked in their head on a particular algorithm for a few weeks before actually sitting down and writing the code knows that the reality is a bit more boring <img src='http://www.hexacorn.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you ask a random security pro what are &#8216;the best&#8217; hacking movies they will surely laugh pointing out at least a few from the following list:</p>
<ul>
<li><a href="https://www.youtube.com/watch?v=2efhrCxI4J0">Hackers</a></li>
<li><a href="https://www.youtube.com/watch?v=rjGbvpr_dB8">Swordfish</a></li>
<li><a href="https://www.youtube.com/watch?v=hkDD03yeLnU"> &#8216;the Visual Basic&#8217; episode of CSI</a></li>
<li><a href="https://www.youtube.com/watch?feature=player_detailpage&amp;v=46qKHq7REI4#t=21s">The Net (IP 23.75.345.200 <img src='http://www.hexacorn.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </a></li>
<li><a href="http://www.youtube.com/watch?feature=player_detailpage&amp;v=mIq9jFdEfZo#t=99s">The Golden Eye</a></li>
<li><a href="http://www.youtube.com/watch?v=aApTVqeGJMw">Skyfall </a></li>
<li><a href="https://www.youtube.com/watch?feature=player_detailpage&amp;v=vAf9mUnafcQ#t=36s">Social Network</a></li>
</ul>
<p>..and perhaps at some stage they will suddenly become a bit more serious and mention that &#8216;but Matrix did show <a href="http://nmap.org/movies/">NMAP</a> in action&#8217;.</p>
<p>Luckily, there are actually movies out there that beat all the above mentioned productions in terms of technical accuracy, and show a relatively realistic representation of  IT security work.</p>
<p>This post is about one of them.</p>
<p>A while ago I happened to stumble upon a Korean TV Drama called &#8220;<a href="http://www.amazon.com/Ghost-Phantom-Korean-Region-Episodes/dp/B00C6SK9LY">Phantom</a>&#8221; (also know as &#8220;<a href="http://www.yesasia.com/global/the-ghost-dvd-ep-1-20-end-multi-audio-english-subtitled-sbs-tv-drama/1032410357-0-0-0-en/info.html">Ghost</a>&#8220;) that made my jaws drop. The drama was produced by a Korean Network <a href="http://tv.sbs.co.kr/phantom/">SBS</a>.</p>
<p>The plot of the drama is simple &#8211; The <a href="https://www.youtube.com/watch?v=v2gfBJ7MeN0">Hades</a> haz you <img src='http://www.hexacorn.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/05/hades.png"><img class="aligncenter size-full wp-image-1903" alt="hades" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/05/hades.png" width="622" height="309" /></a></p>
<p style="text-align: center;"><span>Copyright notice: The picture of Hades logo was taken from the clip on Youtube. The copyright belongs to SBS.</span></p>
<p>Okay, the <a href="http://asianwiki.com/Phantom_%28Korean_Drama%29">plot</a> is a bit more complicated &#8211; it&#8217;s a &#8220;Face off&#8221; meet &#8220;Jason Bourne&#8221; meet CSI.</p>
<p>Or</p>
<p>Evil Hackers from Korea and Hong Kong vs. Forensic guys from Korean Police.</p>
<p>Since it&#8217;s not IMDB, just a short note on the movie &#8211; I have already described bits of the plot; I don&#8217;t want to spoil it so I won&#8217;t add more information here. The music is all right. The acting is so so (the lead characters are a little bit too stiff and rarely smile). There are gaps in the story as well, but it&#8217;s a TV Drama after all, and it&#8217;s Korean so there is lots of melodrama &#8216;by default&#8217;. There is also a very strong product placement, but if this the only way to get funds to make TV dramas then so be it.</p>
<p>Okay, back to &#8216;technical&#8217; stuff.</p>
<p>What makes this particular TV Drama stand out is the attention to details. While they didn&#8217;t completely escape typical Hollywood cliché (computers with the evidence are thrown out of the window, logic bombs with a progress bar, etc.) the makers really did their homework and put quite an effort to demonstrate how a typical hacking works. And how forensic guys investigate it.</p>
<p>Lots of scenes are taken in the forensic lab, or on the crime scene &#8211; in internet coffee shops, data centers, etc.. We also witness the actual data acquisition, evidence analysis (HDD, mobile, CCTV footage, video manipulation analysis, social media, Event Logs) and most importantly &#8211; lots of popular DFIR/RCE software is used to &#8216;understand&#8217; the data and code. This is really not just a single random tool or a hand made HTML page that is supposed to look like &#8216;analysis results&#8217;. Quite the opposite &#8211; many of the most common tools from the DFIR/RCE/pentesting arsenal somehow found its way to the drama.</p>
<p>The software I remember seeing includes:</p>
<ul>
<li>Encase</li>
<li>WinHex</li>
<li>Metasploit</li>
<li>OllyDbg</li>
<li>DCode</li>
<li>SecureCRT</li>
<li>Wireshark</li>
<li>XRY</li>
<li>BackTrack</li>
<li>Process Explorer</li>
</ul>
<p>and lots more (I wish I took notes!).</p>
<p>Last, but not least &#8211; there are also realistic attacks being used as a part of the plot including, but not limited to:</p>
<ul>
<li>0Day exploits (using documents from Hangul Word Processor)</li>
<li>malware infections</li>
<li>billboard hacking</li>
<li>spoofed emails</li>
<li>identity theft</li>
<li>SCADA attacks</li>
<li>car hacking</li>
<li>hacking back in real time</li>
<li>DDoS attacks</li>
<li>Wi-Fi hacking</li>
<li>social engineering</li>
</ul>
<p>and lo and behold &#8211; even STUXNET is mentioned!</p>
<p>Thumbs up South Korea!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/05/18/the-hades-haz-you-phantom-%ec%9c%a0%eb%a0%b9-the-dfir-drama-from-south-korea/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UVWATAUAVAWH &#8211; Meet The Pushy String</title>
		<link>http://www.hexacorn.com/blog/2013/05/16/uvwatauavawh-meet-the-pushy-string/</link>
		<comments>http://www.hexacorn.com/blog/2013/05/16/uvwatauavawh-meet-the-pushy-string/#comments</comments>
		<pubDate>Thu, 16 May 2013 16:06:01 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Batch Analysis]]></category>
		<category><![CDATA[Malware Analysis]]></category>
		<category><![CDATA[Silly]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1887</guid>
		<description><![CDATA[The title of this post is not a secret message and I am not intoxicated. UVWATAUAVAWH happens to be the most popular string extracted from all .exe, .dll and .sys [...]]]></description>
				<content:encoded><![CDATA[<p>The title of this post is not a secret message and I am not intoxicated.</p>
<p>UVWATAUAVAWH happens to be the most popular string extracted from all .exe, .dll and .sys OS files on my 64-bit Windows. The string is so popular and at the same time suspicious that if you google it you will find people theorizing about it having something to do with BSODs / being a part of some internal ZeroAccess secret language.</p>
<p>If you convert the characters into hex:</p>
<pre style="padding-left: 30px;">UVWATAUAVAWH</pre>
<p>you will get a string of bytes like these:</p>
<pre style="padding-left: 30px;">55 56 57 41 54 41 55 41 56 41 57 48</pre>
<p>and these can be also represented as opcodes:</p>
<pre style="padding-left: 30px;">U  - push    rbp</pre>
<pre style="padding-left: 30px;">V  - push    rsi</pre>
<pre style="padding-left: 30px;">W  - push    rdi</pre>
<pre style="padding-left: 30px;">AT - push    r12</pre>
<pre style="padding-left: 30px;">AU - push    r13</pre>
<pre style="padding-left: 30px;">AV - push    r14</pre>
<pre style="padding-left: 30px;">AW - push    r15</pre>
<pre style="padding-left: 30px;">H  - part of sub rsp, xxx opcode</pre>
<p>The sequence is a very typical prologue for functions  (64-bit code) &#8211; so typical that it is all over the place together with its variants (see below); the &#8216;vowelized&#8217; properties of these strings remind me an interesting paper about <a href="http://www.cs.jhu.edu/~sam/ccs243-mason.pdf">shellcodes that look like English text</a>.</p>
<pre style="padding-left: 30px;">UVWATAUAVAWH
WATAUH
WATAUAVAWH
SUVWATAUAVAWH
SUVWATH
VWATAUAVH
SUVWATAUH
ATAUAVH
USVWATAUAVAWH
UVWATAUH
SUVWATAUAVH
SVWATAUAVAWH
USVWATH
USVWATAUH
USVWATAUAVH
VWATAUAVAWH
WAVAWH
ATAUAVAWH
VWATAUAWH
WATAVH
UVWATAUAVH</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/05/16/uvwatauavawh-meet-the-pushy-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8230;and the most popular day for malware compilation is:</title>
		<link>http://www.hexacorn.com/blog/2013/05/16/and-the-most-popular-day-for-malware-compilation-is/</link>
		<comments>http://www.hexacorn.com/blog/2013/05/16/and-the-most-popular-day-for-malware-compilation-is/#comments</comments>
		<pubDate>Thu, 16 May 2013 12:38:03 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Batch Analysis]]></category>
		<category><![CDATA[Malware Analysis]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1883</guid>
		<description><![CDATA[Saturday. Thursdays, Fridays, Saturdays are the days when the malware is compiled the most often. It kinda makes sense*. Who would like to work Sundays and Mondays?** *remember what they [...]]]></description>
				<content:encoded><![CDATA[<p>Saturday.</p>
<p>Thursdays, Fridays, Saturdays are the days when the malware is compiled the most often.</p>
<p>It kinda makes sense*.</p>
<p>Who would like to work Sundays and Mondays?**</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/05/days_writing_malware.png"><img class="aligncenter size-full wp-image-1884" alt="days_writing_malware" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/05/days_writing_malware.png" width="483" height="291" /></a></p>
<p>*remember what they say about <a href="https://en.wikipedia.org/wiki/Lies,_damned_lies,_and_statistics">statistics</a> <img src='http://www.hexacorn.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (data based on 2.5M samples)<br />
**obviously, the APT guys</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/05/16/and-the-most-popular-day-for-malware-compilation-is/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8230;and the most popular windows account for compiling malware is:</title>
		<link>http://www.hexacorn.com/blog/2013/05/08/and-the-most-popular-windows-account-for-compiling-malware-is/</link>
		<comments>http://www.hexacorn.com/blog/2013/05/08/and-the-most-popular-windows-account-for-compiling-malware-is/#comments</comments>
		<pubDate>Wed, 08 May 2013 19:33:04 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Batch Analysis]]></category>
		<category><![CDATA[Malware Analysis]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1877</guid>
		<description><![CDATA[Administrator. Many malware samples contain debug strings that include paths often directly pointing to a location where the source code is stored and so it happens that often it&#8217;s also [...]]]></description>
				<content:encoded><![CDATA[<p>Administrator.</p>
<p>Many malware samples contain debug strings that include paths often directly pointing to a location where the source code is stored and so it happens that often it&#8217;s also a location under the USERPROFILE. For the fun of it, I extracted the strings from a large batch of samples and came up with the following statistics (showing top 50):</p>
<pre>   3893 Administrator
   2963 JUANJO
   1121 ryanch
    928 Boy
    617 UserXP
    612 user
    519 1337
    502 User
    465 Admin
    435 root
    422 bld4act
    418 Owner
    347 nosferatus
    305 Administrateur
    300 M4x
    296 ismael
    277 goga
    277 Kyle
    255 Mirko
    247 1134
    244 kdglkrkjdfhslej
    241 FEDERIKO
    234 t0fx
    231 rstephens
    219 DarkCoderSc
    218 gcc
    205 icyheart
    200 Dave
    197 michael
    197 Roshan
    197 James
    195 Ben
    182 John
    178 admin
    173 Dev
    161 box1
    157 nonadmin
    153 FELIPE
    152 Familie
    151 Timothy
    137 Dhivin
    133 Vortex
    131 Robert
    130 dabdoub
    129 USER
    127 dr zinou
    125 packar
    122 David
    116 nathu
    116 Daniel</pre>
<p>It&#8217;s obviously biased.</p>
<p>Other interesting names include:</p>
<ul>
<li>tom age five</li>
<li>GANGSTA</li>
<li>Krusty the Clown</li>
<li>^_^</li>
<li>ItchyFingerz</li>
<li>irishboy</li>
<li>romantic</li>
<li>lol</li>
<li>brad pitt</li>
<li>Love Bebe</li>
<li>LorD^^$$steal3R</li>
<li>Cyber-Warrior Ender</li>
<li>auchan</li>
<li>F-B-I</li>
<li>Valued Sony Customer</li>
<li>SexyReplay</li>
<li>Microsoft</li>
<li>Poo</li>
<li>Trojan</li>
<li>P@wn3d</li>
<li>Emperor Zhou Tai Nu</li>
</ul>
<p>There are over 7000 account names on the list. If you want the full list, please contact me offline.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/05/08/and-the-most-popular-windows-account-for-compiling-malware-is/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JumpLists file names and AppID calculator</title>
		<link>http://www.hexacorn.com/blog/2013/04/30/jumplists-file-names-and-appid-calculator/</link>
		<comments>http://www.hexacorn.com/blog/2013/04/30/jumplists-file-names-and-appid-calculator/#comments</comments>
		<pubDate>Tue, 30 Apr 2013 20:16:05 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Forensic Analysis]]></category>
		<category><![CDATA[Software Releases]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1859</guid>
		<description><![CDATA[JumpList files are an interesting forensic artifact and as such they have been thoroughly explored by many researchers over last 2-3 years. There is really a lot of material out [...]]]></description>
				<content:encoded><![CDATA[<p>JumpList files are an interesting forensic artifact and as such they have been thoroughly explored by many researchers over last 2-3 years. There is really a lot of material out there and there are also many tools that parse JumpList files&#8217; structure quite well. This is why in this post I will focus not on the content of JumpList files, but on their&#8230; file names.</p>
<h2>Algorithm</h2>
<p>The JumpList file names are created using hash-like values that in turn are based on something that is called <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd378459%28v=vs.85%29.aspx">AppID</a>. The Forensics Wiki lists many known <a href="http://www.forensicswiki.org/wiki/List_of_Jump_List_IDs">Jump List file names</a> based on AppIDs; examples include:<strong><br />
</strong></p>
<ul>
<li><strong>918e0ecb43d17e23</strong> used by Notepad (32-bit)</li>
<li><strong>9b9cdc69c1c24e2b</strong> used by Notepad (64-bit)</li>
<li><strong>1bc392b8e104a00e </strong>used by Remote Desktop</li>
</ul>
<p>and so on and so forth. The data from Forensics Wiki has been harvested from many sources and it&#8217;s a very useful reference for further research.</p>
<p>The algorithm to create a hash-like value is actually &#8216;sort of known&#8217;. There are posts out there suggesting that the AppID is a nothing but a CRC64 sum taken from the application path. For example, in this <a href="http://www.4n6k.com/2011/09/jump-list-forensics-appids-part-1.html">post</a>, an Anonymous poster provided a Hexrays Decompiler&#8217;s code snapshot taken from shell32.dll showing how the AppID is generated. When I came across this particular comment I decided to verify it. I applied CRC64 sum to an example path and compared it with an expected known file name, and since you are reading this post you are probably guessing that it failed miserably <img src='http://www.hexacorn.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Okay, so since it failed and since the algorithm didn&#8217;t t seem to be explored in-depth yet I thought I will give it a go. It turned out to be quite simple, but there were a few challenges on the way that may be interesting to know about so I describe it below. I also ended up writing a perl script that I called AppID calculator (appid_calc.pl). It allows you to calculate an AppID based on provided string &#8211; more about it below as well. You can find a download link to the script at the bottom of this post.</p>
<h2>Challenges</h2>
<p>Using the code snippet I referred to earlier as a guidance, I quickly found the code responsible for generating AppIDs, put the appropriate breakpoints in a debugger, and.. immediately understood why the CRC64 (path) didn&#8217;t work for me earlier <img src='http://www.hexacorn.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The CRC64 algorithm has been indeed applied to a path, but there are a few quirks:</p>
<ul>
<li>The path is first converted to Unicode</li>
<li>If the path is located in one of locations that are recognized and treated by system in a special way, the path is normalized first</li>
<li>The CRC64(Path) algorithm applies only to AppIDs automatically generated by the system; At any point of time any application can change its AppID either using the <em>SetCurrentProcessExplicitAppUserModelID</em> API, or can even apply window-specific AppID using  <em>IPropertyStore::SetValue</em> to change the <em>PKEY_AppUserModel_ID</em> property of  the particular <a href="https://blogs.msdn.com/b/oldnewthing/archive/2012/08/17/10340743.aspx">window</a></li>
<li>On top of that, the CRC64 uses a non-standard polynomial</li>
</ul>
<p>First, let&#8217;s talk about the CRC64. There are many CRC algorithms out there. In fact, the difference is not only between the length in bits (CRC16, CRC32, CRC64), but also in the configuration of a particular implementation. There are obviously many standard configurations (<a href="https://en.wikipedia.org/wiki/Cyclic_redundancy_check">Wikipedia described quite a few</a>), but the one used in AppID generation is not on the standard list. I know, because the very first thing I tried was to use all standard configurations, but all of them failed <img src='http://www.hexacorn.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .</p>
<p>The actual code used by the system relies on a precalculated lookup table, but googling around for the numbers from the table only brought 2-3 hits. In such case, the usual way of solving the issue is to rip the code from the source and reimplement it e.g. in perl.  This could be done easily. The 2-3 hits I mentioned earlier refer to a code that was created as a result of reverse engineering of thumbcache.dll  file &#8211; turns out that the very exact CRC64 configuration/implementation has been used in that DLL.</p>
<p>Exploring the properties of CRC I eventually managed to deduce the CRC configuration and the actual polynomial used to generate the lookup table.</p>
<p>The polynomial used by the AppID algorithm is <span style="color: #ff0000;"><strong>0x92C64265D32139A4</strong></span>.</p>
<p>Once I found out I went to google again and this time I also got 2-3 hits only. First two were on the Thumb Cache-related code I already mentioned. The last one was the Microsoft page describing the use of this particular polynomial in a <a href="http://msdn.microsoft.com/en-us/library/hh554834.aspx">ADSStreamHeader</a> structure:</p>
<p style="padding-left: 30px;"><strong>Crc (8 bytes): </strong>A bit-reversed CRC-64 hash of the FCIADS stream from the <strong>TimeStamp</strong> field to the end of the structure that can be used to validate the integrity of the FCIADS stream. The cyclic redundancy check (CRC) polynomial is x**64 + x**61 + x**58 + x**56 + x**55 + x**52 + x**51 + x**50 + x**47 + x**42 + x**39 + x**38 + x**35 + x**33 + x**32 + x**31 + x**29 + x**26 + x**25 + x**22 + x**17 + x**14 + x**13 + x**9 + x**8 + x**6 + x**3 + 1, with the leading 1 implied. The normal representation is <span style="color: #ff0000;">0x92C64265D32139A4</span>.</p>
<p>That was a good sign and I could now start implementing the appid calculator w/o ripping the lookup tables.</p>
<p>The second issue to solve was the normalization.  The paths are normalized using <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd378457%28v=vs.85%29.aspx">KNOWNFOLDERIDs</a>, so it&#8217;s a simple search and replace before applying the CRC.</p>
<p>One aspect of normalization I need to mention is&#8230; ambiguity. Depending on the OS (32 vs. 64 bit) different KNOWNFOLDERIDs are applied during the normalization path and it&#8217;s quite confusing. I suggest reading the Microsoft page I linked to above for further details.</p>
<p>Last, but not least. &#8211; quite a lot applications use <em>SetCurrentProcessExplicitAppUserModelID</em> API to change their AppID after they are executed. For example, the following applications do it (AppID &#8211; application name):</p>
<ul>
<li><strong>Microsoft.Silverlight.Offline</strong> &#8211; Silverlight</li>
<li><strong>Microsoft.InternetExplorer.Default</strong> &#8211; Internet Explorer</li>
<li><strong>VMware.Workstation.vmplayer</strong> &#8211; VMWare Player</li>
<li><strong>Microsoft.Windows.MediaPlayer32</strong> &#8211; Windows Media Player (32-bit)</li>
<li><strong>Microsoft.Windows.MediaPlayer64</strong> &#8211; Windows Media Player (64-bit)</li>
</ul>
<p>For this reason, attempting to find e.g. AppID of <em>c:\program files\Internet Explorer\iexplore.exe</em> doesn&#8217;t really make sense as all IE windows are grouped under <strong>Microsoft.InternetExplorer.Default</strong> AppID.</p>
<h2>Examples</h2>
<h4>AppIDs of InternetExplorer and Sticky Notes</h4>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_1.png"><img class="aligncenter size-full wp-image-1863" alt="appid_1" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_1.png" width="541" height="323" /></a></p>
<p>These can be confirmed by looking at Forensic Wiki:</p>
<ul>
<li><strong>Microsoft.InternetExplorer.Default</strong> &#8211; <strong>28C8B86DEAB549A1</strong></li>
</ul>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_2.png"><img class="aligncenter size-full wp-image-1864" alt="appid_2" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_2.png" width="665" height="331" /></a></p>
<ul>
<li><strong>Microsoft.Windows.StickyNotes</strong> &#8211; <strong>337ED59AF273C758</strong></li>
</ul>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_3.png"><img class="aligncenter size-full wp-image-1865" alt="appid_3" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_3.png" width="591" height="265" /></a></p>
<h4> Notepad</h4>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_4.png"><img class="aligncenter size-full wp-image-1866" alt="appid_4" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_4.png" width="801" height="324" /></a></p>
<p>You may notice that in this example there are 2 different AppIDs shown. This is because of the ambiguity I mentioned earlier; applications running on 64-bit systems can be executed in more than one configuration and since there is WOW64 folder redirection happening AppID needs to be calculated in a context.</p>
<p>The Notepad path looks the same to both 32- and 64-bit application (because of WOW64 folder redirection):</p>
<ul>
<li>c:\windows\system32\notepad.exe</li>
</ul>
<p>but the AppID depends on a type of Notepad .exe file:</p>
<ul>
<li>if it is 32-bit, the AppID is <strong>918E0ECB43D17E23 </strong></li>
<li>if 64-bit, the AppID is <strong>9B9CDC69C1C24E2B</strong>.</li>
</ul>
<p>This can be also confirmed via Forensic Wiki:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_6.png"><img class="aligncenter size-full wp-image-1869" alt="appid_6" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_6.png" width="768" height="102" /></a></p>
<h4>Internet Explorer &#8211; via path</h4>
<p>It gets even more complicated with Program Files folder as it has two versions &#8211; with and without (X86) and 32-/64- bit applications both &#8216;see&#8217; Program Files the same way. As an example we could try to generate a hash for Internet Explorer in various configurations by running appid calculator and providing to it a path to <em>c:\Program Files\Internet Explorer\iexplore.exe</em>. As mentioned earlier IE uses an AppID that it sets up during the launch, so you should never see AppIDs shown on the screenshot below, but it is a simple example to show various configurations of <em>Program Files</em> folder using a well-known path.</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_5.png"><img class="aligncenter size-full wp-image-1868" alt="appid_5" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/appid_5.png" width="722" height="351" /></a></p>
<p>Again, I strongly suggest reading the Microsoft Article about <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd378457%28v=vs.85%29.aspx">KNOWNFOLDERIDs</a>, The appid calculator provides a link to it as well if the path is known to be ambiguous (system32, program files, program files\common).</p>
<h2>Download</h2>
<p>You can find the script <a href="http://www.hexacorn.com/tools/appid_calc.pl">here</a>. This is a first version, coded in a hurry so it may contain bugs. If you find any issues, please let me know. Thanks!</p>
<p>To run:</p>
<pre style="padding-left: 30px;">perl appid_calc.pl</pre>
<p>If no argument is passed to it, it will calculate a few sample AppIDs &#8211; the examples illustrate various ways one can provide the path to the script:</p>
<ul>
<li>c:\windows\notepad.exe</li>
<li>c:\windows\system32\notepad.exe</li>
<li>c:\windows\syswow64\notepad.exe</li>
<li>{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\notepad.exe</li>
<li>c:\program files\Internet Explorer\iexplore.exe</li>
<li>MICROSOFT.INTERNETEXPLORER.DEFAULT</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/04/30/jumplists-file-names-and-appid-calculator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java cache file names</title>
		<link>http://www.hexacorn.com/blog/2013/04/19/java-cache-file-names/</link>
		<comments>http://www.hexacorn.com/blog/2013/04/19/java-cache-file-names/#comments</comments>
		<pubDate>Fri, 19 Apr 2013 18:44:52 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Forensic Analysis]]></category>
		<category><![CDATA[Software Releases]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1847</guid>
		<description><![CDATA[I was wondering how Java generates the file names for its temporary cache files and after googling around, I found the answer in the Java source code &#8211; the function [...]]]></description>
				<content:encoded><![CDATA[<p>I was wondering how Java generates the file names for its temporary cache files and after googling around, I found the answer in the Java source code &#8211; the function responsible is called <em>generateCacheFileName</em> and its implementation has changed over the time; here is how they do it in JDK 5 and 6/7:</p>
<p><strong>JDK 5.xx</strong></p>
<p>Files are saved in the following location:</p>
<ul>
<li>
<pre>%USERPROFILE%\Application Data\Sun\Java\Deployment\
cache\javapi\v1.0\[cachefilename]</pre>
</li>
</ul>
<p>The procedure for generating [cachefilename] is described here:</p>
<ul>
<li><a href="http://javasourcecode.org/html/open-source/jdk/jdk-5.0/sun/plugin/cache/Cache.java.html#line.249">http://javasourcecode.org/html/open-source/jdk/jdk-5.0/sun/plugin/cache/Cache.java.html#line.249</a></li>
</ul>
<p><strong>JDK 6.xx-7.xx</strong></p>
<p>Files are saved in the following location:</p>
<ul>
<li>
<pre>%USERPROFILE%\Local Settings\Application Data\Sun\Java\Deployment\
cache\6.0\[cachebucket]\[cachefilename]</pre>
</li>
</ul>
<p>The procedure for generating [cachebucket]\[cachefilename] is described here:</p>
<ul>
<li><a href="http://javasourcecode.org/html/open-source/jdk/jdk-6u23/com/sun/deploy/cache/Cache.java.html#line.2013">http://javasourcecode.org/html/open-source/jdk/jdk-6u23/com/sun/deploy/cache/Cache.java.html#line.2013</a></li>
</ul>
<p><strong>The code</strong></p>
<p>I ripped the code from these sources and created a simple java snippet that helps to test cache file name for a given URL. At the moment it has a small bug, but I hope you won&#8217;t notice it <img src='http://www.hexacorn.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Example &#8211; JRE 1.5</strong></p>
<p>I googled around and found an old applet that worked under JRE 1.5, then visited the page so that the cached files could be created; the URL passed to the cachename Java program produces exactly same result:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/javacache_1.jpg"><img class="aligncenter size-full wp-image-1850" alt="javacache_1" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/javacache_1.jpg" width="615" height="132" /></a></p>
<p><strong>Example &#8211; JRE 1.6-1.7</strong></p>
<p>I simply visited Oracle web page that detects the browser and let the applet load:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/javacache_2.jpg"><img class="aligncenter size-full wp-image-1851" alt="javacache_2" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/04/javacache_2.jpg" width="620" height="156" /></a><br />
<strong>Download</strong></p>
<p>You can download the code <a href="http://www.hexacorn.com/tools/cachename.java">here</a>.</p>
<p>To compile, run:</p>
<pre style="padding-left: 30px;">javac cachename.java</pre>
<p>To execute, run:</p>
<pre style="padding-left: 30px;">java cachename url</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/04/19/java-cache-file-names/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RegRipper Ripper (3R) and the list of reg keys covered by RR plugins</title>
		<link>http://www.hexacorn.com/blog/2013/04/04/regripper-ripper-3r-and-the-list-of-reg-keys-covered-by-rr-plugins/</link>
		<comments>http://www.hexacorn.com/blog/2013/04/04/regripper-ripper-3r-and-the-list-of-reg-keys-covered-by-rr-plugins/#comments</comments>
		<pubDate>Thu, 04 Apr 2013 07:45:46 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[3RPG]]></category>
		<category><![CDATA[Forensic Analysis]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1838</guid>
		<description><![CDATA[update Updated 3R to cover the latest archive from the RegRipper site &#8211; plugins20130403.zip (new version introduced over 40 new scripts) old post I got curious what keys are already [...]]]></description>
				<content:encoded><![CDATA[<p><strong>update</strong></p>
<p>Updated 3R to cover the latest archive from the RegRipper site &#8211; plugins20130403.zip (new version introduced over 40 new scripts)</p>
<p><strong>old post</strong></p>
<p>I got curious what keys are already covered by existing 280+ <a href="https://code.google.com/p/regripper/downloads/list">RegRipper Plugins</a> so I wrote a quick and dirty script to retrieve the data from all plugins in an automated way. For the fun of it, I named the script RegRipper Ripper (3R).</p>
<p>The script is <a href="http://hexacorn.com/tools/3r.pl">here</a>, and the result of running it over the latest bundle is available <a href="http://hexacorn.com/tools/3r.html">here</a>.</p>
<p>You may use the list to see what&#8217;s already covered and&#8230; avoid writing a plugin for a key that is already handled.</p>
<p>The 3R is a dumb script, so a few things I had to fix manually (but still inside the script, so it can be used to regenerate the tables anytime needed, e.g. after the bundle update). I hope there are no mistakes, but if you spot any, please let me know and I will fix that. Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/04/04/regripper-ripper-3r-and-the-list-of-reg-keys-covered-by-rr-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3RPG – 4 RegRipper Plugins in 15 minutes</title>
		<link>http://www.hexacorn.com/blog/2013/03/15/3rpg-4-regripper-plugins-in-15-minutes/</link>
		<comments>http://www.hexacorn.com/blog/2013/03/15/3rpg-4-regripper-plugins-in-15-minutes/#comments</comments>
		<pubDate>Fri, 15 Mar 2013 13:41:21 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[3RPG]]></category>
		<category><![CDATA[Forensic Analysis]]></category>
		<category><![CDATA[Software Releases]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1802</guid>
		<description><![CDATA[In this post I show how to quickly develop 4 plugins using 3RPG. Except for the documentation (this post) it took barely 10-15 minutes. You can download plugins here. 01. [...]]]></description>
				<content:encoded><![CDATA[<p>In this post I show how to quickly develop 4 plugins using <a href="http://hexacorn.com/tools/3rpg.html">3RPG</a>. Except for the documentation (this post) it took barely 10-15 minutes.</p>
<p>You can download plugins <a href="http://hexacorn.com/examples/2013-03-15_3rpg_plugins.zip">here</a>.</p>
<h4>01. Detecting presence of 7zip on the system</h4>
<p>7Zip has a key in the following location</p>
<pre style="padding-left: 30px;">HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip</pre>
<p>This is enough to build the script:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/01_7zip1.png"><img class="aligncenter size-full wp-image-1803" alt="01_7zip1" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/01_7zip1.png" width="321" height="502" /></a></p>
<p>Note that the name of the script is automatically prefixed with an underscore (7zip -&gt; _7zip) for names starting with digits (it&#8217;s because perl doesn&#8217;t &#8216;like&#8217; it).</p>
<p>Also, when you paste the 7zip registry key, and change the focus 3RPG will automatically strip HKEY_LOCAL_MACHINE\SOFTWARE part:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/01_7zip2.png"><img class="aligncenter size-full wp-image-1804" alt="01_7zip2" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/01_7zip2.png" width="251" height="52" /></a>Now click the code &#8211; 3RPG will automatically select it all for your convenience.</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/01_7zip3.png"><img class="aligncenter size-full wp-image-1805" alt="01_7zip3" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/01_7zip3.png" width="417" height="239" /></a></p>
<p>You can now copy this to any editor and save &#8211; use a name highlighted in red and with an extension .pl i.e. _7zip.pl.</p>
<p>Then run:</p>
<pre style="padding-left: 30px;">perl rip.pl -r SOFTWARE.copy0 -p _7zip</pre>
<p>The result:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/01_7zip4.png"><img class="aligncenter size-full wp-image-1807" alt="01_7zip4" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/01_7zip4.png" width="501" height="275" /></a></p>
<h4>02 Listing persistent network mappings</h4>
<p>All mapped drives are listed under the following key:</p>
<pre style="padding-left: 30px;">HKEY_CURRENT_USER\Network</pre>
<p>Again, we run through the same exercise as previously &#8211; this time we include &#8216;Yes, scan subkeys, depth=2&#8242;</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/02_netmap1.png"><img class="aligncenter size-full wp-image-1809" alt="02_netmap1" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/02_netmap1.png" width="349" height="58" /></a></p>
<p>Then run:</p>
<pre style="padding-left: 30px;">perl rip.pl -r NTUSER.DAT -p netmap</pre>
<p>and the result is:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/02_netmap2b.png"><img class="aligncenter size-full wp-image-1832" alt="02_netmap2b" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/02_netmap2b.png" width="533" height="367" /></a></p>
<h3>03. Listing all possible CLSID autostart entries</h3>
<p>Amongst various less-known autostart mechanisms that I listed in my older <a title="Beyond good ol’ Run key" href="http://www.hexacorn.com/blog/2012/07/23/beyond-good-ol-run-key/">post</a> we can find adding or re-using entries of COM servers. Such technique can be used to introduce a man-in-the-middle code for a legitimate plugins, shell extensions, etc. .</p>
<p>The information about the COM servers is stored under the following key:</p>
<pre style="padding-left: 30px;">HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID</pre>
<p>The names of DLLs, EXEs, etc. are usually listed under <em>{Default}</em> value, so the plugin below will list (going recursively through the whole node) all possible <em>{Default} </em>values listed under CLSID node.</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/03_clsid1.png"><img class="aligncenter size-full wp-image-1816" alt="03_clsid1" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/03_clsid1.png" width="434" height="629" /></a></p>
<p>We run it as:</p>
<pre style="padding-left: 30px;">perl rip.pl -r Software2 -p clsid</pre>
<p>And the results are:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/03_clsid2.png"><img class="aligncenter size-full wp-image-1817" alt="03_clsid2" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/03_clsid2.png" width="661" height="407" /></a></p>
<p>This is not a perfect solution as many <em>{Default}</em> values don&#8217;t include a file name, but we could either grep results by specific extension e.g. dll, or patch the script manually and add a better routine (e.g. only list values under <em>InprocServer32</em> and <em>LocalServer32</em>)</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/03_clsid3.png"><img class="aligncenter size-full wp-image-1819" alt="03_clsid3" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/03_clsid3.png" width="483" height="297" /></a></p>
<p>Last, but not least &#8211; running this plugin often probably doesn&#8217;t make sense as it&#8217;s very slow, but it is a simple example that demonstrates how to search for <em>{Default}</em> values.</p>
<h3> 04. Listing keys with binary data</h3>
<p>This is just another simple example showing how REG_BINARY data is presented in the output of plugins generated with 3RGP.</p>
<p>For the example, I will look at the key</p>
<pre style="padding-left: 30px;">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\
CurrentVersion\Print\Printers\Microsoft XPS Document Writer</pre>
<p>associated with Microsoft XPS Document Writer and its value <em>Default DevMode</em>.</p>
<p>I don&#8217;t know what&#8217;s exactly inside this key, but since it contains a binary blob, it will serve the purpose here.</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/04_xps1.png"><img class="aligncenter size-full wp-image-1820" alt="04_xps1" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/04_xps1.png" width="333" height="500" /></a></p>
<p>We run it as:</p>
<pre style="padding-left: 30px;">perl rip.pl -r Software2 -p xps</pre>
<p>And the results are:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/04_xps2.png"><img class="aligncenter size-full wp-image-1821" alt="04_xps2" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/04_xps2.png" width="505" height="310" /></a></p>
<p>That&#8217;s it! Thanks for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/03/15/3rpg-4-regripper-plugins-in-15-minutes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>3RPG &#8211; Rapid RegRipper Plugin Development</title>
		<link>http://www.hexacorn.com/blog/2013/03/14/3rpg-rapid-regripper-plugin-development/</link>
		<comments>http://www.hexacorn.com/blog/2013/03/14/3rpg-rapid-regripper-plugin-development/#comments</comments>
		<pubDate>Thu, 14 Mar 2013 14:54:31 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[3RPG]]></category>
		<category><![CDATA[Forensic Analysis]]></category>
		<category><![CDATA[Software Releases]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1749</guid>
		<description><![CDATA[Inspired by DFIR posts from users (often non-programmers) requesting help with writing/improving RegRipper plugins I created a new tool that aims at developing RR plugins in a much faster way. [...]]]></description>
				<content:encoded><![CDATA[<p>Inspired by DFIR posts from users (often non-programmers) requesting help with writing/improving RegRipper plugins I created a new tool that aims at developing RR plugins in a much faster way.</p>
<p>The tool is called 3RPG and it&#8217;s oriented mainly at non-programmers and less experienced programmers. Of course, if you are an old school perl programmer, go ahead and try it as well. Any feedback and comments will be much appreciated.</p>
<h3>What is 3RPG?</h3>
<p>3RPG is a web form that helps you to quickly build Plugins for <a href="https://code.google.com/p/regripper/wiki/RegRipper">RegRipper</a> by <a href="http://windowsir.blogspot.com/">Harlan Carvey</a>.</p>
<p>You just need to fill-in a few fields and the code of the new plugin will be &#8216;developed&#8217; instantly in front of your eyes.</p>
<p>You can go and check how it works <a href="http://hexacorn.com/tools/3rpg.html">here</a> &#8211; 1000 words worth screenshot should help you to get the idea:</p>
<p style="text-align: center;"><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_1.png"><img class="aligncenter size-full wp-image-1756" alt="3rpg_1" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_1.png" width="563" height="375" /></a></p>
<h3>Benefits a.k.a. why 3RPG was created?</h3>
<p>If you are a non-programmer&#8230;</p>
<ul>
<li>You can use a web form to instantly create your own RegRipper Plugin for a specific registry node/key</li>
<li>If you need to add extra features, you can pass such script with example data to more experienced RegRipper plugin programmers &#8211; trust me, they will appreciate the effort you put into research and will be more eager to help</li>
<li>You can save 3RPG as an HTML page and use it offline</li>
</ul>
<p>If you are a programmer&#8230;</p>
<ul>
<li>You know that writing new RegRipper plugins &#8216;by hand&#8217; is kinda painful i.e. it&#8217;s easier to modify existing script to add features than starting from the scratch</li>
<li>Creating new scripts is usually a copy and paste game &#8211; there is always a chance for making a silly typo or mistake</li>
<li>In general &#8211; in many cases simply (recursively) enumerating a specific registry node/key and cherry-picking something with a simple filter is enough</li>
<li>Also, adding a generic data print mechanism for all possible registry data types helps to quickly &#8216;analyze&#8217; plugins&#8217; output w/o any extra effort</li>
<li>..and this is exactly what the 3RPG offers; more complex scenarios require (obviously) some manual coding</li>
<li>You can also fetch the template and adjust it to your needs manually &#8211; I am confident that with small modifications it may support all possible registry retrieval needs</li>
<li>If you are curious about technical details, I talk about it at the bottom of this post</li>
</ul>
<h3>How to use 3RPG?</h3>
<p>Just go to the <a href="http://hexacorn.com/tools/3rpg.html#wizard">3RPG Wizard</a>, fill in the form (takes 1-2 minutes), then copy and paste the resulting script and save to a file &#8211; once you do, you are ready to go!</p>
<p>To run/test the script, use the newly created file (here myscript) with RegRipper:</p>
<pre style="padding-left: 30px;">perl rip.pl -r &lt;hive&gt; -p myscript</pre>
<p>For a typical script, these fields are required:</p>
<ul>
<li>a script name e.g. <i>myplugin.pl</i></li>
<li>a hive name(s) e.g. <i>Software</i></li>
<li>a node e.g. <i>Microsoft\Windows\CurrentVersion\Run</i></li>
<li>a key name/value (works like a filter) e.g. <i>x86</i></li>
<li>if you want to scan subkeys (recursively, you can also specify the depth)</li>
<li>if you want to include Wow6432Node keys (typically, you do since many new systems are 64-bit)</li>
</ul>
<p>and then leave the rest fields with default values.</p>
<h3>Share!</h3>
<p>If you write a new plugin, share the script with the <a href="https://code.google.com/p/regripperplugins/">community</a> (if you do, please fill-in the rest of the fields to avoid generic/default values in the scripts. Thanks!)</p>
<p>&nbsp;</p>
<h3>Examples</h3>
<h4>Software \ Run key enumeration</h4>
<p>Implementing a classic Run key enumeration for the Software hive is easy &#8211; it&#8217;s actually already written for you on the 3RPG page (it&#8217;s based on default values of 3RPG).</p>
<p>Just copy the script from 3RPG page</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_1c.png"><img class="aligncenter size-full wp-image-1768" alt="3rpg_1c" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_1c.png" width="594" height="451" /></a></p>
<p>and save it as &#8216;myscript.pl&#8217;, then run it as:</p>
<pre style="padding-left: 30px;">rip.pl -r SOFTWARE.copy0 -p myscript</pre>
<p>Running it with a test hive gives the following results:</p>
<p style="text-align: center;"><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_2.png"><img class="aligncenter size-full wp-image-1758" alt="3rpg_2" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_2.png" width="719" height="254" /></a></p>
<h4>Software \ Run key enumeration with a specific value</h4>
<p>A similar example as before, we just want to narrow down the search looking for e.g. for &#8216;MSN&#8217;</p>
<p>We just need to type &#8216;msn&#8217; (it&#8217;s case insensitive) in &#8216;<strong>What keys/values would you like to include?</strong>&#8216; field:</p>
<p><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_3.png"><img class="aligncenter size-full wp-image-1759" alt="3rpg_3" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_3.png" width="321" height="66" /></a></p>
<p>Saving the resulting script and running as previous will only show keys/values/data for values/data that contain &#8216;msn&#8217; (keys are not checked as you are enumerating recursively anyway).</p>
<p><strong><a href="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_4.png"><img class="aligncenter size-full wp-image-1770" alt="3rpg_4" src="http://www.hexacorn.com/blog/wp-content/uploads/2013/03/3rpg_4.png" width="654" height="250" /></a></strong><em></em></p>
<h3>Technical details</h3>
<p>3RPG is a web form. It&#8217;s written in HTML + JavaScript. As a base for the plug-in I relied on my old generic RR plugin template that I used in the past. It exploits the fact that the registry data is stored in a tree-like fashion, so recursive enumeration is a natural way of parsing such data w/o going into intricacies of parsing specific keys, values, and conditional processing. It is also very similar to the way command line reg.exe works when executed with &#8216;query&#8217; or &#8216;query /s&#8217;.</p>
<p>Currently, the following features are supported:</p>
<ul>
<li>3RPG is interactive &#8211; changes to the script are instantly visible and highlighted in the source code</li>
<li>A script name can be specified from the form</li>
<li>A hive can be selected manually, but script will try to select the correct one based on the key i.e. some hive name(s) are automatically selected when key names including substrings like &#8216;HKEY_LOCAL_MACHINE\Software&#8217; are pasted</li>
<li>Enumeration of keys can be recursive, with a specified depth</li>
<li>Filtering of key names/values is possible</li>
<li>Code for parsing Wow6432Node nodes can be added with a single click</li>
<li>Data dumping is supported for all registry data types (non-printable data is printed as hex)</li>
</ul>
<h3>Bugs</h3>
<p>It&#8217;s the first version, so bugs are there for sure; if you spot any, please do let me know.</p>
<p>Thanks in advance!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/03/14/3rpg-rapid-regripper-plugin-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clustering and Batch Analysis of APT1 sampleset, part 3</title>
		<link>http://www.hexacorn.com/blog/2013/03/12/clustering-and-batch-analysis-of-apt1-sampleset-part-3/</link>
		<comments>http://www.hexacorn.com/blog/2013/03/12/clustering-and-batch-analysis-of-apt1-sampleset-part-3/#comments</comments>
		<pubDate>Tue, 12 Mar 2013 19:19:37 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[Batch Analysis]]></category>
		<category><![CDATA[Malware Analysis]]></category>

		<guid isPermaLink="false">http://www.hexacorn.com/blog/?p=1746</guid>
		<description><![CDATA[Part 1, Part 2, Part 3 In the last three posts I talked about batch analysis, clustering and applying these techniques to APT sampleset. Batch processing is a step necessary [...]]]></description>
				<content:encoded><![CDATA[<p><a title="Clustering and Batch Analysis of APT1 sampleset" href="http://www.hexacorn.com/blog/2013/03/04/clustering-and-batch-analysis-of-apt1-sampleset/">Part 1</a>, <a title="Clustering and Batch Analysis of APT1 sampleset, part 2" href="http://www.hexacorn.com/blog/2013/03/05/clustering-and-batch-analysis-of-apt1-sampleset-part-2/">Part 2</a>, <a title="Clustering and Batch Analysis of APT1 sampleset, part 3" href="http://www.hexacorn.com/blog/2013/03/12/clustering-and-batch-analysis-of-apt1-sampleset-part-3/">Part 3</a></p>
<p>In the <a title="Clustering and Batch Analysis" href="http://www.hexacorn.com/blog/2013/03/04/clustering-and-batch-analysis/">last</a> <a title="Clustering and Batch Analysis of APT1 sampleset" href="http://www.hexacorn.com/blog/2013/03/04/clustering-and-batch-analysis-of-apt1-sampleset/">three </a><a title="Clustering and Batch Analysis of APT1 sampleset, part 2" href="http://www.hexacorn.com/blog/2013/03/05/clustering-and-batch-analysis-of-apt1-sampleset-part-2/">posts </a>I talked about batch analysis, clustering and applying these techniques to APT sampleset.</p>
<p>Batch processing is a step necessary for retrieving &#8216;clusterable&#8217; data from samples in an automated fashion.</p>
<p>Clustering is a way of putting these samples into buckets, potentially grouping them into some families.</p>
<p>I want to see if w/o using any assumption/knowledge (retrieved from the white paper or other blogs) it is possible to cluster these samples in a reliable way. It is an interesting experiment and I am curious if I will ever get closer to already known clusters. Quite frankly, I don&#8217;t know yet. We shall see.</p>
<p>The clustering I have done so far was focused on dynamic analysis and a little bit on the source code analysis. In this post I will exploit code analysis further &#8211; this time focusing on disassembled .asm files generated as usual by the <a href="https://www.hex-rays.com/index.shtml">IDA Pro</a>.</p>
<p>The resulting assembly code is quite nice for parsing as each line contains only one line of code &#8211; this allows to group the code into blocks on function boundaries and for each call to API or to another subroutine (including calls via registers), we can extract a simplified code of the program procedures e.g.</p>
<pre style="padding-left: 30px;">sub_401000    proc near        ; CODE XREF: _main+20Ap
[...]

lea    ecx, [esp+310h+szLongPath]
push    104h        ; nSize
push    ecx        ; lpFilename
push    0        ; hModule
<span style="color: #ff0000;"><strong>call    ds:GetModuleFileNameA</strong></span>

lea    edx, [esp+310h+szLongPath]
push    104h        ; cchBuffer
lea    eax, [esp+314h+szLongPath]
push    edx        ; lpszShortPath
push    eax        ; lpszLongPath
<strong><span style="color: #ff0000;">call    ds:GetShortPathNameA</span></strong>

lea    ecx, [esp+310h+Parameters]
push    offset String2    ; "/c del "
push    ecx        ; lpString1
<strong><span style="color: #ff0000;">call    ds:lstrcpyA</span></strong>

mov    esi, ds:lstrcatA
lea    edx, [esp+310h+szLongPath]
lea    eax, [esp+310h+Parameters]
push    edx        ; lpString2
push    eax        ; lpString1
<strong><span style="color: #ff0000;">call    esi ; lstrcatA</span></strong>

lea    ecx, [esp+310h+Parameters]
push    offset s-&gt;&gt;&gt;nul    ; " &gt;&gt;NUL"
push    ecx        ; lpString1
<strong><span style="color: #ff0000;">call    esi ; lstrcatA</span></strong>

mov    esi, ds:ShellExecuteA
push    0        ; nShowCmd
push    offset Directory ; lpDirectory
lea    edx, [esp+318h+File]
push    offset Parameters ; "/c    del wuauclt.exe"
push    edx        ; lpFile
push    offset Operation ; "open"
push    0        ; hwnd
<strong><span style="color: #ff0000;">call    esi ; ShellExecuteA</span></strong>

push    0        ; nShowCmd
push    offset Directory ; lpDirectory
lea    eax, [esp+318h+File]
push    offset s-&gt;CDelSvchost_exe ; "/c    del svchost.exe"
push    eax        ; lpFile
push    offset Operation ; "open"
push    0        ; hwnd
<strong><span style="color: #ff0000;">call    esi ; ShellExecuteA
</span></strong><span style="color: #ff0000;"><span style="color: #000000;">
[...]
retn</span></span><span style="color: #ff0000;"><span style="color: #000000;">sub_401000    endp</span></span><strong></strong></pre>
<p>becomes</p>
<pre style="padding-left: 30px;"><strong><span style="color: #ff0000;">GetModuleFileNameA</span></strong></pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff0000;">GetShortPathNameA</span></strong></pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff0000;">lstrcpyA</span></strong></pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff0000;">lstrcatA</span></strong></pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff0000;">lstrcatA</span></strong></pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff0000;">ShellExecuteA</span></strong></pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff0000;">ShellExecuteA</span></strong></pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff0000;">ShellExecuteA</span></strong></pre>
<p>and can be written as a single line of code</p>
<pre><strong><span style="color: #ff0000;">GetModuleFileNameA|GetShortPathNameA|lstrcpyA|lstrcatA|lstrcatA|ShellExecuteA|ShellExecuteA|ShellExecuteA</span></strong></pre>
<p>Applying such methodology on procedure boundaries and to each disassembled program I eventually came up with a shortened and flattened source code of each sample. I then built a histogram of the most common sequences of such code blocks across all the source code from all files and got the following stats:</p>
<pre>   5514 |sub
   2507 |sub|sub
   1332 |sub|sub|sub
    860 |sub|sub|sub|sub
    558 |__security_check_cookie(x)
    479 |__security_check_cookie(x)|__security_check_cookie(x)
    475 |sub|sub|sub|sub|sub
    392 |sub|sub|sub|sub|sub|sub
    353 |operator delete(void *)
    276 |sub|operator delete(void *)
    269 |sub|sub|sub|sub|sub|sub|sub
    235 |sub|sub|sub|sub|sub|sub|sub|sub
    185 |sub|sub|sub|sub|sub|sub|sub|sub|sub
    168 |sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
    165 |__alloca_probe|sub|sub
    137 |eax
    132 |sub|sub|ecx
    132 |__alloca_probe|sub
    130 |_atexit
    123 |sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
    110 |_chkstk|sub|sub
    108 |strlen|operator delete(void *)|operator new(uint)|strcpy
    106 |nullsub
    106 |__alloca_probe
    101 |_chkstk|sub
     97 |eax|sub
     92 |__alloca_probe|sub|sub|sub|sub
     91 |__alloca_probe|sub|sub|sub
     88 |_chkstk|sub|sub|sub
     88 |__alloca_probe|sub|sub|sub|sub|sub|sub
     85 |__alloca_probe|sub|sub|sub|sub|sub
     80 |exception const &amp;)
     75 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     73 |strlen
     73 |_chkstk|sub|sub|sub|sub|sub
     72 |sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     71 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     71 |_Tidy(bool,uint)
     69 |sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     68 |sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     68 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     68 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     68 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub
     68 |InternetCloseHandle|InternetCloseHandle|InternetCloseHandle
     67 |sub|eax
     63 |_chkstk|sub|sub|sub|sub|sub|sub
     62 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     62 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub
     61 |free
     60 |sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     60 |allocator&lt;char&gt;&gt;(char const *)|_atexit
     59 |sub|_CxxThrowException(x,x)
     56 |_CxxThrowException
     56 |InternetReadFile
     55 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     55 |_chkstk
     55 |SetUnhandledExceptionFilter
     52 |operator new(uint)|exception(char const * const &amp;)|_CxxThrowException(x,x)
     52 |operator delete(void *)|_CxxThrowException(x,x)
     52 |_flsall
     51 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     51 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub
     50 |_chkstk|sub|sub|sub|sub
     49 |j_free
     48 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     47 |sub|sub|_CxxThrowException(x,x)
     47 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     45 |sub|sub|sub|sub|eax
     44 |strchr|strchr
     44 |malloc|sub|sub|free
     43 |dword ptr [ecx+8]
     42 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     40 |sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     40 |sub|_Split(void)|_wmemmove|sub|_Eos(uint)|_Split(void)|_Tidy(bool)|sub
     40 |operator delete(void *)|operator delete(void *)
     40 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub
     40 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     40 |ReadFile|_memcpy_0
     39 |sub|_CxxThrowException
     39 |GetModuleFileNameA|GetShortPathNameA|GetEnvironmentVariableA|lstrcpyA|lstrcatA|lstrcatA|GetCurrentProcess|SetPriorityClass|GetCurrentThread|SetThreadPriority|ShellExecuteExA|SetPriorityClass|SetProcessPriorityBoost|SHChangeNotify|GetCurrentProcess|SetPriorityClass|GetCurrentThread|SetThreadPriority
     38 |sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     38 |_chkstk|sub|sub|sub|sub|sub|sub|sub
     37 |GetCurrentProcess|OpenProcessToken|LookupPrivilegeValueA|AdjustTokenPrivileges|CloseHandle|GetLastError
     36 |sub|sub|dword ptr [eax]|sub|sub|sub
     36 |sub|ecx
     36 |dword ptr [ecx+4]
     36 |_memset|sub|__security_check_cookie(x)
     35 |sub|sub|__security_check_cookie
     35 |sub|operator delete(void *)|operator delete(void *)|operator delete(void *)|operator delete(void *)
     35 |__invalid_parameter_noinfo
     34 |operator new(uint)
     34 |_free
     34 |_LocaleUpdate(localeinfo_struct *)|___strgtold12_l|sub|__security_check_cookie(x)
     33 |sub|sub|eax|sub
     33 |sub|operator delete(void *)|operator delete(void *)
     33 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     33 |__errno|__invalid_parameter
     32 |operator delete(void *)|operator new(uint)
     32 |memset
     31 |operator new(uint)|sub
     31 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     30 |eax|sub|sub|sub|sub
     30 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     30 |__EH_prolog|_Tidy(bool)|_strlen|sub|sub|_CxxThrowException(x,x)
     30 |SetServiceStatus
     28 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     27 |sub|_Split(void)|_memcpy|sub|_Eos(uint)|_Split(void)|_Tidy(bool)|sub
     27 |strlen|sub
     27 |memcpy
     27 |_strcmpi|memset|memset|CreateToolhelp32Snapshot|Process32First|sprintf|strcat|Process32Next|CloseHandle|_strcmpi|OpenSCManagerA|EnumServicesStatusExA|operator new(uint)|CloseServiceHandle|strcat|EnumServicesStatusExA|sprintf|strcat|operator delete(void *)|CloseServiceHandle|_strcmpi|GetLogicalDrives|sprintf|strcat|sprintf|strcat|lstrcatA|GetDriveTypeA|strcat|GetVolumeInformationA|strcat|strcat|sprintf|strcat
     27 |_strcmpi|atoi|OpenProcess|TerminateProcess|CloseHandle|strcat|_strcmpi|OpenSCManagerA|OpenServiceA|GetLastError|strcat|CloseServiceHandle|ControlService|GetLastError|strcat|CloseServiceHandle|CloseServiceHandle
     27 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub
     27 |GetProcAddress
     27 |GetExitCodeProcess|PeekNamedPipe|Sleep|ReadFile|CloseHandle|CloseHandle|memset|strcpy|strlen
     26 |sub|sub|sub|sub|_memcpy_s
     26 |sub|eax|sub|eax|sub
     26 |sub|_Tidy(bool)|_Tidy(bool)|sub
     26 |strstr|strchr|operator new(uint)|strchr|strchr|strchr|strchr|strchr|strchr|strchr|strchr|strchr|operator delete(void *)
     26 |strlen|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     26 |sprintf|HttpAddRequestHeadersA|HttpSendRequestA|GetLastError|InternetQueryOptionA|InternetSetOptionA|sprintf
     26 |__ld12cvt
     26 |___strgtold12|sub
     26 |__EH_prolog3|sub|sub|_CxxThrowException(x,x)
     26 |InternetOpenA|InternetSetOptionA|InternetSetOptionA|InternetSetOptionA|InternetConnectA|HttpOpenRequestA|strlen|HttpAddRequestHeadersA
     26 |$+5
     25 |rand
     25 |malloc|CreatePipe|CreatePipe|CloseHandle|CloseHandle|CloseHandle|CloseHandle|free|sub|CloseHandle|CloseHandle
     25 |_chkstk|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     25 |__invalid_parameter_noinfo|__invalid_parameter_noinfo
     25 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     25 |URLDownloadToFileA|strcat
     24 |sub|sub|sub|sub|sub|GetProcAddress|sub|sub|sub
     24 |sub|edx|sub
     24 |sub|_Split(void)|_wmemmove|sub|_Eos(uint)|_Split(void)|sub|sub
     24 |shutdown|closesocket
     24 |send
     24 |fopen|fseek|fread|fseek|ftell|fseek|fread|fclose|fclose|fread|fclose|sub
     24 |edx
     24 |dword ptr [eax+40h]
     24 |_beginthreadex|CloseHandle
     24 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     24 |GetModuleHandleA|GetProcAddress
     23 |unknown_libname_1
     23 |sub|sub|sub|sub|operator delete(void *)
     23 |sub|OpenProcess|TerminateProcess|Sleep|CloseHandle|sub
     23 |strlen|CreateFileA|strlen|operator new(uint)|memset|WriteConsoleInputA|operator delete(void *)|CloseHandle
     23 |strcat|sub|WaitForSingleObject|strcat|strcat|strlen|sub
     23 |j_free|j_free
     23 |j_free|_CxxThrowException
     23 |LoadStringA|sub
     23 |CloseHandle
     22 |~type_info(void)|operator delete(void *)
     22 |sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     22 |sub|operator new(unsigned __int64)|exception(char const * const &amp;)|_CxxThrowException|sub|sub|j_free
     22 |operator new(uint)|operator new(uint)|sub
     22 |operator new(uint)|operator delete(void *)
     22 |operator delete(void *)|operator delete(void *)|operator delete(void *)
     22 |exception(char const * const &amp;)
     22 |eax|sub|sub|sub
     22 |GetCurrentProcess|GetCurrentProcess|DuplicateHandle|CreateProcessA|CloseHandle
     22 |CompareStringA
     22 |$+5|sub|sub
     21 |sub|_wcslen|sub|sub|sub|sub
     21 |sprintf|sprintf|sub
     21 |malloc|recv|sub|sub|_strnicmp|WriteFile|recv|free|ExitThread|SetEvent|free|ExitThread
     21 |malloc|PeekNamedPipe|ReadFile|sub|sub|_itoa|send|sub|Sleep|PeekNamedPipe|free|ExitThread
     21 |_strcmpi|memset|CreateProcessA|strcat|CloseHandle|_strcmpi|OpenSCManagerA|strcat|OpenServiceA|GetLastError|strcat|CloseServiceHandle|StartServiceA|GetLastError|strcat|CloseServiceHandle|CloseHandle
     21 |__get_sse2_info
     21 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     21 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     21 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     21 |__alloca_probe|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub|sub
     21 |GetCurrentProcess|OpenProcess|GetLastError|sprintf|strcat|OpenProcessToken|memset|sprintf|CreateProcessAsUserA|strcat|CloseHandle|CloseHandle|GetLastError|sprintf|strcat|CloseHandle|GetLastError|sprintf|strcat|CloseHandle
     21 |CreateEventA|CreateEventA|sub|WaitForSingleObject|CloseHandle
     21 |$+5|sub</pre>
<p>Using these shortened procedures for cluster generations gives some promising results e.g.:</p>
<pre><strong><span style="color: #ff0000;">sub</span></strong>
<strong><span style="color: #ff0000;">DeleteFileW</span></strong>
<strong><span style="color: #ff0000;">DeleteFileA</span></strong>

1328eaceb140a3863951d18661b097af.asm
31e5e58dbdfad05175613e795298ebb5.asm
6f9992c486195edcf0bf2f6ee6c3ec74.asm
c99fa835350aa9e2427ce69323b061a9.asm
e476e4a24f8b4ff4c8a0b260aa35fc9f.asm
ea1b44094ae4d8e2b63a1771a3e61fd5.asm
fc1937c1aa536b3744ebdfb1716fd54d.asm</pre>
<pre><strong><span style="color: #ff0000;">LoadLibraryA</span></strong>
<strong><span style="color: #ff0000;">GetProcAddress</span></strong>
<strong><span style="color: #ff0000;">GetProcAddress</span></strong>
<strong><span style="color: #ff0000;">GetProcAddress</span></strong>

3f8682ab074a097ebbaadbf26dfff560.asm
4b19a2a6d40a5825e868c6ef25ae445e.asm
54d5d171a482278cc8eacf08d9175fd7.asm
56de2854ef64d869b5df7af5e4effe3e.asm
75dad1ccabae8adeb5bae899d0c630f8.asm
8462a62f13f92c34e4b89a7d13a185ad.asm</pre>
<pre><span style="color: #ff0000;"><strong>htons</strong></span>
<span style="color: #ff0000;"><strong>socket</strong></span>
<span style="color: #ff0000;"><strong>connect</strong></span>
<span style="color: #ff0000;"><strong>closesocket</strong></span>

468ff2c12cffc7e5b2fe0ee6bb3b239e.asm
727a6800991eead454e53e8af164a99c.asm
bd8b082b7711bc980252f988bb0ca936.asm
db05df0498b59b42a8e493cf3c10c578.asm
e1b6940985a23e5639450f8391820655.asm</pre>
<pre><span style="color: #ff0000;"><strong>ecx</strong></span>
<span style="color: #ff0000;"><strong>eax</strong></span>
<span style="color: #ff0000;"><strong>dword ptr [esi+10h]</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>ecx</strong></span>
<span style="color: #ff0000;"><strong>eax</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>

12f25ce81596aeb19e75cc7ef08f3a38.asm
268eef019bf65b2987e945afaf29643f.asm
468ff2c12cffc7e5b2fe0ee6bb3b239e.asm
4c6bddcca2695d6202df38708e14fc7e.asm
5a728cb9ce56763dccb32b5298d0f050.asm
727a6800991eead454e53e8af164a99c.asm
8e8622c393d7e832d39e620ead5d3b49.asm
bd8b082b7711bc980252f988bb0ca936.asm
c6a4bb1a4e4f69ec71855d70d6960859.asm
db05df0498b59b42a8e493cf3c10c578.asm
e1b6940985a23e5639450f8391820655.asm
ef8e0fb20e7228c7492ccdc59d87c690.asm</pre>
<pre><span style="color: #ff0000;"><strong>LoadLibraryA</strong></span>
<span style="color: #ff0000;"><strong>GetProcAddress</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>strstr</strong></span>
<span style="color: #ff0000;"><strong>strchr</strong></span>
<span style="color: #ff0000;"><strong>GetSystemDirectoryA</strong></span>
<span style="color: #ff0000;"><strong>time</strong></span>
<span style="color: #ff0000;"><strong>srand</strong></span>
<span style="color: #ff0000;"><strong>malloc</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>strncmp</strong></span>
<span style="color: #ff0000;"><strong>Sleep</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>Sleep</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>Sleep</strong></span>
<span style="color: #ff0000;"><strong>CreatePipe</strong></span>
<span style="color: #ff0000;"><strong>CreatePipe</strong></span>
<span style="color: #ff0000;"><strong>GetStartupInfoA</strong></span>
<span style="color: #ff0000;"><strong>CreateProcessA</strong></span>
<span style="color: #ff0000;"><strong>GetLastError</strong></span>
<span style="color: #ff0000;"><strong>_snprintf</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>CreateProcessA</strong></span>
<span style="color: #ff0000;"><strong>CreateThread</strong></span>
<span style="color: #ff0000;"><strong>CreateThread</strong></span>
<span style="color: #ff0000;"><strong>WaitForMultipleObjects</strong></span>
<span style="color: #ff0000;"><strong>GetExitCodeThread</strong></span>
<span style="color: #ff0000;"><strong>TerminateThread</strong></span>
<span style="color: #ff0000;"><strong>GetExitCodeThread</strong></span>
<span style="color: #ff0000;"><strong>TerminateThread</strong></span>
<span style="color: #ff0000;"><strong>GetExitCodeProcess</strong></span>
<span style="color: #ff0000;"><strong>TerminateProcess</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>GetLastError</strong></span>
<span style="color: #ff0000;"><strong>_snprintf</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>CloseHandle</strong></span>
<span style="color: #ff0000;"><strong>CloseHandle</strong></span>
<span style="color: #ff0000;"><strong>CloseHandle</strong></span>
<span style="color: #ff0000;"><strong>CloseHandle</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span>
<span style="color: #ff0000;"><strong>Sleep</strong></span>
<span style="color: #ff0000;"><strong>PeekNamedPipe</strong></span>
<span style="color: #ff0000;"><strong>ReadFile</strong></span>
<span style="color: #ff0000;"><strong>sub</strong></span></pre>
<pre>0dd3677594632ce270bcf8af94819caf.asm
270d42f292105951ee81e4085ea45054.asm
523f56515221161579ee6090c962e5b1.asm</pre>
<p>Notably, the disassembled code &#8211; after some selective processing and normalization &#8211; can be treated in a same way as student source code submissions for their assessments at uni and&#8230; be checked for plagiarism. The most common technique used for this purpose relies on measuring the  <a href="https://en.wikipedia.org/wiki/Cosine_similarity">cosine similarity</a>. I am currently playing with it and will write more about my findings in another post.</p>
<p>Thanks for reading!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hexacorn.com/blog/2013/03/12/clustering-and-batch-analysis-of-apt1-sampleset-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
