{"id":291,"date":"2019-04-17T13:22:57","date_gmt":"2019-04-17T11:22:57","guid":{"rendered":"https:\/\/lab52.es\/blog\/?p=291"},"modified":"2019-05-16T12:30:03","modified_gmt":"2019-05-16T10:30:03","slug":"ukraine-election-2019-polls-maldoc-analysis","status":"publish","type":"post","link":"https:\/\/lab52.io\/blog\/ukraine-election-2019-polls-maldoc-analysis\/","title":{"rendered":"Ukraine election 2019 polls Maldoc: analysis"},"content":{"rendered":"\n<p>From Lab52 at S2 Grupo, we have recently detected a malicious document titled \u201c<em>Ukraine_election_2019_polls.doc<\/em>\u201d. The document was uploaded to Virustotal on March 12nd, 2019 from Germany.<\/p>\n\n\n\n<p>The title and uploading date is especially relevant in this case, \nbecause of the existing conflict between Ukraine and Russia and the \ngeneral elections at Ukraine.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"487\" height=\"645\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img01.png\" alt=\"\" class=\"wp-image-292\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img01.png 487w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img01-227x300.png 227w\" sizes=\"(max-width: 487px) 100vw, 487px\" \/><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>Document content<\/em><\/p>\n\n\n\n<p>Regarding that, the first round of the general elections of Ukrania \n(15 days before the document was uploaded) took place on March 31st, and\n the second round will be on April 21st. The result of the elections \nwill have a definitive impact on the conflict between both countries.<\/p>\n\n\n\n<p>To give the reader some geopolitical background, the conflict between\n Russia and Ukraine began with the Crimea annexation (by the Russian \nFederation), and has lead to a second conflict due to the disruption of \nthe \u201c<em>maritime order in the Black Sea and the Sea of Azov. While the exact content of Ukraine\u2019s claims is not publicly known, <a href=\"http:\/\/tass.com\/world\/958661\">it is understood<\/a> that [Ukraine] include Russia\u2019s ongoing <a href=\"https:\/\/en.wikipedia.org\/wiki\/Kerch_Strait_Bridge\">construction of a bridge across Kerch Strait<\/a>\n and restrictions on passage of Ukrainian vessels through Kerch Strait \nand the Sea of Azov [\u2026]. Kerch Strait Bridge is intended to create a \nland connection between Crimea and Krasnodar region which, in light of <a href=\"https:\/\/www.ft.com\/content\/d5487eaa-9203-11e5-bd82-c1fb87bef7af\">Ukraine\u2019s blockade of Crimea<\/a>, is crucial for supplies from Russia<\/em>\u201c.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"531\" height=\"377\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Unbenannt.png\" alt=\"\" class=\"wp-image-293\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Unbenannt.png 531w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Unbenannt-300x213.png 300w\" sizes=\"(max-width: 531px) 100vw, 531px\" \/><\/figure><\/div>\n\n\n\n<p>[The text in italics and the image above comes from <a href=\"https:\/\/voelkerrechtsblog.org\/ukraine-v-russia-passage-through-kerch-strait-and-the-sea-of-azov\/\">this voelkerrechtsblog.org post<\/a> and is authored by <strong>Dmytro Koval<\/strong> and <strong>Valentin J. Schatz<\/strong>]<\/p>\n\n\n\n<p>There are three mainly candidates with high probabilities to win the \nelections: Petro Poroshenko, Yulia Tymoshenko and Volodymyr Zelenskiy. \nEach one has a specific way to approach the conflict, but the main \npositions are divided into looking for support from the European Union \nor get closer to the Russian Federation.<\/p>\n\n\n\n<p>The content of the document <a href=\"https:\/\/www.express.co.uk\/news\/world\/1092737\/ukraine-election-2019-polls-president-Volodymyr-Zelenskiy-russia-threat\">is a real news<\/a>\n coming from the conservative and liberal British Daily Express \nnewspaper. European right-wind citizens tend to align against the \nKremlin\u2019s international policies, what makes this document a good bait.<\/p>\n\n\n\n<p>All the context and sophistication of the content of the document \nmakes it to stand out from the generic campaigns of malware infections, \nfitting more into TTPs related to APT groups.<\/p>\n\n\n\n<p>Regarding its malicious logic, it depends on macros, which are \nprotected with a password in order to make its analysis more difficult:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"422\" height=\"207\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img02.png\" alt=\"\" class=\"wp-image-294\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img02.png 422w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img02-300x147.png 300w\" sizes=\"(max-width: 422px) 100vw, 422px\" \/><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>Password prompt<\/em><\/p>\n\n\n\n<p>This is not a serious problem, since there are many tools that allows\n to extract them despite that. Once extracted, we see the function \nresponsible for the execution of the threat:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"643\" height=\"293\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img03.png\" alt=\"\" class=\"wp-image-295\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img03.png 643w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img03-300x137.png 300w\" sizes=\"(max-width: 643px) 100vw, 643px\" \/><\/figure><\/div>\n\n\n\n<p style=\"font-size:16px;text-align:center\"><em>Malware execution function<\/em><\/p>\n\n\n\n<p>This function executes the next stages by extracting text in Base64 \nfrom the \u201cCompany\u201d field of the document metadata, decoding it and \nlaunching a \u201ccmd.exe\u201d with WMI.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"383\" height=\"155\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img04.png\" alt=\"\" class=\"wp-image-296\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img04.png 383w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img04-300x121.png 300w\" sizes=\"(max-width: 383px) 100vw, 383px\" \/><\/figure><\/div>\n\n\n\n<p>By\n executing the next payload through WMI, the process created does not \ndepend on the Microsoft Winword editor but \u201cWmiPrvSE.exe\u201d:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"515\" height=\"100\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img05.png\" alt=\"\" class=\"wp-image-297\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img05.png 515w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img05-300x58.png 300w\" sizes=\"(max-width: 515px) 100vw, 515px\" \/><\/figure><\/div>\n\n\n\n<p>The decrypted base64 text consists of a obfuscated Bash command that \nafter several calls to CMD.exe, ends up loading a Powershell.exe with \nthe final Payload.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/i2.wp.com\/www.securityartwork.es\/wp-content\/uploads\/2019\/04\/Maldoc_img06.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" width=\"740\" height=\"103\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img06.png\" alt=\"\" class=\"wp-image-298\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img06.png 740w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img06-300x42.png 300w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/a><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>Base64 encoded payload<\/em><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/i1.wp.com\/www.securityartwork.es\/wp-content\/uploads\/2019\/04\/Maldoc_img07.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" width=\"740\" height=\"137\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img07.png\" alt=\"\" class=\"wp-image-299\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img07.png 740w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img07-300x56.png 300w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/a><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>Decoded payload<\/em><\/p>\n\n\n\n<p>The final Powershell.exe process runs as follows:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/i1.wp.com\/www.securityartwork.es\/wp-content\/uploads\/2019\/04\/Maldoc_img08.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" width=\"643\" height=\"182\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img08.png\" alt=\"\" class=\"wp-image-300\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img08.png 643w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img08-300x85.png 300w\" sizes=\"(max-width: 643px) 100vw, 643px\" \/><\/a><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>Powershell process params<\/em><\/p>\n\n\n\n<p>If we take a look, the powershell call has several mistakes in its parameters, in spite of which it is perfectly functional:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>WindowStyl \u2013&gt; WindowsStyle<\/li><li>EexecutionPol \u2013&gt; ExecutionPolicy<\/li><\/ul>\n\n\n\n<p>Also, some extra parameters are truncated due to the use of a final \n\u201c\u2013\u201c, but after some iterations of de-obfuscation of the previous command\n in base64, we have been able to extract several elements that match a \npayload of a post-exploitation framework known as PowerShell Empire. \nAmong others, those are its <em>User-Agent<\/em> and <em>URI<\/em> by default.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/i2.wp.com\/www.securityartwork.es\/wp-content\/uploads\/2019\/04\/Maldoc_img09.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" width=\"580\" height=\"138\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img09.png\" alt=\"\" class=\"wp-image-301\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img09.png 580w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img09-300x71.png 300w\" sizes=\"(max-width: 580px) 100vw, 580px\" \/><\/a><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>Partially deobfuscated payload<\/em><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"585\" height=\"112\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img10.png\" alt=\"\" class=\"wp-image-302\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img10.png 585w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img10-300x57.png 300w\" sizes=\"(max-width: 585px) 100vw, 585px\" \/><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>Default PowerShell Empire payload config<\/em><\/p>\n\n\n\n<p>During its execution, the Powershell process constantly checks the \u201c<em>functiondiscovery[.]net<\/em>\u201d domain through port 8443 using the HTTPS protocol.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"740\" height=\"430\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img11.png\" alt=\"\" class=\"wp-image-303\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img11.png 740w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img11-300x174.png 300w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>C2 traffic<\/em><\/p>\n\n\n\n<p>Looking for the hash of the document in Virustotal, we see the \nfollowing comment, which suggests that it may be a dropper of the group \nAPT28 or Hades.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"639\" height=\"185\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img12.png\" alt=\"\" class=\"wp-image-304\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img12.png 639w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img12-300x87.png 300w\" sizes=\"(max-width: 639px) 100vw, 639px\" \/><\/figure><\/div>\n\n\n\n<p>The truth is that in addition to the pattern of infection and the \nsubject of the document (already exploited earlier by this group in \ntheir malicious documents), within the macros of this document we see \nthat the names of functions and their use of WMI coincide with another \nrecent document with hash \u201c<em>8cccdce85beca7b7dc805a7f048fcd1bc8f7614dd7e13c2986a9fa5dfbbbbdf9<\/em>\u201c,\n which the researcher @VK_intel suggests may be part of the APT28 \ntoolset. In that case, the threat that was embedded was a dll and much \nmore clearly attributed to this group:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"435\" height=\"558\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img13.png\" alt=\"\" class=\"wp-image-305\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img13.png 435w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img13-234x300.png 234w\" sizes=\"(max-width: 435px) 100vw, 435px\" \/><\/figure><\/div>\n\n\n\n<p>\nThese are some examples of functions with the same name inside the Macros on both documents and their use of WMI:\n<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/i2.wp.com\/www.securityartwork.es\/wp-content\/uploads\/2019\/04\/Maldoc_img14.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" width=\"740\" height=\"44\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img14.png\" alt=\"\" class=\"wp-image-306\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img14.png 740w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img14-300x18.png 300w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/a><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>Base64decode on both documents<\/em><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/i0.wp.com\/www.securityartwork.es\/wp-content\/uploads\/2019\/04\/Maldoc_img15.png?ssl=1\"><img loading=\"lazy\" decoding=\"async\" width=\"740\" height=\"204\" src=\"https:\/\/lab52.es\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img15.png\" alt=\"\" class=\"wp-image-307\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img15.png 740w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Maldoc_img15-300x83.png 300w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><\/a><\/figure><\/div>\n\n\n\n<p style=\"font-size:15px;text-align:center\"><em>Execute function + WMI logic on both documen<\/em>t<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><strong>Name<\/strong><\/td><td><strong>IOC<\/strong><\/td><\/tr><tr><td><strong>Ukraine_election_2019_polls.doc<\/strong><\/td><td>8a35b6ecdf43f42dbf1e77235d6017faa70d9c68930bdc891d984a89d895c1e7<\/td><\/tr><tr><td><strong>URL<\/strong><\/td><td>functiondiscovery[.]net:8443\/admin\/get.php<\/td><\/tr><tr><td><strong>IP<\/strong><\/td><td>185.216.35[.]182<\/td><\/tr><\/tbody><\/table>\n","protected":false},"excerpt":{"rendered":"<p>From Lab52 at S2 Grupo, we have recently detected a malicious document titled \u201cUkraine_election_2019_polls.doc\u201d. The document was uploaded to Virustotal on March 12nd, 2019 from Germany. The title and uploading date is especially relevant in this case, because of the existing conflict between Ukraine and Russia and the general elections at Ukraine. Document content Regarding [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":293,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-291","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-uncategorised","8":"entry"},"featured_image_src":"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Unbenannt.png","featured_image_src_square":"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2019\/04\/Unbenannt.png","author_info":{"display_name":"JagaimoKawaii","author_link":"https:\/\/lab52.io\/blog\/author\/jagaimokawaii\/"},"_links":{"self":[{"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts\/291"}],"collection":[{"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/comments?post=291"}],"version-history":[{"count":4,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts\/291\/revisions"}],"predecessor-version":[{"id":336,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts\/291\/revisions\/336"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/media\/293"}],"wp:attachment":[{"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/media?parent=291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/categories?post=291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/tags?post=291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}