{"id":88669,"date":"2020-03-03T15:24:12","date_gmt":"2020-03-03T09:54:12","guid":{"rendered":"https:\/\/blogs.quickheal.com\/?p=88669"},"modified":"2020-03-03T15:24:13","modified_gmt":"2020-03-03T09:54:13","slug":"mailto-ransomware-hiding-under-explorer-exe","status":"publish","type":"post","link":"https:\/\/www.quickheal.com\/blogs\/mailto-ransomware-hiding-under-explorer-exe\/","title":{"rendered":"Mailto Ransomware under the skin of explorer.exe"},"content":{"rendered":"<p>All of us, at some point in time, \u00a0must have heard the story of Wolf and the flock of sheep. The fooling trick used by the wicked wolf of pretending to be a sheep is still in use by many malware authors. They pretend to be genuine processes to achieve their villainy activities.<\/p>\n<p>Such a case has been recently observed in <em>Mailto<\/em> ransomware wherein it is making \u00a0use of legitimate windows process known as <em>\u2018explorer.exe\u2019<\/em>.<\/p>\n<p>Now, how are hackers doing this?<\/p>\n<p>The closest answer is, process code injection!<\/p>\n<p>That is correct, but this time the technique used for injection is not very \u00a0common.<\/p>\n<p>The <em>Mailto<\/em> or <em>Netwalker<\/em> performs process hollowing in e<em>xplorer.exe. <\/em>This helps in evading the Anti-Virus software (AVs) to \u00a0easily perform the encryption.<\/p>\n<p>In process hollowing, usually, the target process is created in suspended mode and the injection is carried out. But here the process is not created in suspended mode\u2014 rather it uses the <strong>\u2018Debug\u2019 mode<\/strong>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88670 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/1.png\" alt=\"\" width=\"919\" height=\"135\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/1.png 919w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/1-300x44.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/1-768x113.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/1-650x95.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/1-789x116.png 789w\" sizes=\"(max-width: 919px) 100vw, 919px\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.1: Mailto Creates the Process in Debug mode<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>To perform further injection activity, it gets the process and thread details using debug APIs like <em>WaitForDebugEvent. <\/em><\/p>\n<p style=\"text-align: center\"><em>\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88672\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/2.png\" alt=\"\" width=\"737\" height=\"84\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/2.png 737w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/2-300x34.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/2-650x74.png 650w\" sizes=\"(max-width: 737px) 100vw, 737px\" \/><\/em><\/p>\n<p style=\"text-align: center\"><em><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-88673\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/3.png\" alt=\"\" width=\"624\" height=\"77\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/3.png 527w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/3-300x37.png 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/>\u00a0<\/em><\/p>\n<p style=\"text-align: center\"><em>Fig.2: API to get the process and thread details<\/em><\/p>\n<p><em>\u00a0<\/em><\/p>\n<p>Then, a section is created with a size similar to that of the sample using <em>ZwCreateSection <\/em>and its view is mapped in the current process using <em>ZwMapViewOfSection<\/em>.<\/p>\n<p>&nbsp;<\/p>\n<p>In this view, the sample file is copied, and manual relocation is performed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88674 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/4.png\" alt=\"\" width=\"655\" height=\"610\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/4.png 655w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/4-300x279.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/4-419x390.png 419w\" sizes=\"(max-width: 655px) 100vw, 655px\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.3: Relocation of Hardcoded addresses<\/em><\/p>\n<p>The view of this section is then unmapped using <em>ZwUnmapViewOfSection<\/em>. The thread context of the process created (e<em>xplorer.exe<\/em>) is retrieved and changes are made, setting the start address of the thread from where the execution is intended to begin.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88675 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/5.png\" alt=\"\" width=\"684\" height=\"98\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/5.png 684w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/5-300x43.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/5-650x93.png 650w\" sizes=\"(max-width: 684px) 100vw, 684px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88676 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/6.png\" alt=\"\" width=\"678\" height=\"87\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/6.png 678w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/6-300x38.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/6-650x83.png 650w\" sizes=\"(max-width: 678px) 100vw, 678px\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.4: Setting the Start address of injected code<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Finally, call to <em>ContinueDebugEvent <\/em>and <em>DebugActiveProcessStop<\/em> makes the execution of the thread \u2018start\u2019 that will be responsible for the encryption of the files. The process tree is shown in the below image.<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88677\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/7.png\" alt=\"\" width=\"784\" height=\"116\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/7.png 784w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/7-300x44.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/7-768x114.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/7-650x96.png 650w\" sizes=\"(max-width: 784px) 100vw, 784px\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.5: Process Tree<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>When we decrypt the encrypted data present in the <em>.rsrc<\/em> section, we get all the important information present in JSON format. This information contains <em>base64 <\/em>encrypted ransom note, e-mail addresses used in the ransom note, processes that need to be killed if in execution, whitelisted paths, file names and extensions, etc.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88678 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/8.png\" alt=\"\" width=\"558\" height=\"598\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/8.png 558w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/8-280x300.png 280w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/8-364x390.png 364w\" sizes=\"(max-width: 558px) 100vw, 558px\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.6: Decrypted data<\/em><\/p>\n<p>&nbsp;<\/p>\n<h2>Injected explorer.exe Activity<\/h2>\n<p>After injection, the malware (i.e. injected <strong>explorer.exe<\/strong>) drops its copy at \u2018<em>%ProgramFiles%\\&lt;8 Alphanumeric characters&gt;\\&lt;8 Alphanumeric characters&gt;.exe<\/em>\u2019 and sets the RUN entry for its persistence.<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-88679\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/9.png\" alt=\"\" width=\"774\" height=\"285\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/9.png 585w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/9-300x110.png 300w\" sizes=\"(max-width: 774px) 100vw, 774px\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.7: RUN Entry<\/em><\/p>\n<p><strong><em>\u00a0<\/em><\/strong>Further, it deletes the shadow copies of the system using the command:<\/p>\n<p style=\"text-align: center\"><em>\u2018%system32%\\vssadmin.exe delete shadows \/all \/quiet<\/em><em>\u2019<\/em><\/p>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong>ID Generation<\/strong><\/p>\n<p>The ID is the extension that will be used for newly encrypted files and as \u00a0the name of ransom note file. It is generated using the key kept under the tag \u2018<strong>mpk\u2019<\/strong> in decrypted JSON, the retrieved computer name and the hardware profile information about the machine being infected (through <em>GetCurrentHwProfileW <\/em>Windows API).<\/p>\n<p>&nbsp;<\/p>\n<p>SHA-256 of these components is calculated and the first five characters of the output are used as the new extension of encrypted files. Its first eight characters are used as the name of the directory and as the filename when the self-copy is dropped at \u2018<em>%ProgramFiles%\u2019.<\/em><\/p>\n<p><em>\u00a0<\/em><\/p>\n<p><strong>SHA-256 Output:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-88680 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/10.png\" alt=\"\" width=\"750\" height=\"114\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/10.png 592w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/10-300x46.png 300w\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-88681 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/11.png\" alt=\"\" width=\"742\" height=\"433\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/11.png 550w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/11-300x175.png 300w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.8: Encrypted Files with Extension generated above<\/em><\/p>\n<p>The files are encrypted with SALSA20 algorithm and the filename is appended with \u2018<em>.mailto[&lt;mail-id&gt;].&lt;ID generated above(I.e extension)&gt;\u2019.<\/em><\/p>\n<p>After encryption, the <strong>\u2018explorer.exe\u2019<\/strong> kills the parent process and deletes the original sample, the file dropped at <em>%ProgramFiles%<\/em> and also the RUN entry, eradicating \u00a0the traces of its existence.<\/p>\n<p>The Infection Vector is not clear as yet , but most likely the attacker may have used spam mails for propagation.<\/p>\n<p>A ransom note is dropped with the name \u2018&lt;ID&gt;-Readme.txt\u2019 containing the ransom payment details on every encrypted location.<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88682\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/12.png\" alt=\"\" width=\"765\" height=\"621\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/12.png 765w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/12-300x244.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/12-480x390.png 480w\" sizes=\"(max-width: 765px) 100vw, 765px\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.9: Ransom Note<\/em><\/p>\n<p><em>\u00a0<\/em><\/p>\n<p><strong>Conclusion<\/strong><\/p>\n<p>Several old stories educate \u00a0us to be aware of roguery intentions of those whom we trust easily \u2014one should take care and should not completely trust the processes that appear to be legitimate that \u00a0ultimately might \u00a0help malware to bypass security products.<\/p>\n<p>Here, the injection through process hollowing is done in <em>explorer.exe<\/em> which itself makes it very difficult to make its presence perceptible. Moreover, while creating the process for injection, instead of using a suspended mode, it is using the not so commonly used \u2018Debug\u2019 mode. This makes AV prevention techniques to fail.<\/p>\n<p>&nbsp;<\/p>\n<h2>How Quick Heal protects its users from the Mailto Ransomware?<\/h2>\n<p>Quick Heal successfully blocks Mailto ransomware with the following protection layers:<\/p>\n<ol>\n<li>Virus Protection<\/li>\n<li>Behavior Detection<\/li>\n<\/ol>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-88683 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/13.jpg\" alt=\"\" width=\"377\" height=\"207\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/13.jpg 303w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2020\/03\/13-300x164.jpg 300w\" sizes=\"(max-width: 377px) 100vw, 377px\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.10: Virus Protection<\/em><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-88684 aligncenter\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2020\/03\/14.png\" alt=\"\" width=\"376\" height=\"198\" \/><\/p>\n<p style=\"text-align: center\"><em>Fig.11: Behavior Detection<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><strong>IOCs:<\/strong><\/p>\n<p><em>207D2A5AA3A00B8C908B6CFFCF6DDED8<\/em><\/p>\n<p><em>3D6203DF53FCAA16D71ADD5F47BDD060<\/em><\/p>\n<p><em>775F5027ABC97C0EC8E9202A4ED4CC14<\/em><\/p>\n<p><em>B0008E752F488D7E97A8D2452411527E<\/em><\/p>\n<p><em>73DE5BABF166F28DC81D6C2FAA369379<\/em><\/p>\n<p><em>D7D7F3C95D03367C61BCFDFE4E7AB47A<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Subject Matter Expert:<\/strong><\/p>\n<p>Priyanka Shinde, Umar Khan |\u00a0Quick Heal Security Labs<\/p>\n","protected":false},"excerpt":{"rendered":"<p>All of us, at some point in time, \u00a0must have heard the story of Wolf and the flock of sheep. The fooling trick used by the wicked wolf of pretending to be a sheep is still in use by many malware authors. They pretend to be genuine processes to achieve their villainy activities. Such a [&hellip;]<\/p>\n","protected":false},"author":72,"featured_media":88694,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[910],"tags":[534,1722,50],"class_list":["post-88669","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ransomware","tag-cybersecurity","tag-mailto","tag-ransomware"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/88669"}],"collection":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/users\/72"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/comments?post=88669"}],"version-history":[{"count":9,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/88669\/revisions"}],"predecessor-version":[{"id":88695,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/88669\/revisions\/88695"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media\/88694"}],"wp:attachment":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media?parent=88669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/categories?post=88669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/tags?post=88669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}