{"id":7788,"date":"2017-05-30T15:40:29","date_gmt":"2017-05-30T23:40:29","guid":{"rendered":"http:\/\/www.palada.net\/index.php\/2017\/05\/30\/news-1573\/"},"modified":"2017-05-30T15:40:29","modified_gmt":"2017-05-30T23:40:29","slug":"news-1573","status":"publish","type":"post","link":"https:\/\/www.palada.net\/index.php\/2017\/05\/30\/news-1573\/","title":{"rendered":"Spear Phishing Fileless Attack with CVE-2017-0199"},"content":{"rendered":"<p><strong>Credit to Author: Bahare Sabouri and He Xu| Date: Tue, 30 May 2017 16:21:54 -0700<\/strong><\/p>\n<div class=\"entry\">\n<h2>Introduction<\/h2>\n<p><a href=\"https:\/\/portal.msrc.microsoft.com\/en-US\/security-guidance\/advisory\/CVE-2017-0199\">CVE-2017-0199<\/a> is a remote code execution vulnerability that exists in the way that Microsoft Office and WordPad parse specially crafted files. An attacker who successfully exploits this vulnerability can take control of an affected system and then install programs, view, change, or delete data, or create new accounts with full user rights.<\/p>\n<p>Microsoft issued a patch for this vulnerability April, and most security vendors have published alarms for it. Unfortunately, attacks targeting this vulnerability are still widely being used in the wild.<\/p>\n<p>One of our FortiSandbox devices recently detected a suspicious RTF (Rich Text Format) file that it tagged as high risk. We here at FortiGuard Labs did some further investigation of the sample and found some interesting things. In this blog post, we will share what we found and attempt to reproduce the entire attack route.<\/p>\n<h2>Attack Route<\/h2>\n<h3>Stage 1<\/h3>\n<p>The high risk RTF file arrives in a spear phishing email as an attachment. When the victim opens the file with a vulnerable version of MS Word, the exploit is activated. Next, it proceeds to download a malicious HTA file from&nbsp; &ldquo;<i><u>http:\/\/5{REMOVED}.161\/wstat\/?id=77778888&amp;act=1<\/u><\/i>&rdquo;, as seen in Figure 1.<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/files\/0199%201%20.png\" style=\"width: 979px; height: 310px;\" \/><\/p>\n<p align=\"center\">Figure 1: Exploit retrieves an HTA file from the remote server<\/p>\n<p>At the same time, the sample drops an embedded PE file in a temporary folder and names it &ldquo;~WRF{C8E5B819-8668-4529-B7F9-2AB23E1F7F68}.tmp&rdquo;. Figure 2 shows the embedded PE file.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/files\/0199%202.png\" style=\"width: 789px; height: 451px;\" \/><\/p>\n<p align=\"center\">Figure 2: Embedded PE file in the RTF sample<\/p>\n<p>The downloaded HTA file is launched automatically. It executes the dropped PE file and performs some further attacks, according to its configuration. It is important to note that the HTA payload supports multi-vector attacks, as seen in Figure 3.<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/files\/0199%203.png\" style=\"width: 769px; height: 652px;\" \/><\/p>\n<p align=\"center\">Figure 3: HTA configuration code<\/p>\n<p>At the same time, it also collects system information according to its configuration, and sends the encoded data back to its C&amp;C server (Figure 4.)<\/p>\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/files\/0199%204.png\" style=\"width: 979px; height: 367px;\" \/><\/p>\n<p align=\"center\">&nbsp;&nbsp;&nbsp;&nbsp; Figure 4: Uploading the victim system report to the server<\/p>\n<p>The sample we analyzed retrieved system information, anti-virus information, process list, and attack payload status (Figure 5.)<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/files\/0199%205.png\" style=\"width: 350px; height: 653px;\" \/><\/p>\n<p align=\"center\">Figure 5: Collected data<\/p>\n<h3>Stage 2<\/h3>\n<p>There are many different attack approaches in HTA file, such as:<\/p>\n<p>\u25cf&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Executing a remote executable file \/ DLL file \/ ScriptLet file<\/p>\n<p>\u25cf&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Executing a local executable file \/ DLL file \/ ScriptLet file<\/p>\n<p>In this attack, the payload is pretty straightforward to execute the local executable file (embedded in the malware). But we also discovered two additional payloads: a remote executable file and a ScriptLet file (these two payloads weren&rsquo;t involved in this current attack).<\/p>\n<p>The ScriptLet payload could be used to bypass Applocker to load a real attack payload (Figure 6.)<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/files\/0199%206.png\" style=\"width: 784px; height: 504px;\" \/><\/p>\n<p align=\"center\">Figure 6: ScriptLet payload (not used in this attack)<\/p>\n<p>In this scenario, the core payload file retrieves a DLL file using an HTTPS protocol received from the remote C&amp;C server, <u>https:\/\/176.{removed}.134\/MAUy<\/u>, which stores the file in memory and then jumps to the first byte to execute it (Figure 7.)<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/files\/0199%207.png\" style=\"width: 979px; height: 281px;\" \/><\/p>\n<p align=\"center\">Figure 7: Memory only DLL<\/p>\n<p>The full attack route is pretty simple, but quite efficient. Figure 8 shows the attack scenario:<\/p>\n<p align=\"center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/files\/0199%208.png\" style=\"width: 613px; height: 1144px;\" \/><\/p>\n<p align=\"center\">Figure 8: Attack Route<\/p>\n<h2>Conclusion<\/h2>\n<p>This attack exposes vulnerable systems to significant risk. Failure to employ a patching protocol has been the root cause of a number of recent attacks. To fix the vulnerability discussed in the analysis, Fortinet recommends you install this Microsoft security&nbsp;<a href=\"https:\/\/portal.msrc.microsoft.com\/en-US\/security-guidance\/advisory\/CVE-2017-0199\">update<\/a>.<\/p>\n<p>Spear phishing is always a dangerous attack vector that often carries recent vulnerability exploits. To stay safe, be cautious when opening any emails coming from an unknown source.<\/p>\n<h3>Sample Information<\/h3>\n<p><strong>RTF file:<\/strong><\/p>\n<p>MD5: d4ff8e87f66150e36e4f70c65f422524<\/p>\n<p>SHA256: 2a918030be965cd5f365eb28cd5a0bebec32d05c6a27333ade3beaf3c54d242c<\/p>\n<p>Fortinet Detection Name: W32\/Snojan.BMST!tr<\/p>\n<p><strong>Dropped executable:<\/strong><\/p>\n<p>MD5: c4505c6a6b148c3d7b5f4d756f49dbdf<\/p>\n<p>SHA256: 39ac90410bd78f541eb42b1108d2264c7bd7a5feafe102cd7ac8f517c1bd3754<\/p>\n<p>Fortinet Detection Name: W32\/Snojan.BMST!tr<\/p>\n<p><strong>HTA file:<\/strong><\/p>\n<p>MD5: <a href=\"http:\/\/172.16.77.46\/st3\/view_info\/2c085826d56eb39570d0d76e34d52052\/\">2c085826d56eb39570d0d76e34d52052<\/a><\/p>\n<p>SHA256: 326a01a5e2eeeeebe3dade94cf0f7298f259b72e93bd1739505e14df3e7ac21e<\/p>\n<p>Fortinet Detection Name: VBS\/Dlr.A!tr<\/p>\n<\/div<br \/><a href=\"http:\/\/blog.fortinet.com\/2017\/05\/30\/spear-phishing-fileless-attack-with-cve-2017-0199\" target=\"bwo\" >https:\/\/blog.fortinet.com\/feed<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/d3gpjj9d20n0p3.cloudfront.net\/ngblog\/uploads\/files\/0199%201%20.png\"\/><\/p>\n<p><strong>Credit to Author: Bahare Sabouri and He Xu| Date: Tue, 30 May 2017 16:21:54 -0700<\/strong><\/p>\n<p>Introduction    CVE-2017-0199 is a remote code execution vulnerability that exists in the way that Microsoft Office and WordPad parse specially crafted files. An attacker who successfully exploits this vulnerability can take control of an affected system and then install programs, view, change, or delete data, or create new accounts with full user rights.    Microsoft issued a patch for this vulnerability April, and most security vendors have published alarms for it. Unfortunately, attacks targeting this vulnerability are still widely being used&#8230;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[10424,10378],"tags":[],"class_list":["post-7788","post","type-post","status-publish","format-standard","hentry","category-fortinet","category-security"],"_links":{"self":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/7788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/comments?post=7788"}],"version-history":[{"count":0,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/7788\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=7788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=7788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=7788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}