{"id":11925,"date":"2018-04-04T08:00:31","date_gmt":"2018-04-04T16:00:31","guid":{"rendered":"http:\/\/www.palada.net\/index.php\/2018\/04\/04\/news-5694\/"},"modified":"2018-04-04T08:00:31","modified_gmt":"2018-04-04T16:00:31","slug":"news-5694","status":"publish","type":"post","link":"http:\/\/www.palada.net\/index.php\/2018\/04\/04\/news-5694\/","title":{"rendered":"Hunting down Dofoil with Windows Defender ATP"},"content":{"rendered":"<p><strong>Credit to Author: Windows Defender ATP| Date: Wed, 04 Apr 2018 15:00:18 +0000<\/strong><\/p>\n<p><a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/03\/07\/behavior-monitoring-combined-with-machine-learning-spoils-a-massive-dofoil-coin-mining-campaign\/\">Dofoil<\/a> is a sophisticated threat that attempted to install <a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/03\/07\/behavior-monitoring-combined-with-machine-learning-spoils-a-massive-dofoil-coin-mining-campaign\/\">coin miner malware<\/a> on hundreds of thousands of computers in March, 2018. In previous blog posts we detailed how behavior monitoring and machine learning in <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/security\/threat-protection\/windows-defender-antivirus\/windows-defender-antivirus-in-windows-10?ocid=cx-blog-mmpc\" rel=\"noopener\">Windows Defender AV<\/a> protected customers from a <a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/03\/07\/behavior-monitoring-combined-with-machine-learning-spoils-a-massive-dofoil-coin-mining-campaign\/\">massive Dofoil outbreak<\/a> that we traced back to a <a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/03\/07\/behavior-monitoring-combined-with-machine-learning-spoils-a-massive-dofoil-coin-mining-campaign\/\">software update poisoning campaign<\/a> several weeks prior. Notably, customers of <a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/03\/07\/behavior-monitoring-combined-with-machine-learning-spoils-a-massive-dofoil-coin-mining-campaign\/\">Windows 10 S<\/a>, a special Windows 10 configuration that provides streamlined Microsoft-verified security, were not affected by the Dofoil outbreak.<\/p>\n<p>&#10;<\/p>\n<p>In this blog post, we will expound on Dofoils anti-debugging and anti-analysis tactics, and demonstrate how the rich detection libraries of <a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/03\/07\/behavior-monitoring-combined-with-machine-learning-spoils-a-massive-dofoil-coin-mining-campaign\/\">Windows Defender Advanced Threat Protection<\/a> and <a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/03\/07\/behavior-monitoring-combined-with-machine-learning-spoils-a-massive-dofoil-coin-mining-campaign\/\">Windows Defender Exploit Guard<\/a> can help during investigation.<\/p>\n<p>&#10;<\/p>\n<p>We found that Dofoil was designed to be elusive to analysis. It checks its environment and stops running in virtual machine environments. It also checks for various analysis tools and kills them right away. This can make malware analysis and assessment challenging.<\/p>\n<p>&#10;<\/p>\n<p>The following diagram shows the multi-stage malware execution process, which includes checks for traits of analysis environments during some stages.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-81746 aligncenter\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/01-dofoil-multi-stage-execution-flow-1024x617.png\" alt=\"\" width=\"800\" height=\"482\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 1. Dofoil multi-stage shellcode and payload execution flow<\/em><\/p>\n<p>&#10;<\/p>\n<p>The table below describes the purpose of each stage. The first five stages have at least one or two different techniques that can deter dynamic or static malware analysis.<\/p>\n<p>&#10;<\/p>\n<table style=\"font-size: small\">&#10;<\/p>\n<tbody>&#10;<\/p>\n<tr bgcolor=\"#dddddd\">&#10;<\/p>\n<th style=\"padding: 8px\"><strong>STAGES<\/strong><\/th>\n<p>&#10;<\/p>\n<th style=\"padding: 8px\"><strong>DESCRIPTION<\/strong><\/th>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>1. Obfuscated wrapper code<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Anti-heuristics<\/p>\n<p>&#10;<\/p>\n<p>Anti-emulation<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>2. Bootstrap module<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Performs self-process hollowing to load the next module<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>3. Anti-debugging module<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Performs anti-debugging operation<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>4. Trojan downloader module<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Performs system environment checks<\/p>\n<p>&#10;<\/p>\n<p>Performs anti-VM operation<\/p>\n<p>&#10;<\/p>\n<p>Injects itself to <em>explorer.exe<\/em> through process hollowing<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>5. Trojan downloader module in <em>explorer.exe<\/em><\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Contacts C&amp;C server to download trojan and run it using process hollowing technique<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>6. Payload downloader module in <em>explorer.exe<\/em><\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Contacts C&amp;C server to download the main payload<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>7. Trojan module<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Steals credentials from various application settings and sends stolen into to the C&amp;C server over HTTP channel<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>8. CoinMiner.D<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Mines digital currencies<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/tbody>\n<p>&#10;<\/table>\n<p>&#10;<\/p>\n<p><em>Table 1. Dofoil&#8217;s multi-stage modules<\/em><\/p>\n<p>&#10;<\/p>\n<h2>Initial stages<\/h2>\n<p>&#10;<\/p>\n<p>The first three stages (i.e., obfuscated wrapper code, bootstrap module, anti-debugging module) use the following techniques to avoid analysis and identification.<\/p>\n<p>&#10;<\/p>\n<table style=\"height: 289px;font-size: small\" width=\"1046\">&#10;<\/p>\n<tbody>&#10;<\/p>\n<tr bgcolor=\"#dddddd\">&#10;<\/p>\n<th style=\"padding: 8px\" width=\"25%\"><strong>ANTI-ANALYSIS TECHNIQUES<\/strong><\/th>\n<p>&#10;<\/p>\n<th style=\"padding: 8px\">DESCRIPTION<\/th>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Benign code insertion<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Inserts a huge benign code block to confuse heuristics and manual inspection<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Anti-emulation<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Enumerates an arbitrary registry key <em>(HKEY_CLASSES_ROOTInterface{3050F557-98B5-11CF-BB82-00AA00BDCE0B}<\/em>) and compares the data with an expected value (<em>DispHTMLCurrentStyle<\/em>) to check if the malware runs inside an emulator<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Self-process hollowing<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Uses the process hollowing technique on the current process, making analysis extra difficult due to the altered code mapping<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Debugger checks<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Checks for debuggers, and modifies code to crash. This can add additional layer of confusion to researchers, who are bound to investigate the cause of the crashes. It checks for the <em>PEB.BeingDebugged<\/em> and <em>PEB.NtGlobalFlag<\/em> fields in the PEB structure. For example, <em>PEB.BeingDebugged<\/em> is set to <em>1<\/em> and <em>PEB.NtGlobalFlag<\/em> is set to <em>FLG_HEAP_ENABLE_TAIL_CHECK|FLG_HEAP_ENABLE_FREE_CHECK| FLG_HEAP_VALIDATE_PARAMETERS<\/em> when a debugger is attached to the process.<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/tbody>\n<p>&#10;<\/table>\n<p>&#10;<\/p>\n<p><em>Table 2. Anti-analysis techniques<\/em><\/p>\n<p>&#10;<\/p>\n<p>The first stage contains some benign-looking code before the actual malicious code. This can give the executable a harmless appearance. It can also make the emulation of the code difficult because emulating various API calls that are not present in many malware codes can be challenging.<\/p>\n<p>&#10;<\/p>\n<p>The first-stage code also performs a registry key enumeration to make sure it has the expected value. When all checks are passed, it decodes the second-stage shellcode and runs it on the allocated memory. This shellcode un-maps the original main modules memory, and then decodes the third-stage shellcode into that memory  this is known as a self-<a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/03\/07\/behavior-monitoring-combined-with-machine-learning-spoils-a-massive-dofoil-coin-mining-campaign\/\">process hollowing<\/a> technique.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-81749\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/02-dofoil-self-modification-1024x544.png\" alt=\"\" width=\"700\" height=\"372\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 2. Self-modification based on PEB.BeingDebugged<\/em> value<\/p>\n<p>&#10;<\/p>\n<p>Windows Defender ATPs process tree can help with investigation by exposing these anti-debugging techniques.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-81752\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/03-dofoil-WDATP-process-tree-1024x675.png\" alt=\"\" width=\"700\" height=\"461\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 3. Windows Defender ATP process tree showing anti-debugging techniques<\/em><\/p>\n<p>&#10;<\/p>\n<h2>Trojan downloader module<\/h2>\n<p>&#10;<\/p>\n<p>The trojan downloader module performs various environment checks, including virtual environment and analysis tool checks, before downloading the payload.<\/p>\n<p>&#10;<\/p>\n<table style=\"font-size: small\">&#10;<\/p>\n<tbody>&#10;<\/p>\n<tr bgcolor=\"#dddddd\">&#10;<\/p>\n<th style=\"padding: 8px\"><b><span style=\"font-family: Segoe UI\">ANTI-ANALYSIS TECHNIQUES<\/span><\/b><\/th>\n<p>&#10;<\/p>\n<th style=\"padding: 8px\">DESCRIPTION<\/th>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Check module name<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Checks if the main executable name contains the string &#8220;sample&#8221;<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Check volume serial<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Checks if current volume serial number is <em>0xCD1A40<\/em> or <em>0x70144646<\/em><\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Check modules<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Checks the presence of DLLs related to debuggers<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Check disk-related registry keys<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Checks the value of the registry key <em>HKLMSystemCurrentControlSetServicesDiskEnum<\/em> against well-known disk name patterns for virtual machines (<em>qemu<\/em>, <em>virtual<\/em>, <em>vmware<\/em>, <em>xen<\/em>, <em>ffffcce24<\/em>)<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Process check<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Checks running processes and kills those with processes names associated with analysis tools (<em>procexp.exe<\/em>, <em>procexp64.exe<\/em>, <em>procmon.exe<\/em>, <em>procmon64.exe<\/em>, <em>tcpview.exe<\/em>, <em>wireshark.exe<\/em>, <em>processhacker.exe<\/em>, <em>ollydbg.exe<\/em>, <em>idaq.exe<\/em>, <em>x32dbg.exe<\/em>)<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Windows class name check<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">Checks the current Windows class names and exits when some well-known names are found (<em>Autoruns<\/em>, <em>PROCEXPL<\/em>, <em>PROCMON_WINDOW_CLASS<\/em>, <em>TCPViewClass<\/em>, <em>ProcessHacker<\/em>, <em>OllyDbg<\/em>, <em>WinDbgFrameClass<\/em>)<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/tbody>\n<p>&#10;<\/table>\n<p>&#10;<\/p>\n<p><em>Table 3. Anti-analysis technique<i><span style=\"font-family: Segoe UI\">of Dofoil&#8217;s trojan downloader module<\/span><\/i><\/em><\/p>\n<p>&#10;<\/p>\n<p>The list of target process names and Windows class names exist in custom checksum form. The checksum algorithm looks like the following:<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-81755\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/04-dofoil-shift-and-XOR.png\" alt=\"\" width=\"343\" height=\"124\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 4. Shift and XOR custom checksum algorithm<\/em><\/p>\n<p>&#10;<\/p>\n<p>The purpose of this checksum is to prevent malware researchers from quickly figuring out what analysis tools it detects, making analysis more time-consuming.<\/p>\n<p>&#10;<\/p>\n<table style=\"font-size: small\">&#10;<\/p>\n<tbody>&#10;<\/p>\n<tr bgcolor=\"#dddddd\">&#10;<\/p>\n<th style=\"padding: 8px\">STRING<\/th>\n<p>&#10;<\/p>\n<th style=\"padding: 8px\"><strong>CHECKSUM<\/strong><\/th>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>Autoruns<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x0E5C1C5D<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>PROCEXPL<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x1D421B41<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>PROCMON_WINDOW_CLASS<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x4B0C105A<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>TCPViewClass<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x1D4F5C43<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>ProcessHacker<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x571A415E<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>OllyDbg<\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x4108161D<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>WinDbgFrameClass <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x054E1905<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>procexp.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x19195C02<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>procexp64.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x1C0E041D<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>procmon.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x06185D0B<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>procmon64.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x1D07120A<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>tcpview.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x060B5118<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>wireshark.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x550E1E0D<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>processhacker.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x51565C47<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>ollydbg.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x04114C14<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>x32dbg.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x5F4E5C04<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/p>\n<tr>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\"><strong>idaq.exe <\/strong><\/td>\n<p>&#10;<\/p>\n<td style=\"padding: 8px;vertical-align: top\">0x14585A12<\/td>\n<p>&#10;<\/tr>\n<p>&#10;<\/tbody>\n<p>&#10;<\/table>\n<p>&#10;<\/p>\n<p><em>Table 4. String checksum table used for process names and Windows class names<\/em><\/p>\n<p>&#10;<\/p>\n<h2>Process hollowing<\/h2>\n<p>&#10;<\/p>\n<p>Dofoil heavily uses the <a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/03\/07\/behavior-monitoring-combined-with-machine-learning-spoils-a-massive-dofoil-coin-mining-campaign\/\">process hollowing<\/a> technique. Its main target for process hollowing is explorer.exe. The Dofoil shellcode launches a new instance of explorer.exe, allocates shellcode in heap region, and then modifies the entry point code to jump into the shellcode. This way, the malware avoids using <em>CreateRemoteThread<\/em> API, but can still achieve code injection.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-81758\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/05-dofoil-modification-entry-point-code.png\" alt=\"\" width=\"800\" height=\"561\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 5. Modification of <\/em>explorer.exe<em> entry point code<\/em><\/p>\n<p>&#10;<\/p>\n<p>Windows Defender ATP can detect the process hollowing behavior with advanced memory signals. The following process tree shows that the malware injects itself into explorer.exe using the process hollowing technique.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-81761\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/06-dofoil-first-process-hollowing.png\" alt=\"\" width=\"500\" height=\"143\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 6. Windows Defender ATP alert process tree showing the first process hollowing<\/em><\/p>\n<p>&#10;<\/p>\n<p>When the shellcode downloads another layer of payload, it spawns another explorer.exe to inject the payload into using process hollowing. Windows Defender ATP can save analysis time on these cases by pinpointing the malicious actions, eliminating the need for guessing what these newly spawned Windows system processes are doing.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-81764\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/07-dofoil-second-process-hollowing.png\" alt=\"\" width=\"600\" height=\"196\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 7. Windows Defender ATP alert process tree showing the second process hollowing<\/em><\/p>\n<p>&#10;<\/p>\n<p>The process hollowing behavior can be detected through <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/security\/threat-protection\/windows-defender-exploit-guard\/exploit-protection-exploit-guard\">Exploit protection<\/a> in <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/security\/threat-protection\/windows-defender-exploit-guard\/windows-defender-exploit-guard\">Windows Defender Exploit Guard<\/a>. This can be done by enabling the Export Address Filter (EAF) mitigation against explorer.exe. The detection happens when the shellcode goes through the export addresses of the modules to find the export address of the LoadLibraryA and GetProcAddress functions.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-81767\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/08-dofoil-EAF-event.png\" alt=\"\" width=\"859\" height=\"247\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 8. Export Address Filter (EAF) event exposed in Event viewer<\/em><\/p>\n<p>&#10;<\/p>\n<p>Windows Defender Exploit Guard events are also exposed in the Windows Defender ATP portal:<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-81770\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/09-dofoil-wdatp-wdeg-event.png\" alt=\"\" width=\"652\" height=\"33\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 9. Windows Defender ATP view of the Windows Defender Exploit Guard event<\/em><\/p>\n<p>&#10;<\/p>\n<p>Adding Windows Defender Exploit Guard EAF audit\/block policy to common system processes like explorer.exe, cmd.exe, or verclsid.exe can be useful in finding and blocking process hollowing or process injection techniques commonly used by malware. This policy can impact third-party apps that may behave like shellcode, so we recommend testing Windows Defender Exploit Guard with <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/security\/threat-protection\/windows-defender-exploit-guard\/audit-windows-defender-exploit-guard\">audit mode<\/a> enabled before enforcement.<\/p>\n<p>&#10;<\/p>\n<h2>Command-and-control (C&amp;C) and NameCoin domains<\/h2>\n<p>&#10;<\/p>\n<p>Dofoils C&amp;C connection is very cautious. The trojan code first tries to connect to well-known web pages and verifies that the malware has proper and real Internet connection, not simulated as in test environments. After it makes sure it has a real Internet connection, the malware makes HTTP connections to the actual C&amp;C servers.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-81773\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/10-dofoil-internet-connection.png\" alt=\"\" width=\"873\" height=\"235\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 10. Access to known servers to confirm Internet connectivity<\/em><\/p>\n<p>&#10;<\/p>\n<p>The malware uses NameCoin domain name servers. NameCoin is a decentralized name server system that provides extra privacy backed by blockchain technology. Except for the fact that the DNS client needs to use specific sets of NameCoin DNS servers, the overall operation is very similar to a normal DNS query. Because NameCoin uses blockchain technology, you can query the history of the domain name changes through blocks.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-81776\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/11-dofoil-dns-entry-changes-1024x769.png\" alt=\"\" width=\"800\" height=\"601\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 11. Malicious hostname DNS entry changes over time (<a href=\"https:\/\/namecha.in\/name\/d\/vrubl\">https:\/\/namecha.in\/name\/d\/vrubl<\/a>)<\/em><\/p>\n<p>&#10;<\/p>\n<p>Windows Defender ATP can provide visibility into the malwares network activities. The following alert process tree shows the malwares .bit domain resolution activity and, after that, the connections to the resolved C&amp;C servers. You can also view other activities from the executable, for example, its connections to other servers using SMTP ports.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-81782\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/12-dofoil-cnc-connection.png\" alt=\"\" width=\"700\" height=\"456\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 12. Windows Defender ATP alert process tree showing C&amp;C server connection through NameCoin server name resolution<\/em><\/p>\n<p>&#10;<\/p>\n<p>The Windows Defender ATP advanced hunting feature, which is currently in preview, can be used to hunt down more malware samples that possibly abuse NameCoin servers. For example, the following query will let you view recent connections observed in the network. This can lead to extra insights on other threats that use the same NameCoin servers.<\/p>\n<p>&#10;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-81779\" src=\"https:\/\/cloudblogs.microsoft.com\/uploads\/prod\/2018\/04\/13-advanced-hunting.png\" alt=\"\" width=\"999\" height=\"920\" \/><\/p>\n<p>&#10;<\/p>\n<p><em>Figure 13. Advanced hunting for other threats using the same NameCoin servers<\/em><\/p>\n<p>&#10;<\/p>\n<p>The purpose of using NameCoin is to prevent easy sinkholing of the domains. Because there are no central authorities on the NameCoin domain name records, it is not possible for the authorities to change the domain record. Also, malware abusing NameCoin servers use massive numbers of NameCoin DNS servers to make full shutdown of those servers very difficult.<\/p>\n<p>&#10;<\/p>\n<h2>Conclusion<\/h2>\n<p>&#10;<\/p>\n<p>Dofoil is a very evasive malware. It has various system environment checks and tests Internet connectivity to make sure it runs on real machines, not in analysis environments or virtual machines. This can make the analysis time-consuming and can mislead malware analysis systems.<\/p>\n<p>&#10;<\/p>\n<p>In attacks like the Dofoil outbreak, Windows Defender Advanced Threat Protection (<a href=\"https:\/\/www.microsoft.com\/en-us\/WindowsForBusiness\/windows-atp?ocid=cx-blog-mmpc\">Windows Defender ATP<\/a>) can help network defenders analyze the timeline from the victim machine and get rich information on process execution flow, C&amp;C connections, and process hollowing activities. Windows Defender ATP can be used as an analysis platform with fine-tuned visibility into system activities when set up in a lab environment. This can save time and resource during malware investigation.<\/p>\n<p>&#10;<\/p>\n<p>In addition, <a href=\"https:\/\/blogs.technet.microsoft.com\/mmpc\/2017\/10\/23\/windows-defender-exploit-guard-reduce-the-attack-surface-against-next-generation-malware\/?ocid=cx-blog-mmpc\">Windows Defender Exploit Guard<\/a> can be useful in finding malicious shellcodes that traverse export address tables. Windows Defender Exploit Guard can be an excellent tool for finding and blocking malware and exploit activities.<\/p>\n<p>&#10;<\/p>\n<p>Windows Defender Exploit Guard events are surfaced in the Windows Defender ATP portal, which integrates protections from other Microsoft solutions, including <a href=\"https:\/\/www.microsoft.com\/en-us\/windows\/windows-defender?ocid=cx-blog-mmpc\">Windows Defender AV<\/a> and <a href=\"https:\/\/blogs.technet.microsoft.com\/mmpc\/2017\/10\/23\/making-microsoft-edge-the-most-secure-browser-with-windows-defender-application-guard?ocid=cx-blog-mmpc\">Windows Defender Application Guard<\/a>. This integrated security management experience makes Windows Defender ATP a comprehensive solution for detecting and responding to a wide range of malicious activities across the network.<\/p>\n<p>&#10;<\/p>\n<p><a href=\"https:\/\/www.microsoft.com\/en-us\/windows\/windows-10-s?ocid=cx-blog-mmpc\">Windows 10 S<\/a>, a special configuration of Windows 10, locks down devices against Dofoil and other attacks by working exclusively with apps from the Microsoft Store and using Microsoft Edge as the default browser. This streamlined, Microsoft-verified platform seals common malware entry points.<\/p>\n<p>&#10;<\/p>\n<p>To test how Windows Defender ATP can help your organization detect, investigate, and respond to advanced attacks, <strong><a href=\"https:\/\/www.microsoft.com\/en-us\/WindowsForBusiness\/windows-atp?ocid=cx-blog-mmpc\">sign up for a free trial<\/a><\/strong>.<\/p>\n<p>&#10;<\/p>\n<p>&nbsp;<\/p>\n<p>&#10;<\/p>\n<p>&nbsp;<\/p>\n<p>&#10;<\/p>\n<p><em>Matt Oh, Stefan Sellmer, Jonathan Bar Or, Mark Wodrich<\/em><br \/>&#10;<strong><em>Windows Defender ATP Research<\/em><\/strong><\/p>\n<p>&#10;<\/p>\n<p>&nbsp;<\/p>\n<p>&#10;<\/p>\n<p>&nbsp;<\/p>\n<p>&#10;<\/p>\n<h2>Indicators of compromise (IoCs)<\/h2>\n<p>&#10;<\/p>\n<p><strong>TrojanDownloader:Win32\/Dofoil.AB:<\/strong><\/p>\n<p>&#10;<\/p>\n<p>d191ee5b20ec95fe65d6708cbb01a6ce72374b309c9bfb7462206a0c7e039f4d<\/p>\n<p>&#10;<\/p>\n<p>eaa63f6b500afedcaeb8d5b18a08fd6c7d95695ea7961834b974e2a653a42212<\/p>\n<p>&#10;<\/p>\n<p>cded7aedca6b54a6d4273153864a25ccad35cba5cafeaec828a6ad5670a5973a<\/p>\n<p>&#10;<\/p>\n<p><strong>Trojan:Win32\/Dofoil.AB:<\/strong><\/p>\n<p>&#10;<\/p>\n<p>070243ad7fb4b3c241741e564039c80ca65bfdf15daa4add70d5c5a3ed79cd5c<\/p>\n<p>&#10;<\/p>\n<p>5f3efdc65551edb0122ab2c40738c48b677b1058f7dfcdb86b05af42a2d8299C<\/p>\n<p>&#10;<\/p>\n<p>28ce9763a808c4a7509e9bf92d9ca80212a241dfa1aecd82caedf1f101eac692<\/p>\n<p>&#10;<\/p>\n<p>5d7875abbbf104f665a0ee909c372e1319c5157dfc171e64ac2bc8b71766537f<\/p>\n<p>&#10;<\/p>\n<p><strong>Trojan:Win32\/CoinMiner.D<\/strong><\/p>\n<p>&#10;<\/p>\n<p>2b83c69cf32c5f8f43ec2895ec9ac730bf73e1b2f37e44a3cf8ce814fb51f12<\/p>\n<p>&#10;<\/p>\n<p><strong>C&amp;C URLs:<\/strong><\/p>\n<p>&#10;<\/p>\n<p>hxxp:\/\/levashov.bit\/15022018\/<\/p>\n<p>&#10;<\/p>\n<p>hxxp:\/\/vrubl.bit\/15022018\/<\/p>\n<p>&#10;<\/p>\n<p><strong>C&amp;C server:<\/strong><\/p>\n<p>&#10;<\/p>\n<p>vinik.bit<\/p>\n<p>&#10;<\/p>\n<p><strong>Related .bit domains (updated in same block as C&amp;C server):<\/strong><\/p>\n<p>&#10;<\/p>\n<p>henkel.bit<\/p>\n<p>&#10;<\/p>\n<p>makron.bit<\/p>\n<p>&#10;<\/p>\n<p>makronwin.bit<\/p>\n<p>&#10;<\/p>\n<p><strong>NameCoin servers used by Dofoil:<\/strong><\/p>\n<p>&#10;<\/p>\n<p>139.59.208.246<\/p>\n<p>&#10;<\/p>\n<p>130.255.73.90<\/p>\n<p>&#10;<\/p>\n<p>31.3.135.232<\/p>\n<p>&#10;<\/p>\n<p>52.174.55.168<\/p>\n<p>&#10;<\/p>\n<p>185.121.177.177<\/p>\n<p>&#10;<\/p>\n<p>185.121.177.53<\/p>\n<p>&#10;<\/p>\n<p>62.113.203.55<\/p>\n<p>&#10;<\/p>\n<p>144.76.133.38<\/p>\n<p>&#10;<\/p>\n<p>169.239.202.202<\/p>\n<p>&#10;<\/p>\n<p>5.135.183.146<\/p>\n<p>&#10;<\/p>\n<p>142.0.68.13<\/p>\n<p>&#10;<\/p>\n<p>103.253.12.18<\/p>\n<p>&#10;<\/p>\n<p>62.112.8.85<\/p>\n<p>&#10;<\/p>\n<p>69.164.196.21<\/p>\n<p>&#10;<\/p>\n<p>107.150.40.234<\/p>\n<p>&#10;<\/p>\n<p>162.211.64.20<\/p>\n<p>&#10;<\/p>\n<p>217.12.210.54<\/p>\n<p>&#10;<\/p>\n<p>89.18.27.34<\/p>\n<p>&#10;<\/p>\n<p>193.183.98.154<\/p>\n<p>&#10;<\/p>\n<p>51.255.167.0<\/p>\n<p>&#10;<\/p>\n<p>91.121.155.13<\/p>\n<p>&#10;<\/p>\n<p>87.98.175.85<\/p>\n<p>&#10;<\/p>\n<p>185.97.7.7<\/p>\n<p>&#10;<\/p>\n<p>&nbsp;<\/p>\n<p>&#10;<\/p>\n<p>&nbsp;<\/p>\n<p>&#10;<\/p>\n<hr \/>\n<p>&#10;<\/p>\n<h4><strong>Talk to us<\/strong><\/h4>\n<p>&#10;<\/p>\n<p>Questions, concerns, or insights on this story? Join discussions at the <a target=\"_blank\" href=\"https:\/\/answers.microsoft.com\/en-us\/protect\" rel=\"noopener\">Microsoft community<\/a> and <a target=\"_blank\" href=\"https:\/\/www.microsoft.com\/en-us\/wdsi\" rel=\"noopener\">Windows Defender Security Intelligence<\/a>.<\/p>\n<p>&#10;<\/p>\n<p>Follow us on Twitter <a target=\"_blank\" href=\"https:\/\/twitter.com\/WDSecurity\" rel=\"noopener\">@WDSecurity<\/a> and Facebook <a target=\"_blank\" href=\"https:\/\/www.facebook.com\/MsftWDSI\/\" rel=\"noopener\">Windows Defender Security Intelligence<\/a>.<\/p>\n<p>&#10;<\/p>\n<p>&nbsp;<\/p>\n<p>&#10;<\/p>\n<p>&nbsp;<\/p>\n<p>&#10;<br \/><a href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/04\/04\/hunting-down-dofoil-with-windows-defender-atp\/\" target=\"bwo\" >https:\/\/blogs.technet.microsoft.com\/mmpc\/feed\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><strong>Credit to Author: Windows Defender ATP| Date: Wed, 04 Apr 2018 15:00:18 +0000<\/strong><\/p>\n<p>Dofoil is a sophisticated threat that attempted to install coin miner malware on hundreds of thousands of computers in March, 2018. In previous blog posts we detailed how behavior monitoring and machine learning in Windows Defender AV protected customers from a massive Dofoil outbreak that we traced back to a software update poisoning campaign several <\/p>\n<p><a class=\"read-more\" title=\"Hunting down Dofoil with Windows Defender ATP\" aria-label=\"Read more about Hunting down Dofoil with Windows Defender ATP\" href=\"https:\/\/cloudblogs.microsoft.com\/microsoftsecure\/2018\/04\/04\/hunting-down-dofoil-with-windows-defender-atp\/\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[10759,10378],"tags":[18016,11572,16598,4500,10839,10803,17771,18017,10525,10761,17261,11774,10865,17194,17195],"class_list":["post-11925","post","type-post","status-publish","format-standard","hentry","category-microsoft","category-security","tag-advanced-hunting","tag-coinminer","tag-cryptocurrency-mining","tag-cybersecurity","tag-dofoil","tag-malware-research","tag-namecoin","tag-process-hollowing","tag-windows","tag-windows-10","tag-windows-10-s","tag-windows-defender-antivirus","tag-windows-defender-atp","tag-windows-defender-av","tag-windows-defender-exploit-guard"],"_links":{"self":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/11925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/comments?post=11925"}],"version-history":[{"count":0,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/11925\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=11925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=11925"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=11925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}