{"id":788,"date":"2020-03-23T13:33:45","date_gmt":"2020-03-23T12:33:45","guid":{"rendered":"https:\/\/lab52.io\/blog\/?p=788"},"modified":"2020-03-23T14:22:52","modified_gmt":"2020-03-23T13:22:52","slug":"apt-c-36-new-anti-detection-tricks","status":"publish","type":"post","link":"https:\/\/lab52.io\/blog\/apt-c-36-new-anti-detection-tricks\/","title":{"rendered":"APT-C-36 new anti-detection tricks"},"content":{"rendered":"\n<p>Lab52 has recently detected an increase in the efforts carried out by APT-C-36 to improve their capabilities to remain undetected by Anti Malware software, using a more complex infection chain than a simple packer, as they have been doing so far.<\/p>\n\n\n\n<p>The\nsample detected using this new detection evasion technique has a name\nand icon that tries to supplant a PDF document, which is already a\ncommon TTP of this group. \n<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"180\" height=\"165\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/1.png\" alt=\"\" class=\"wp-image-789\"\/><\/figure><\/div>\n\n\n\n<p>Until\nnow, these binaries were executables packed with common anti-virus\ncircumvention software, but in this case it is an &#8220;SFX\nInstaller&#8221; that contains a bunch of files, including some that\nare simply trash and others that are part of the infection chain:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"876\" height=\"341\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/2.png\" alt=\"\" class=\"wp-image-790\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/2.png 876w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/2-300x117.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/2-768x299.png 768w\" sizes=\"(max-width: 876px) 100vw, 876px\" \/><\/figure><\/div>\n\n\n\n<p>When these installers are executed, they create a temporary folder on the system, where they dump all the files they contain, and then execute one of them as an &#8220;Entry Point&#8221; in the execution\/infection chain.  <\/p>\n\n\n\n<p>In this case, it is called gospels.exe:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"418\" height=\"45\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/3.png\" alt=\"\" class=\"wp-image-791\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/3.png 418w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/3-300x32.png 300w\" sizes=\"(max-width: 418px) 100vw, 418px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"431\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/4.png\" alt=\"\" class=\"wp-image-792\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/4.png 724w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/4-300x179.png 300w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/figure><\/div>\n\n\n\n<p>This\nexecutable consists of a very small program that simply loads\ndynamically the library &#8220;Quoteworthy.dll&#8221; that is near the\nbinary, and calls its exported function &#8220;Excluders&#8221;,\npassing as parameters some system APIs resolved by the original\nexecutable:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"367\" height=\"428\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/5.png\" alt=\"\" class=\"wp-image-793\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/5.png 367w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/5-257x300.png 257w\" sizes=\"(max-width: 367px) 100vw, 367px\" \/><\/figure><\/div>\n\n\n\n<p>The\nDLL&#8217;s Excluders function simply calls two internal functions:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"250\" height=\"372\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/6.png\" alt=\"\" class=\"wp-image-794\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/6.png 250w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/6-202x300.png 202w\" sizes=\"(max-width: 250px) 100vw, 250px\" \/><\/figure><\/div>\n\n\n\n<p>The first one (unk_6D321170), consists of code that is part of the DLL, and that is in charge of deciphering (with an XOR algorithm) a buffer contained in the .data section of the library. Inside this buffer, the function ignores out of every 4 bytes (since they are zeros). After building this buffer, it reserves a memory area with execution permissions and copies there the decoded content. Then it creates an array of 7 elements in which it stores the string &#8220;Boondoggle&#8221; (which corresponds to a binary file inside the temporary folder), 4 numbers, and the pointers to the functions &#8220;GetProcAddres&#8221; and &#8220;GetModuleHandleA&#8221; that match with the ones received as parameters by this DLL:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"543\" height=\"103\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/7.png\" alt=\"\" class=\"wp-image-795\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/7.png 543w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/7-300x57.png 300w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"418\" height=\"114\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/8.png\" alt=\"\" class=\"wp-image-796\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/8.png 418w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/8-300x82.png 300w\" sizes=\"(max-width: 418px) 100vw, 418px\" \/><\/figure><\/div>\n\n\n\n<p>After that, the first function of this DLL ends and calls the second one, which, at this point of the execution, points to the memory area where it was written the decoded shellcode, and to which it passes as parameter the before mentioned 7-element array.<\/p>\n\n\n\n<p>Once\nit jumps to that shellcode, using GetProcAddres and GetModuleHandle,\nit extracts a list of Kernel32 Functions that are &#8220;hardcoded&#8221;:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"248\" height=\"514\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/9.png\" alt=\"\" class=\"wp-image-797\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/9.png 248w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/9-145x300.png 145w\" sizes=\"(max-width: 248px) 100vw, 248px\" \/><\/figure><\/div>\n\n\n\n<p>It\nloads the &#8220;Boondoggle&#8221; file with the CreateFile API and\nmakes a decode with the same XOR key as before, from which it decodes\na new complete executable and a small &#8220;PE Loader&#8221; that\nallows it to load the executable into memory using the technique\nknown as &#8220;ReflectivePEInjection&#8221; either in the process\nitself or in a remote process.<\/p>\n\n\n\n<p>After this, it runs the decrypted binary, which repeats the same logic over another section of the &#8220;Boondoggle&#8221; from which it extracts a second executable, this time consisting of a copy of the &#8220;OllyDBG&#8221; plug-in called &#8220;OllyDBG PE Dumper&#8221; which contains overwritten malicious code that is called.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"541\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/10.png\" alt=\"\" class=\"wp-image-798\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/10.png 523w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/10-290x300.png 290w\" sizes=\"(max-width: 523px) 100vw, 523px\" \/><\/figure><\/div>\n\n\n\n<p>This\ndll extracts the final threat and in case the initial binary\n&#8220;gospels.exe&#8221; had been executed from the installer arriving\nby mail, it has been observed that it is injected in a legitimate new\nprocess &#8220;cmd.exe&#8221;. On the other hand, in case it is loaded\nthrough its persistence in the registry, it is injected in the\nprocess &#8220;gospels.exe&#8221; itself.<\/p>\n\n\n\n<p>An interesting point of this stage of infection is that it tries to remove a file called &#8220;turpitude.exe&#8221; that should be located in the user&#8217;s %APPDATA% folder, but no trace has been observed at any point of the analysis, thus it could be an attempt to clean up tools from previous campaigns of this group, although it has not been able to confirm this fact through the analysis of the threat.<\/p>\n\n\n\n<p>Eventually, the final threat remains completely deployed in the memory of the machine, which in this case consists on the &#8220;Remcos&#8221; remote acces trojan.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"402\" height=\"112\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/11.png\" alt=\"\" class=\"wp-image-799\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/11.png 402w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/11-300x84.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/11-400x112.png 400w\" sizes=\"(max-width: 402px) 100vw, 402px\" \/><\/figure><\/div>\n\n\n\n<p style=\"text-align:left\">This threat contacts the command and control domain &#8220;pruebaremc.]duckdns.org&#8221; through port &#8220;1010&#8221;.<\/p>\n\n\n\n<p class=\"has-large-font-size\">IOCS:<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td>SHA256<\/td><td> E03903AFC4DC4A9DEEDF5442B6D1C8319194F57F1D7620A9C4EBC7D61C436B70 <\/td><\/tr><tr><td>DNS<\/td><td> pruebaremc.duckdns.]org <\/td><\/tr><\/tbody><\/table>\n","protected":false},"excerpt":{"rendered":"<p>Lab52 has recently detected an increase in the efforts carried out by APT-C-36 to improve their capabilities to remain undetected by Anti Malware software, using a more complex infection chain than a simple packer, as they have been doing so far. The sample detected using this new detection evasion technique has a name and icon [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":802,"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-788","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\/2020\/03\/Captura-de-pantalla-de-2020-03-23-13-41-51.png","featured_image_src_square":"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2020\/03\/Captura-de-pantalla-de-2020-03-23-13-41-51.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\/788"}],"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=788"}],"version-history":[{"count":7,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts\/788\/revisions"}],"predecessor-version":[{"id":807,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts\/788\/revisions\/807"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/media\/802"}],"wp:attachment":[{"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/media?parent=788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/categories?post=788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/tags?post=788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}