{"id":15137,"date":"2019-04-19T11:10:03","date_gmt":"2019-04-19T19:10:03","guid":{"rendered":"https:\/\/www.palada.net\/index.php\/2019\/04\/19\/news-8886\/"},"modified":"2019-04-19T11:10:03","modified_gmt":"2019-04-19T19:10:03","slug":"news-8886","status":"publish","type":"post","link":"https:\/\/www.palada.net\/index.php\/2019\/04\/19\/news-8886\/","title":{"rendered":"Funky malware format found in Ocean Lotus sample"},"content":{"rendered":"<p><strong>Credit to Author: hasherezade| Date: Fri, 19 Apr 2019 18:37:54 +0000<\/strong><\/p>\n<p>Recently, <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/speakerdeck.com\/hshrzd\/funky-malware-formats\" target=\"_blank\">at the SAS conference I talked about &#8220;Funky malware formats&#8221;<\/a>\u2014atypical executable formats used by malware that are only loaded by proprietary loaders. Malware authors use these formats, such as a custom format that is not recognized as an executable by AV scanners, in order to make static detection more difficult. <\/p>\n<p>Using atypical formats may also slow down the analysis process because the file can&#8217;t be parsed out of the box by typical tools. Instead, we need to <a rel=\"noreferrer noopener\" aria-label=\"write custom loaders (opens in a new tab)\" href=\"https:\/\/www.msreverseengineering.com\/blog\/2018\/9\/2\/weekend-project-a-custom-ida-loader-module-for-the-hidden-bee-malware-family\" target=\"_blank\">write custom loaders<\/a> in order to analyze them freely.<\/p>\n<p>Last year, we described one such format in <a href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/reversing-malware-in-a-custom-format-hidden-bee-elements\/\">a post about Hidden Bee<\/a>. This time, we want to introduce you to a malware we discussed at the SANS Conference: Ocean Lotus, also known as APT 32, a threat group associated with Vietnam.<\/p>\n<h3>Sample<\/h3>\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/beta.virusbay.io\/sample\/browse\/46745e29f15eedfabba7e080f6295200?q=5c069cf73d275127369cb440\" target=\"_blank\">49a2505d54c83a65bb4d716a27438ed8f065c709<\/a> &#8211; the main executable<\/p>\n<p><em>Special thanks to <\/em><a href=\"https:\/\/twitter.com\/MinhTrietPT\"><em>Minh-Triet Pham Tran<\/em><\/a><em> for providing the material.<\/em><\/p>\n<h3>Overview<\/h3>\n<p>The sample comes with two elements\u2014BLOB and CAB\u2014that are both executables in the same unknown format. The custom format is achieved by conversion from PE format. (There are some artifacts that indicate it manifests in a way typical for PE files.) However, the header is fully custom, and the way of loading it has no resemblance with PE. Some of the information from the typical PE (for example, layout sections) is not preserved: sections are shuffled.<\/p>\n<h3>Origin<\/h3>\n<p>This sample is from June 10, 2017, from the following email:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38264\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/viet_email\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/viet_email.png\" data-orig-size=\"875,316\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"viet_email\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/viet_email-300x108.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/viet_email-600x217.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/viet_email.png\" alt=\"\" class=\"wp-image-38264\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/viet_email.png 875w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/viet_email-300x108.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/viet_email-600x217.png 600w\" sizes=\"(max-width: 875px) 100vw, 875px\" \/><figcaption>Content of the phishing email, along with its attachment<\/figcaption><\/figure>\n<p>The title &#8220;S\u1ed5 tay v\u1ea5n \u0111\u1ec1 ph\u00e1p l\u00fd cho c\u00e1c nh\u00e0 ho\u1ea1t \u0111\u1ed9ng nh\u00e2n quy\u1ec1n&#8221; translates to: &#8220;Handbook of legal issues for human rights activists.&#8221; It&#8217;s a subject line for a spear phishing campaign targeting Vietnamese activists.<\/p>\n<p>The malicious sample was delivered as an attachment to the email: a zipped executable. The icon tried to imitate a PDF (FoxitPDF reader).<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38284\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/imitate_pdf\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imitate_pdf.png\" data-orig-size=\"78,126\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"imitate_pdf\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imitate_pdf.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imitate_pdf.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imitate_pdf.png\" alt=\"\" class=\"wp-image-38284\"\/><figcaption>An executable with FoxitFDF icon<\/figcaption><\/figure>\n<h3>Behavioral analysis<\/h3>\n<p>After being run, the sample copies itself into %TEMP%, unpacks, and launches the decoy PDF.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38285\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/unpacked\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked.png\" data-orig-size=\"667,152\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"unpacked\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked-300x68.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked-600x137.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked-600x137.png\" alt=\"\" class=\"wp-image-38285\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked-600x137.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked-300x68.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked.png 667w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><figcaption>The main executable and the decoy copied to the Temp folder<\/figcaption><\/figure>\n<p>While the user is busy reading the launched document, the dropper unpacks the real payload. It is dropped into <em>C:ProgramDataMicrosoft Help<\/em>:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38286\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/unpacked2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked2.png\" data-orig-size=\"582,368\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"unpacked2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked2-300x190.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked2.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked2.png\" alt=\"\" class=\"wp-image-38286\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked2.png 582w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/unpacked2-300x190.png 300w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><figcaption>All the elements of the malware unpacked<\/figcaption><\/figure>\n<p>The dropper executable is deleted afterwards.<\/p>\n<p>The malware manages to bypass UAC at default level. We can see the application <em>sporder.exe<\/em> running with elevated privileges.<br \/>Persistence is provided by a simple Run key, leading to the dropped script:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38287\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/run_key-6\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/run_key.png\" data-orig-size=\"583,39\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"run_key\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/run_key-300x20.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/run_key.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/run_key.png\" alt=\"\" class=\"wp-image-38287\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/run_key.png 583w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/run_key-300x20.png 300w\" sizes=\"(max-width: 583px) 100vw, 583px\" \/><figcaption>Added run key (view from Sysinternals Autoruns)<\/figcaption><\/figure>\n<p>The interesting factor is that the sample has an &#8220;expiry date&#8221; after which the installer no longer runs.<\/p>\n<h3>Internals<\/h3>\n<p>The main executable sporder.exe is packed with UPX. It imports the DLL SPORDER.dll:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38291\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/sporder_exe_imports\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_exe_imports.png\" data-orig-size=\"678,286\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"sporder_exe_imports\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_exe_imports-300x127.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_exe_imports-600x253.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_exe_imports.png\" alt=\"\" class=\"wp-image-38291\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_exe_imports.png 678w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_exe_imports-300x127.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_exe_imports-600x253.png 600w\" sizes=\"(max-width: 678px) 100vw, 678px\" \/><figcaption>Import table of SPORDER.exe (view from PE-bear)<\/figcaption><\/figure>\n<p>SPORDER.dll imports another of the dropped DLLs, <em>hp6000.dll<\/em>:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38289\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/sproder_dll_imports\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sproder_dll_imports.png\" data-orig-size=\"728,126\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"sproder_dll_imports\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sproder_dll_imports-300x52.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sproder_dll_imports-600x104.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sproder_dll_imports-600x104.png\" alt=\"\" class=\"wp-image-38289\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sproder_dll_imports-600x104.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sproder_dll_imports-300x52.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sproder_dll_imports.png 728w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><figcaption>Import table of SPORDER.exe (view from PE-bear)<\/figcaption><\/figure>\n<p>The key malware functionality is, however, not provided by any of the dropped PE files. They are just used as loaders.<\/p>\n<p>As it turns out, the core is hidden in two unknown files: BLOB and CAB.<\/p>\n<h3>Custom formats<\/h3>\n<p>The files with extensions BLOB and CAB are obfuscated with XOR. After decoding them, we notice some readable strings of code. However, none of them are valid PE files, and we cannot find any of the typical headers.<\/p>\n<h4>BLOB<\/h4>\n<p>The BLOB file is obfuscated by XOR. We can see the repeating pattern and use it as an XOR key:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38290\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/sporder_original\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_original.png\" data-orig-size=\"627,150\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"sporder_original\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_original-300x72.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_original-600x144.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_original.png\" alt=\"\" class=\"wp-image-38290\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_original.png 627w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_original-300x72.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/sporder_original-600x144.png 600w\" sizes=\"(max-width: 627px) 100vw, 627px\" \/><figcaption>SPORDER.blob (original version), the repeating pattern is selected<\/figcaption><\/figure>\n<p> As a result, we get the following clear version: <a rel=\"noreferrer noopener\" aria-label=\"2e68afae82c1c299e886ab0b6b185658 (opens in a new tab)\" href=\"https:\/\/www.virustotal.com\/#\/file\/f3f62d0813c1226316e12d0d403bad475b6f0128918a845695686d4b9359c546\/detection\" target=\"_blank\">2e68afae82c1c299e886ab0b6b185658<\/a><\/p>\n<p>BLOB&#8217;s header:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"46\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2012\/04\/anonymizing-traffic-for-your-vm-and-capturing-traffic\/attachment\/vmnet3janusconfig\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/04\/VMNet3JanusConfig.jpg\" data-orig-size=\"662,561\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"VMNet3JanusConfig\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/04\/VMNet3JanusConfig-300x254.jpg\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/04\/VMNet3JanusConfig.jpg\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/blob_decoded.png\" alt=\"\" class=\"wp-image-46\"\/><\/figure>\n<p>The BLOB file looks like a processed PE file, however, its sections appear to be in swapped order. The first section seems to be .data, instead of .text.<\/p>\n<p>We can see visible artifacts from the <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/google\/bzip2-rpc\/blob\/master\/bzlib.c\" target=\"_blank\">BZIP library<\/a> and C++ standard library.<\/p>\n<h4>CAB<\/h4>\n<p>The CAB file is obfuscated with XOR in a similar way, but with a different key:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38251\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/cab_enc\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/cab_enc.png\" data-orig-size=\"624,104\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"cab_enc\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/cab_enc-300x50.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/cab_enc-600x100.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/cab_enc-600x100.png\" alt=\"\" class=\"wp-image-38251\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/cab_enc-600x100.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/cab_enc-300x50.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/cab_enc.png 624w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/figure>\n<p>When we apply the key, we get an analogical clear version: <a rel=\"noreferrer noopener\" aria-label=\"b3f9a8adf0929b2a37db7b396d231110 (opens in a new tab)\" href=\"https:\/\/www.virustotal.com\/#\/file\/a87d6c0ef82bd430e7b54de5b41668bf2f1fa688e45206c871f259508653d006\/details\" target=\"_blank\">b3f9a8adf0929b2a37db7b396d231110<\/a><\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"36\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2012\/04\/anonymizing-traffic-for-your-vm\/attachment\/runrunbat\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/04\/RunRunBat.jpg\" data-orig-size=\"347,179\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"RunRunBat\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/04\/RunRunBat-300x154.jpg\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/04\/RunRunBat.jpg\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/header_cab.png\" alt=\"\" class=\"wp-image-36\"\/><\/figure>\n<p>This sample also has a custom header, which does not resemble the PE header. However, we found sections inside that are typical for PE files, for example, a manifest.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"44\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2012\/04\/anonymizing-traffic-for-your-vm-and-capturing-traffic\/\" data-orig-file=\"\" data-orig-size=\"\" data-comments-opened=\"1\" data-image-meta=\"[]\" data-image-title=\"Anonymizing Traffic for your VM And Capturing Traffic\" data-image-description=\"&lt;p&gt;&lt;strong&gt;Security Level:&lt;\/strong&gt; &lt;span style=&quot;color: #800000&quot;&gt;&lt;strong&gt;High \/ Hardcore&lt;\/strong&gt;&lt;\/span&gt;&lt;\/p&gt; &lt;p&gt;&lt;strong&gt;Purpose:&lt;\/strong&gt; To hide who you are while performing research through your browser AND protecting your host system from drive-by download attacks AND being able to perform dynamic malware analysis and capture malicious traffic moving between the malware and the C&amp;amp;C. (Whew, that&#8217;s a lot of ANDs. =D)&lt;\/p&gt; &lt;p&gt;&lt;strong&gt;Benefits:&lt;\/strong&gt;&lt;\/p&gt; &lt;ul&gt; &lt;li&gt;Hide your IP&lt;\/li&gt; &lt;li&gt;Protect the host system by running in a virtual environment&lt;\/li&gt; &lt;li&gt;Execute malware in a safe environment \/w traffic capture&lt;\/li&gt; &lt;li&gt;One time setup, no Windows VPN necessary&lt;\/li&gt; &lt;li&gt;Ability to revert to snapshots, restart the system without losing anonymity.&lt;\/li&gt; &lt;\/ul&gt; &lt;p&gt;&lt;strong&gt;Drawbacks:&lt;\/strong&gt;&lt;\/p&gt; &lt;ul&gt; &lt;li&gt;It&#8217;s downright difficult to set up if not familiar with the technology&lt;\/li&gt; &lt;li&gt;Need more things to start with than previous solutions.&lt;\/li&gt; &lt;li&gt;Requires occasional VPN re-initialization \/ DHCP re-connection&lt;\/li&gt; &lt;\/ul&gt; &lt;p&gt;&lt;strong&gt;What you\u2019ll need:&lt;\/strong&gt;&lt;\/p&gt; &lt;ul&gt; &lt;li&gt;VMWare Player &#8211; &lt;a href=&quot;https:\/\/www.vmware.com\/products\/player\/&quot;&gt;https:\/\/www.vmware.com\/products\/player\/&lt;\/a&gt;&lt;\/li&gt; &lt;li&gt;JanusVM &#8211; &lt;a href=&quot;http:\/\/janusvm.com\/&quot;&gt;http:\/\/janusvm.com\/&lt;\/a&gt;&lt;\/li&gt; &lt;li&gt;Another Virtualization Application (Vmware \/ VirtualBox \/ etc.)&lt;\/li&gt; &lt;li&gt;An operating system to run on said virtualization application &lt;ul&gt; &lt;li&gt;Note: If you are already a malware researcher, chances are you are already running some kind of virtual environment for analysis, etc.&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;A Linux virtual environment &lt;ul&gt; &lt;li&gt;Your Linux system will need the following utilities: &lt;ul&gt; &lt;li&gt;Net-tools&lt;\/li&gt; &lt;li&gt;IPTables&lt;\/li&gt; &lt;li&gt;Dnsmasq&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Note: You can use whatever you want but in this tutorial I use a specific VMware image of Mint Linux, it is available free here: &lt;ul&gt; &lt;li&gt;&lt;a href=&quot;http:\/\/www.trendsigma.net\/vmware\/mint11t.html&quot;&gt;http:\/\/www.trendsigma.net\/vmware\/mint11t.html&lt;\/a&gt;&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;\/ul&gt; &lt;p&gt;&lt;!--more--&gt;&lt;\/p&gt; &lt;p&gt;&lt;strong&gt;Situation:&lt;\/strong&gt;&lt;\/p&gt; &lt;p&gt;Your research has paid off, you got your hands on some new and exciting malware samples which could be the connection between two criminal organizations, and you think the traffic might give away some clues into who built this malware. You could send it to an online analysis service but you don\u2019t want it leaked to anyone just yet. You want to maintain your anonymity so you execute the malware while connected to the VPN in Windows, you set up two instances of Wireshark, one on the inside VM and one on the outside connection on your host system.&lt;\/p&gt; &lt;p&gt;You execute the malware and it immediately restarts the system. Drat. When the system comes back up, even though you have configured your VPN to start automatically, it takes a little while to connect, you know that this malware checks for a connection at startup and if it can\u2019t find one, it won\u2019t beacon. You decide that maybe the outside Wireshark caught something before the system restarted, only to discover that all you captured was encrypted VPN traffic! Oh noes!&lt;\/p&gt; &lt;p&gt;&lt;strong&gt;What are we doing?&lt;\/strong&gt;&lt;\/p&gt; &lt;p&gt;We are going to connect to the Janus VPN via our Linux image, which is also working as a DHCP server that the Windows analysis system automatically connects to. To top it all off all three are on the same private network with the only outside access only being available to one of JanusVM\u2019s interfaces. This means that there is no possible way that any traffic can get out of your analysis VM without first being masked, encrypted and redirected.&lt;\/p&gt; &lt;p&gt;&lt;strong&gt;How:&lt;\/strong&gt;&lt;\/p&gt; &lt;ol&gt; &lt;li&gt;Download and set up JanusVM (see the previous section)&lt;\/li&gt; &lt;li&gt;Set up your Windows Analysis VM&lt;\/li&gt; &lt;li&gt;Download a Linux Image or ISO file and install Linux in VMware Player (If you haven\u2019t already) &lt;ul&gt; &lt;li&gt;It is recommended to use the Linux Mint Image referenced above, it comes pre-installed with VMware Tools&lt;\/li&gt; &lt;li&gt;Download and install all the utilities listed above.&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Set the Windows VM to use VMnet3 in its network interface settings and ensure DHCP is running on the interface. Set your Linux VM to use vmnet3 as well. &lt;p&gt;&lt;a href=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/VMNet3JanusConfig.jpg&quot;&gt;&lt;img class=&quot;size-medium wp-image-46&quot; src=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/VMNet3JanusConfig-300x254.jpg&quot; alt=&quot;VMNet3 Configuration&quot; width=&quot;300&quot; height=&quot;254&quot; \/&gt;&lt;\/a&gt;&lt;\/p&gt; &lt;ul&gt; &lt;li&gt;VMnet3 is one of the private networks used by VMware. There are multiple other types of VMnet networks available but I recommend VMnet3.&lt;\/li&gt; &lt;li&gt;If you aren\u2019t using VMware for your analysis platform, set both the Linux and JanusVM to NAT so that you could connect with a different virtual environment application. &lt;ul&gt; &lt;li&gt;If you are using VirtualBox, make sure the JanusVM isn\u2019t bridged to the VirtualBox interface.&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Set the JanusVM NAT connection to VMnet3 and restart to gain a new IP. &lt;ul&gt; &lt;li&gt;The same way you would modify the network interface settings for a normal VM.&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Set the Linux interface to a static IP address based upon the DHCP subnet used by VMware. &lt;p&gt;&lt;a href=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/MintNetConnectionStaticIP.png&quot;&gt;&lt;img class=&quot;size-medium wp-image-47&quot; src=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/MintNetConnectionStaticIP-300x157.png&quot; alt=&quot;Static IP Configuration&quot; width=&quot;300&quot; height=&quot;157&quot; \/&gt;&lt;\/a&gt;&lt;\/p&gt; &lt;ul&gt; &lt;li&gt;If JanusVM is currently set to VMnet3, then the local IP address will reveal the subnet being used by that private network, for example if the address was 192.168.194.132, then \u201c192.168.194\u201d would be the subnet being used.&lt;\/li&gt; &lt;li&gt;Click the network connections icon on the right side of the taskbar:&lt;\/li&gt; &lt;li&gt;Click on Edit Connections&lt;\/li&gt; &lt;li&gt;Select the primary connection and click Edit&lt;\/li&gt; &lt;li&gt;In the IPv4 Settings tab, change the type of connection from DHCP (Automatic) to manual&lt;\/li&gt; &lt;li&gt;Enter an IP address matching the subnet mentioned previously, make the last number 2 or 3, if not already taken.&lt;\/li&gt; &lt;li&gt;Enter the gateway as .1&lt;\/li&gt; &lt;li&gt;Save and close the network connections window, then restart the connection by clicking on the connection name in the network connections menu.&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Open a VPN connection between the Linux VM and JanusVM &lt;ul&gt; &lt;li&gt;This requires using the built-in VPN client for Mint Linux (or whatever flavor you are using)&lt;\/li&gt; &lt;li&gt;Click on the network connections icon on the taskbar.&lt;\/li&gt; &lt;li&gt;Select VPN Connections -&amp;gt; Configure VPN from the pop-up menu&lt;\/li&gt; &lt;li&gt;Click the Add button to create a new VPN connection&lt;\/li&gt; &lt;li&gt;You will need to manually configure it using the following settings: &lt;p&gt;&lt;a href=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/VPNConfigurationLinux.png&quot;&gt;&lt;img class=&quot;size-medium wp-image-48&quot; src=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/VPNConfigurationLinux-288x300.png&quot; alt=&quot;VPN Configuration Settings&quot; width=&quot;288&quot; height=&quot;300&quot; \/&gt;&lt;\/a&gt;&lt;\/p&gt; &lt;ul&gt; &lt;li&gt;Name: Doesn\u2019t really matter, JanusVPN works.&lt;\/li&gt; &lt;li&gt;Connection Type: PPTP&lt;\/li&gt; &lt;li&gt;Gateway: Whatever JanusVM is set to for its local PC address.&lt;\/li&gt; &lt;li&gt;Authentication: Only MSCHAPv2&lt;\/li&gt; &lt;li&gt;Select Use Point-to-Point encryption (MPPE)&lt;\/li&gt; &lt;li&gt;Allow BSD, Deflate and TCP Compression&lt;\/li&gt; &lt;li&gt;Enter your username and password for JanusVM (See the previous section)&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Once completed, save and close the VPN and network configuration windows.&lt;\/li&gt; &lt;li&gt;Select the network connections icon again and go to the VPN connections sub-menu. You should see your new VPN connection available to select. If not, try to reset your eth0 connection and see if that does the trick.&lt;\/li&gt; &lt;li&gt;Select the Janus VPN connection&lt;\/li&gt; &lt;li&gt;You should eventually see a notice in the upper right part of the screen (Mint Linux) that says \u201cConnection Successful\u201d &lt;p&gt;&lt;a href=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/VPNWorksMsg.png&quot;&gt;&lt;img class=&quot;size-full wp-image-49&quot; src=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/VPNWorksMsg.png&quot; alt=&quot;VPN Connection Successful&quot; width=&quot;335&quot; height=&quot;101&quot; \/&gt;&lt;\/a&gt;&lt;\/li&gt; &lt;li&gt;Type the command ifconfig into a console window to ensure that ppp0 exists; this is your VPN interface. &lt;p&gt;&lt;a href=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/ppp0FoundIFCONFIG.jpg&quot;&gt;&lt;img class=&quot;size-medium wp-image-50&quot; src=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/ppp0FoundIFCONFIG-300x238.jpg&quot; alt=&quot;ifconfig results&quot; width=&quot;300&quot; height=&quot;238&quot; \/&gt;&lt;\/a&gt;&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Turn your Linux system into a router by typing in the following command: &lt;ul&gt; &lt;li&gt;echo 1 &amp;gt; \/proc\/sys\/net\/ipv4\/ip_forward&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Configure DNSMasq to run a DNS &amp;amp; DHCP server from eth0 by opening \/etc\/dnsmasq.conf as ROOT in a text editor &lt;ul&gt; &lt;li&gt;Line 14: Uncomment \u201cdomain-needed\u201d&lt;\/li&gt; &lt;li&gt;Line 16: Uncomment \u201cbogus-priv\u201d&lt;\/li&gt; &lt;li&gt;Line 85: Uncomment \u201cInterface=\u201d and type in eth0 as the interface&lt;\/li&gt; &lt;li&gt;Line 136: Uncomment \u201cdhcp-range=\u2026\u201d modify the range to match the range that VMNet3 is using. &lt;ul&gt; &lt;li&gt;For example if the VMware DHCP service issues an IP address of 192.168.194.130, then you modify the dnsmasq DHCP range to 192.168.194.50-192.168.194.200 . This is so we can still gain an IP address from VMware for JanusVM but take over DHCP service using dnsmasq so our third system can connect to it.&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Restart DNSMasq &lt;ul&gt; &lt;li&gt;Type \u201c\/etc\/init.d\/dnsmasq restart\u201d as root in the console window to restart DNSMasq with the new settings&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;You can test our new DHCP server by releasing and renewing your IP address on your Windows analysis system, if the gateway matches the IP you assigned for eth0, it works! &lt;p&gt;&lt;a href=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/GateWayWorks.jpg&quot;&gt;&lt;img class=&quot;size-medium wp-image-51&quot; src=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/GateWayWorks-300x149.jpg&quot; alt=&quot;Gateway Info On Windows System&quot; width=&quot;300&quot; height=&quot;149&quot; \/&gt;&lt;\/a&gt;&lt;\/li&gt; &lt;li&gt;Using IPTables, forward all traffic coming into eth0 to ppp0 and vice verse &lt;ul&gt; &lt;li&gt;Type the following command into the console as root &lt;ul&gt; &lt;li&gt;iptables \u2013t nat \u2013A POSTROUTING \u2013o ppp0 \u2013j MASQUERADE&lt;\/li&gt; &lt;li&gt;After which you should see the following after typing: &lt;ul&gt; &lt;li&gt;iptables \u2013t nat \u2013-list-rules &lt;p&gt;&lt;a href=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/iptableslsit.png&quot;&gt;&lt;img class=&quot;size-full wp-image-52&quot; src=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/iptableslsit.png&quot; alt=&quot;iptables results&quot; width=&quot;326&quot; height=&quot;196&quot; \/&gt;&lt;\/a&gt;&lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;\/ul&gt; &lt;\/li&gt; &lt;li&gt;Take a snapshot of the Linux VM &amp;amp; the JanusVM&lt;\/li&gt; &lt;li&gt;Set the Windows VM to use DHCP (if you haven&#8217;t done that yet) and restart the system.&lt;\/li&gt; &lt;li&gt;Test the connection by opening a browser and do a Google search for \u201cWhat\u2019s my IP?\u201d to make sure you are hidden. &lt;p&gt;&lt;a href=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/WinTotalAnonScreen.jpg&quot;&gt;&lt;img class=&quot;size-medium wp-image-53&quot; src=&quot;http:\/\/blog.malwarebytes.org\/wp-content\/uploads\/2012\/04\/WinTotalAnonScreen-300x262.jpg&quot; alt=&quot;No Proxy Detected&quot; width=&quot;300&quot; height=&quot;262&quot; \/&gt;&lt;\/a&gt;&lt;\/li&gt; &lt;li&gt;If it is not connected, check the IP address \/ DHCP settings for windows, then check to ensure the VPN is connected to Linux correctly and all the interfaces are working correctly. If all else fails, restart everything one at a time.&lt;\/li&gt; &lt;\/ol&gt; &lt;p&gt;Explanations:&lt;\/p&gt; &lt;p&gt;Q. What is a DHCP\/DNS Server and what is DNSMASQ? A. DHCP stands for Dynamic Host Configuration Protocol, which basically hands out IP addresses dynamically to systems which join the network which the DHCP server is on. VMware has a built-in DHCP service available for any of its private networks (VMnet#\u2019s). DNS is short for Domain Name System, and is a service which translates requests for hostnames, i.e. &#8220;http:\/\/www.mydomain.com&#8221;, into IP addresses and passes it back to the requester. DNSMASQ, is both a DCHP and a DNS service application which can be started and attached to a certain interface on a Linux system. When a new system comes onto the VMnet3 private network and it is configured to accept DHCP addresses, it will beacon out to the DHCP server asking to join. DNSMASQ responds to the request and issues the new system an IP address. Now the new system, in our case the Windows Analysis VM, is using the DHCP server as its gateway to the outside world, so when we make a request to Google.com through our browser in our analysis system, that requests goes to DNSMASQ where it routes it accordingly to find the answer and returns it to the Windows VM. DNSMASQ is so important for our use because it makes it possible for us to easily join and be configured into our anonymous network and it also handles our requests when communicating with JanusVM and the anonymous network. Check out these sites for more information on DHCP\/DNS &amp;amp; DNSMASQ:&lt;\/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href=&quot;http:\/\/en.wikipedia.org\/wiki\/Dynamic_Host_Configuration_Protocol&quot; target=&quot;_blank&quot;&gt;http:\/\/en.wikipedia.org\/wiki\/Dynamic_Host_Configuration_Protocol&lt;\/a&gt;&lt;\/li&gt; &lt;li&gt;&lt;a href=&quot;http:\/\/en.wikipedia.org\/wiki\/Domain_Name_System&quot; target=&quot;_blank&quot;&gt;http:\/\/en.wikipedia.org\/wiki\/Domain_Name_System&lt;\/a&gt;&lt;\/li&gt; &lt;li&gt;&lt;a href=&quot;http:\/\/www.thekelleys.org.uk\/dnsmasq\/doc.html&quot; target=&quot;_blank&quot;&gt;http:\/\/www.thekelleys.org.uk\/dnsmasq\/doc.html&lt;\/a&gt;&lt;\/li&gt; &lt;\/ul&gt; &lt;p&gt;Q. What are IPTables? A. IPTables are chains and rules which configure how the Linux Kernel Firewall operates. The main use of them is to block or allow traffic from specific IP address or ports, however the way we are using them is just simply to forward traffic from one interface to the other. Check out the Wikipedia page on IPTables for a more detailed look:&lt;\/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href=&quot;http:\/\/en.wikipedia.org\/wiki\/Iptables&quot; target=&quot;_blank&quot;&gt;http:\/\/en.wikipedia.org\/wiki\/Iptables&lt;\/a&gt;&lt;\/li&gt; &lt;\/ul&gt; &lt;p&gt;&lt;strong&gt;Summary:&lt;\/strong&gt;&lt;\/p&gt; &lt;p&gt;This last tutorial section is really only meant for hardcore malware analysts who have some technical background when it comes to networking and messing with Linux. However it can be employed by anyone who takes the time to learn a little bit more than they already know. This method ensures complete anonymity and the ability to capture traffic if Wireshark is launched on the Linux system, monitoring eth0, for a forced system restart or on the Windows analysis system otherwise.&lt;\/p&gt; &lt;h3&gt;In Conclusion&lt;\/h3&gt; &lt;p&gt;So this is the end of the tutorial, thank you for reading and I hope you enjoyed it and\/or got some useful info out of it. Please let me know in the comments section if something wasn\u2019t explained well enough or if you would like me to add anything. Also let me know if I had made any mistakes or there is an easier way of making this all work, I am no expert at Linux or dealing with things like IPTables and VPNs , so please give me feedback and I would be happy to modify the tutorials.&lt;\/p&gt; &lt;p&gt;Here are some other anonymous surfing solutions you might be interested in:&lt;\/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href=&quot;http:\/\/www.hidemyass.com\/&quot; target=&quot;_blank&quot;&gt;http:\/\/www.hidemyass.com&lt;\/a&gt; &#8211; Web Interface anonymous surfing good for real quick stuff when you don\u2019t have your Tor Browser handy.&lt;\/li&gt; &lt;li&gt;&lt;a href=&quot;http:\/\/www.happy-vpn.com\/&quot; target=&quot;_blank&quot;&gt;http:\/\/www.happy-vpn.com&lt;\/a&gt; \u2013 A paid service which allows you to create a VPN connection to their secure network to hide all your traffic.&lt;\/li&gt; &lt;\/ul&gt; \" data-medium-file=\"\" data-large-file=\"\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/cab_manifest.png\" alt=\"\" class=\"wp-image-44\"\/><\/figure>\n<h4>Loader<\/h4>\n<p>As it turned out, both files are loaded by hp6000.dll: <a rel=\"noreferrer noopener\" aria-label=\"67b8d21e79018f1ab1b31e1aba16d201 (opens in a new tab)\" href=\"https:\/\/www.virustotal.com\/#\/file\/806d6f36e39de3c1775e0856227aab65f5772d6111101189651b67dd9e6d81f4\/detection\" target=\"_blank\">67b8d21e79018f1ab1b31e1aba16d201<\/a><\/p>\n<p>The loading function is executed in an obfuscated way: when the DllMain is executed, it patches the&nbsp; main executable that loaded the DLL. <\/p>\n<p>First, the file name of the current module is retrieved. Then, the file is read and the address of the entry point is fetched. Then, the copy of the module that is loaded in the memory is set as an executable:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38252\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/set_rwx\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/set_rwx.png\" data-orig-size=\"403,246\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"set_rwx\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/set_rwx-300x183.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/set_rwx.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/set_rwx.png\" alt=\"\" class=\"wp-image-38252\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/set_rwx.png 403w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/set_rwx-300x183.png 300w\" sizes=\"(max-width: 403px) 100vw, 403px\" \/><figcaption>Using VirtualProtect to make the main module writable<\/figcaption><\/figure>\n<p>Finally, the bytes are patched so that the entry point will redirect back to the appropriate function in the loading DLL:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38253\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/patching_caller\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patching_caller.png\" data-orig-size=\"489,160\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"patching_caller\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patching_caller-300x98.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patching_caller.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patching_caller.png\" alt=\"\" class=\"wp-image-38253\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patching_caller.png 489w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patching_caller-300x98.png 300w\" sizes=\"(max-width: 489px) 100vw, 489px\" \/><figcaption>Patching the entry point of the main module, byte by byte<\/figcaption><\/figure>\n<p>This is how the entry point of the main module looks after the patch is applied:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38254\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/patched_ep-5\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patched_ep.png\" data-orig-size=\"622,119\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"patched_ep\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patched_ep-300x57.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patched_ep-600x115.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patched_ep.png\" alt=\"\" class=\"wp-image-38254\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patched_ep.png 622w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patched_ep-300x57.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/patched_ep-600x115.png 600w\" sizes=\"(max-width: 622px) 100vw, 622px\" \/><figcaption>The Entry Point of the main module (sporder.exe) after patching<\/figcaption><\/figure>\n<p>We see that the Virtual Address (RVA 0x1210 + DLL loading base) of the function within the DLL is moved to EAX, and then the EAX is used as a jump target.<\/p>\n<p>The function that starts at RVA 0x1210 is a loader for BLOB and CAB:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38265\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/loader_func_bgn\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loader_func_bgn.png\" data-orig-size=\"415,185\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"loader_func_bgn\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loader_func_bgn-300x134.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loader_func_bgn.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loader_func_bgn.png\" alt=\"\" class=\"wp-image-38265\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loader_func_bgn.png 415w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loader_func_bgn-300x134.png 300w\" sizes=\"(max-width: 415px) 100vw, 415px\" \/><figcaption>Beginning of the loading function<\/figcaption><\/figure>\n<p>This redirection works, thanks to the fact that when the executable is loaded into the memory, before the Entry Point of the main module is hit, all the DLLs that are in its Import Table are loaded, and the DllMain of each is called. Just after the DLLs are loaded, the execution of the main executable starts. And in our case, the patched entry point redirects back to the DLL.<\/p>\n<p>Inside the function loading BLOB and CAB:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38263\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/load_blob_and_cab-5\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/load_blob_and_cab-4.png\" data-orig-size=\"602,599\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"load_blob_and_cab\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/load_blob_and_cab-4-300x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/load_blob_and_cab-4-600x597.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/load_blob_and_cab-4.png\" alt=\"\" class=\"wp-image-38263\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/load_blob_and_cab-4.png 602w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/load_blob_and_cab-4-150x150.png 150w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/load_blob_and_cab-4-300x300.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/load_blob_and_cab-4-600x597.png 600w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><figcaption>The function loading BLOB and CAB<\/figcaption><\/figure>\n<p>As you can see, the CAB file is loaded first:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38283\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/to_load_cab\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/to_load_cab.png\" data-orig-size=\"364,136\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"to_load_cab\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/to_load_cab-300x112.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/to_load_cab.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/to_load_cab.png\" alt=\"\" class=\"wp-image-38283\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/to_load_cab.png 364w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/to_load_cab-300x112.png 300w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><figcaption>Executing the function loading CAB file (unconditional)<\/figcaption><\/figure>\n<p>Further, we see this function retrieving some environmental variable. This variable is used to store the state of the application, and is shared between consecutive executions. Depending on this state, one of multiple execution paths can be taken.<\/p>\n<p>The name of the variable is created by concatenating:<\/p>\n<ol>\n<li>hardcoded string: L&#8221;Local\\{076B1DB0-2C01-45A5-BD0A-0CF5D6410DCB}&#8221;<\/li>\n<li>the name of the executable<\/li>\n<li>a local username<\/li>\n<\/ol>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/env_var_name-1.png\" data-rel=\"lightbox-0\" title=\"\"><img decoding=\"async\" data-attachment-id=\"38295\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/env_var_name-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/env_var_name-1.png\" data-orig-size=\"987,293\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"env_var_name\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/env_var_name-1-300x89.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/env_var_name-1-600x178.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/env_var_name-1.png\" alt=\"\" class=\"wp-image-38295\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/env_var_name-1.png 987w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/env_var_name-1-300x89.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/env_var_name-1-600x178.png 600w\" sizes=\"(max-width: 987px) 100vw, 987px\" \/><\/a><figcaption>Setting the variable name<\/figcaption><\/figure>\n<p>The content variable may be one of the following: &#8216;@&#8217;, &#8216;*&#8217;,&#8217;:&#8217;. If it is empty, the first value &#8216;@&#8217; is set. Those variables are translated to particular states that control the flow.<\/p>\n<ul>\n<li>&#8216;@&#8217; -&gt; state 1<\/li>\n<li>&#8216;*&#8217; -&gt; state 2<\/li>\n<li>&#8216;:&#8217; -&gt; state 3<\/li>\n<\/ul>\n<p>The main process is restarted on each state change. Finally, the state 3  create mutex and load the file with the BLOB extension.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38293\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/state3-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/state3-2.png\" data-orig-size=\"542,270\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"state3-2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/state3-2-300x149.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/state3-2.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/state3-2.png\" alt=\"\" class=\"wp-image-38293\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/state3-2.png 542w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/state3-2-300x149.png 300w\" sizes=\"(max-width: 542px) 100vw, 542px\" \/><figcaption>Final state: setting the mutex and loading the BLOB<\/figcaption><\/figure>\n<p>The mutex name is the same as the variable name, but with a suffix &#8220;_M&#8221; added:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/added_m.png\" data-rel=\"lightbox-1\" title=\"\"><img decoding=\"async\" data-attachment-id=\"38296\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/added_m\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/added_m.png\" data-orig-size=\"850,156\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"added_m\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/added_m-300x55.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/added_m-600x110.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/added_m.png\" alt=\"\" class=\"wp-image-38296\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/added_m.png 850w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/added_m-300x55.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/added_m-600x110.png 600w\" sizes=\"(max-width: 850px) 100vw, 850px\" \/><\/a><figcaption>Setting the mutex<\/figcaption><\/figure>\n<p>While the application runs, we can see the BLOB being loaded in executable form inside the main module&#8217;s memory:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loaded_blob.png\" data-rel=\"lightbox-2\" title=\"\"><img decoding=\"async\" data-attachment-id=\"38256\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/loaded_blob\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loaded_blob.png\" data-orig-size=\"949,336\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"loaded_blob\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loaded_blob-300x106.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loaded_blob-600x212.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loaded_blob.png\" alt=\"\" class=\"wp-image-38256\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loaded_blob.png 949w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loaded_blob-300x106.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loaded_blob-600x212.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/loaded_blob-470x165.png 470w\" sizes=\"(max-width: 949px) 100vw, 949px\" \/><\/a><figcaption>Memory of the sporder.exe, view from Process Hacker<\/figcaption><\/figure>\n<p>By comparing the format that is loaded in the memory with the format that is stored on the disk, we can see that the beginning and the end of the BLOB is skipped in the loading process. So, we can guess that those parts are some headers that contains the information necessary for loading, but not for execution. The header at the beginning of the file will be referenced as Header1, and the one at the end (footer) will be referenced as Header2.<\/p>\n<p>The Header2 file in the memory vs. its equivalent on the disk:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38297\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/mem_after\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/mem_after.png\" data-orig-size=\"626,150\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mem_after\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/mem_after-300x72.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/mem_after-600x144.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/mem_after.png\" alt=\"\" class=\"wp-image-38297\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/mem_after.png 626w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/mem_after-300x72.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/mem_after-600x144.png 600w\" sizes=\"(max-width: 626px) 100vw, 626px\" \/><figcaption>Comparing the memory dump with the raw file<\/figcaption><\/figure>\n<p>We also found that some of the addresses were relocated (the new Image Base was added).<\/p>\n<h3>Reversing the reversed PE<\/h3>\n<p>The files with both extensions CAB and BLOB are loaded by the same function:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/read_and_load_custom.png\" data-rel=\"lightbox-3\" title=\"\"><img decoding=\"async\" data-attachment-id=\"38257\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/read_and_load_custom\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/read_and_load_custom.png\" data-orig-size=\"721,224\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"read_and_load_custom\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/read_and_load_custom-300x93.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/read_and_load_custom-600x186.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/read_and_load_custom.png\" alt=\"\" class=\"wp-image-38257\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/read_and_load_custom.png 721w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/read_and_load_custom-300x93.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/read_and_load_custom-600x186.png 600w\" sizes=\"(max-width: 721px) 100vw, 721px\" \/><\/a><figcaption>View from IFL (Interactive Functions List)<\/figcaption><\/figure>\n<p>The core of the loader is in the following function:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"109\" data-permalink=\"https:\/\/blog.malwarebytes.com\/cybercrime\/2012\/06\/sky-is-falling-at-risk-from-flame-malware\/\" data-orig-file=\"\" data-orig-size=\"\" data-comments-opened=\"1\" data-image-meta=\"[]\" data-image-title=\"&#8220;The Sky is Falling&#8230; Are You at Risk from the Flame Malware?&#8221;\" data-image-description=\"&lt;p&gt;The last time I checked with Google News this morning there were over 19,100,000 results for &#8220;flame malware&#8221;.\u00a0 You may have heard many stories this week about this complex trojan. Here are links to three of my current personal favorite articles on &#8220;Flame&#8221;.&lt;\/p&gt; &lt;ol&gt; &lt;li&gt;&lt;a title=&quot;Powerful &#039;Flame&#039; cyberweapon tied to popular Angry Birds game&quot; href=&quot;http:\/\/www.foxnews.com\/scitech\/2012\/05\/30\/powerful-flame-cyberweapon-tied-to-powerfully-angry-birds\/&quot; target=&quot;_blank&quot;&gt;Powerful \u2018Flame\u2019 cyberweapon tied to popular Angry Birds game&lt;\/a&gt; &#8211; (Fox News)&lt;\/li&gt; &lt;li&gt;&lt;a title=&quot;Behind the &#039;Flame&#039; malware spying on Mideast computers (FAQ)&quot; href=&quot;http:\/\/news.cnet.com\/8301-1009_3-57443975-83\/behind-the-flame-malware-spying-on-mideast-computers-faq\/&quot; target=&quot;_blank&quot;&gt;Behind the &#8216;Flame&#8217; malware spying on Mideast computers (FAQ)&lt;\/a&gt; &#8211; (CNET)&lt;\/li&gt; &lt;li&gt;&lt;a title=&quot;Flame Malware&#039;s Ties to Stuxnet, Duqu: Details Emerge&quot; href=&quot;http:\/\/www.informationweek.com\/news\/security\/attacks\/240001271&quot; target=&quot;_blank&quot;&gt;Flame Malware&#8217;s Ties To Stuxnet, Duqu: Details Emerge&lt;\/a&gt; &#8211; (InformationWeek)&lt;\/li&gt; &lt;\/ol&gt; &lt;p&gt;Is the Flame malware otherwise known as Flamer or sKyWiper likely to affect you personally?\u00a0 For the vast majority of people on the Internet the answer is \u201cno\u201d. For nuclear researchers in the Middle East and leaders of countries such as Iran, Israel and Sudan, then the answer is qualified &#8220;yes&#8221;.&lt;\/p&gt; &lt;p&gt;Malware such as the recent \u201cFlame\u201d shows how cyberespionage and digital attacks have evolved. In years past, the malware developers would create code that would spread far and wide and infect any and all computers in it\u2019s path.&lt;\/p&gt; &lt;p&gt;&lt;!--more--&gt;&lt;\/p&gt; &lt;p&gt;Today, the Flame malware code is both highly targeted, and carefully crafted to remain undetected. The summary of this threat is that the Flame malware was focused on gathering, collecting and sending data, stealing information and intelligence on computer systems centered in the Middle East.&lt;\/p&gt; &lt;p&gt;Our own Malware Intelligence Lead, Adam Kujawa spent considerable time looking into how the Flame malware differs from the recent Stuxnet and Duqu threats and includes a summary of public threats to be concerned about, namely Remote Administration Tools\/Trojans (RATs) including a throwback mention of Poison Ivy for good measure. I would encourage you to check out his detailed and informative post here:\u00a0 &lt;a href=&quot;..\/intelligence\/2012\/06\/rats-of-unusual-sizes\/&quot;&gt;http:\/\/blog.malwarebytes.org\/intelligence\/2012\/06\/rats-of-unusual-sizes\/&lt;\/a&gt;.&lt;\/p&gt; \" data-medium-file=\"\" data-large-file=\"\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/load_custom-1.png\" alt=\"load_custom\" class=\"wp-image-109\"\/><\/figure>\n<p>This is the function that we need to analyze in order to make sense out of the custom format.<\/p>\n<p>Let&#8217;s take a look at the loading process itself.<\/p>\n<p>First, DWORD of the Header1 is skipped. Then, we have two DWORDs that are used as an XOR key. Once they are fetched, the rest of the header is decoded. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"117\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2012\/06\/you-dirty-rat-part-1-darkcomet\/attachment\/chatwindow\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/ChatWindow.jpg\" data-orig-size=\"454,379\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"ChatWindow\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/ChatWindow-300x250.jpg\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/ChatWindow.jpg\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/decoring_cab.png\" alt=\"decoring_cab\" class=\"wp-image-117\"\/><\/figure>\n<p>After applying the key, we get the content of the file in its clear form. The next value from the headers is used in the formula calculating the size for loading the executable part of the module. In the currently analyzed case (the CAB file), it is 0x17000:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38275\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/hdr1_decoded\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/hdr1_decoded.png\" data-orig-size=\"614,122\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"hdr1_decoded\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/hdr1_decoded-300x60.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/hdr1_decoded-600x119.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/hdr1_decoded.png\" alt=\"\" class=\"wp-image-38275\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/hdr1_decoded.png 614w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/hdr1_decoded-300x60.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/hdr1_decoded-600x119.png 600w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><figcaption>Header 1 at the beginning of the CAB file, decoded<\/figcaption><\/figure>\n<p>So, 0x17000 + 0x2000 is the size of the memory that will be allocated for the payload.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"182\" data-permalink=\"https:\/\/blog.malwarebytes.com\/101\/2012\/06\/phishing-101-part-1\/attachment\/phishing101banner\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/Phishing101Banner.jpg\" data-orig-size=\"838,491\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"Phishing101Banner\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/Phishing101Banner-300x175.jpg\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/Phishing101Banner.jpg\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2019\/03\/alloc_module_size.png\" alt=\"alloc_module_size\" class=\"wp-image-182\"\/><\/figure>\n<p>Example (from CAB file):<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"119\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2012\/06\/you-dirty-rat-part-1-darkcomet\/attachment\/ddos2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/DDOS2.jpg\" data-orig-size=\"231,141\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"DDOS2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/DDOS2.jpg\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/DDOS2.jpg\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/alloc_executable.png\" alt=\"alloc_executable\" class=\"wp-image-119\"\/><\/figure>\n<p>Then, 0x17000 bytes of the payload is copied, but the beginning containing the Header1 is skipped (the first 16 bytes).<\/p>\n<p>After the module content is copied, Header2 is used to continue loading. <\/p>\n<p>Looking at Header2, we can see some similarities with Header1. Again, the initial DWORD is skipped, and then we have a value that is used in a formula calculating the size of the memory to be allocated. The new memory region that is being allocated this time is used for the imports that are going to be loaded (the full process will be explained further).<\/p>\n<p>Conceptually, we can divide Header 2 into two parts.<\/p>\n<p>First comes a prolog that contains two DWORD values. Example from the currently-analyzed CAB file:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38276\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/header2_prolog\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_prolog.png\" data-orig-size=\"615,115\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"header2_prolog\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_prolog-300x56.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_prolog-600x112.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_prolog.png\" alt=\"\" class=\"wp-image-38276\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_prolog.png 615w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_prolog-300x56.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_prolog-600x112.png 600w\" sizes=\"(max-width: 615px) 100vw, 615px\" \/><figcaption>Header2 (at the end of the CAB file) &#8211; prolog is hilighted<\/figcaption><\/figure>\n<ul>\n<li>val[0] = 0x21A0 -&gt; skipped<\/li>\n<li>val[1] = 0x013D -&gt; val[1]*8+0x400 -&gt; size of the next area to allocate<\/li>\n<\/ul>\n<p>Then there is a list of records of a custom type. Each record represents a different piece of information that is necessary for loading the module. They are identified by the type ID that is represented by a DWORD at the beginning of the record. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38277\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/header2_records\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_records.png\" data-orig-size=\"619,132\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"header2_records\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_records-300x64.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_records-600x128.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_records-600x128.png\" alt=\"\" class=\"wp-image-38277\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_records-600x128.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_records-300x64.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/header2_records.png 619w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><figcaption>Header2 (at the end of the CAB file) &#8211; records are hilighted<\/figcaption><\/figure>\n<h4>Relocations<\/h4>\n<p>Type 1 stands for relocation. It has one DWORD as an argument. It is an address that needs to be relocated.<\/p>\n<pre class=\"wp-block-preformatted\">typedef struct { \tDWORD reloc_field; } reloc_t; <\/pre>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type1_reloc.png\" data-rel=\"lightbox-4\" title=\"\"><img decoding=\"async\" data-attachment-id=\"38298\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/type1_reloc\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type1_reloc.png\" data-orig-size=\"752,520\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"type1_reloc\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type1_reloc-300x207.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type1_reloc-600x415.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type1_reloc.png\" alt=\"\" class=\"wp-image-38298\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type1_reloc.png 752w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type1_reloc-300x207.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type1_reloc-600x415.png 600w\" sizes=\"(max-width: 752px) 100vw, 752px\" \/><\/a><figcaption>Parsing of the type 1<\/figcaption><\/figure>\n<p>We can see how the field is used to relocate the address. Example: filling the address at 0x8590:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38299\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/relocating_module\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/relocating_module.png\" data-orig-size=\"414,224\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"relocating_module\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/relocating_module-300x162.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/relocating_module.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/relocating_module.png\" alt=\"\" class=\"wp-image-38299\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/relocating_module.png 414w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/relocating_module-300x162.png 300w\" sizes=\"(max-width: 414px) 100vw, 414px\" \/><figcaption>The address pointed by the relocation record is relocated to the base at which the module was loaded<\/figcaption><\/figure>\n<h3>Entry point<\/h3>\n<p>Type 2 stands for entry point or an exported function. The pointed address is stored on the list in order to be called later, after the loading finished. This record has three DWORD parameters.<\/p>\n<pre class=\"wp-block-preformatted\">typedef struct {<br \/>    DWORD count;<br \/>    DWORD entry_rva;<br \/>    DWORD name_rva;<br \/>} entry_point_t; <\/pre>\n<p>Example of the record of type 2:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38300\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/type2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type2.png\" data-orig-size=\"543,568\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"type2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type2-287x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type2.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type2.png\" alt=\"\" class=\"wp-image-38300\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type2.png 543w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type2-287x300.png 287w\" sizes=\"(max-width: 543px) 100vw, 543px\" \/><figcaption>Parsing of the type 2<\/figcaption><\/figure>\n<p>Address to be stored: params[1] = 0x00001030<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38301\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/record_type2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/record_type2.png\" data-orig-size=\"625,116\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"record_type2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/record_type2-300x56.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/record_type2-600x111.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/record_type2.png\" alt=\"\" class=\"wp-image-38301\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/record_type2.png 625w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/record_type2-300x56.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/record_type2-600x111.png 600w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><figcaption>Record of the type 2 in the original file<\/figcaption><\/figure>\n<p>By observing the execution flow, we can confirm that indeed the stored entry point of the module is being called later:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38302\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/call_cab_module\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/call_cab_module.png\" data-orig-size=\"588,89\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"call_cab_module\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/call_cab_module-300x45.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/call_cab_module.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/call_cab_module.png\" alt=\"\" class=\"wp-image-38302\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/call_cab_module.png 588w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/call_cab_module-300x45.png 300w\" sizes=\"(max-width: 588px) 100vw, 588px\" \/><figcaption>The address in the loader where the CAB module is called after being loaded<\/figcaption><\/figure>\n<p>Exported functions are stored in the same way, along with their names.<\/p>\n<h3>Imports<\/h3>\n<p>Type 3 stands for imports. It has four DWORD parameters.<\/p>\n<pre class=\"wp-block-preformatted\">typedef struct {<br \/>    DWORD type;<br \/>    DWORD dll_rva;<br \/>    DWORD func_rva;<br \/>    DWORD iat_rva;<br \/>} import_t;<\/pre>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38303\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/type3_imports\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type3_imports.png\" data-orig-size=\"488,588\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"type3_imports\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type3_imports-249x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type3_imports.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type3_imports.png\" alt=\"\" class=\"wp-image-38303\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type3_imports.png 488w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/type3_imports-249x300.png 249w\" sizes=\"(max-width: 488px) 100vw, 488px\" \/><figcaption>Parsing of the type 3<\/figcaption><\/figure>\n<p>Example of a chunk responsible for encoding imports:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38304\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/imports_chunk\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imports_chunk.png\" data-orig-size=\"611,81\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"imports_chunk\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imports_chunk-300x40.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imports_chunk-600x80.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imports_chunk.png\" alt=\"\" class=\"wp-image-38304\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imports_chunk.png 611w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imports_chunk-300x40.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imports_chunk-600x80.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/imports_chunk-604x81.png 604w\" sizes=\"(max-width: 611px) 100vw, 611px\" \/><figcaption>Record of the type 3 in the original file<\/figcaption><\/figure>\n<p>Type: params[0] = 0x00000002 &#8211; means the function will be imported by name, meaning of all the possible types of this record.<\/p>\n<p>Address of the DLL: params[1] = 0x0107DA<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/dll_addr.png\" alt=\"dll_addr\" class=\"wp-image-136\"\/><\/figure>\n<p>Address of the import: params[2] = 0x010774<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/import_addr.png\" alt=\"import_addr\" class=\"wp-image-137\"\/><\/figure>\n<p>In contrast to PE format, the address of the imported function is not loaded into the main module. Instead, it is written into the separate executable area (in the given example it is written at VA: 0x00240001):<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/filled_import.png\" alt=\"filled_import\" class=\"wp-image-141\"\/><\/figure>\n<p>And then, the address where the import was filled is filled back in the main module. The address in the main module that needs to be filled is specified by the last parameter of this record. In the given example, chunk[3] = 0x0000E014  is being filled by 0x00240001:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/saved1.png\" alt=\"saved1\" class=\"wp-image-139\"\/><\/figure>\n<h4 id=\"mce_91\">Atypical IAT<\/h4>\n<p>The functions from the embedded list are for a loader, however, as mentioned earlier, the addresses are not filled in a normal IAT, typical for PE format. Rather, all are filled as a list of jumps stored in a newly-allocated memory page.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/custom_iat.png\" alt=\"custom_iat\" class=\"wp-image-105\"\/><\/figure>\n<p>The import loading function not only fills the address, but also emits the necessary code for the jump:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38258\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/attachment\/import_load_fragment\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/import_load_fragment.png\" data-orig-size=\"749,308\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"import_load_fragment\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/import_load_fragment-300x123.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/import_load_fragment-600x247.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/import_load_fragment.png\" alt=\"\" class=\"wp-image-38258\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/import_load_fragment.png 749w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/import_load_fragment-300x123.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/import_load_fragment-600x247.png 600w\" sizes=\"(max-width: 749px) 100vw, 749px\" \/><figcaption>Address of the imported function is retrieved and written into the emitted jump<\/figcaption><\/figure>\n<h5>Meaning of the type field<\/h5>\n<p>The import record has a field type, that can have one of the following values: 1,2,3,4.<\/p>\n<p>The 1 and 2 are the most important: They are used for loading the imports. 1 stands for loading by ordinals, 2 for loading by name. The remaining 3 and 4 are used for cleanup of the fields that are no longer needed. 3 erases import name, 4 erases DLL name.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2019\/03\/func_type_meanings.png\" alt=\"func_type_meanings\" class=\"wp-image-261\"\/><\/figure>\n<p>When the record of the type 3 or 4 occurs, the pointer in the IAT area is still incremented, so as a result we can see some gaps between the functions records:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"192\" data-permalink=\"https:\/\/blog.malwarebytes.com\/101\/2012\/07\/phishing-101-part-2\/attachment\/stonecraftlogin\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/07\/StoneCraftLogin.jpg\" data-orig-size=\"500,217\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"StoneCraftLogin\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/07\/StoneCraftLogin-300x130.jpg\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/07\/StoneCraftLogin.jpg\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2019\/03\/gaps.png\" alt=\"gaps\" class=\"wp-image-192\"\/><\/figure>\n<h3>Functionality of the custom files<\/h3>\n<p>The CAB file is another installer that provides persistence to the whole package by creating a service:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"149\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2012\/06\/you-dirty-rat-part-2-blackshades-net\/attachment\/market2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/Market2.jpg\" data-orig-size=\"907,436\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"Market2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/Market2-300x144.jpg\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/Market2.jpg\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/created_service.png\" alt=\"created_service\" class=\"wp-image-149\"\/><\/figure>\n<p>&#8220;C:Windowssystem32wscript.exe&#8221; \/B \/nologo &#8220;C:UserstesterDesktopmodsporder.vbs&#8221;<\/p>\n<p>I also generate the VBS script that is dropped:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"150\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2012\/06\/you-dirty-rat-part-2-blackshades-net\/attachment\/market3\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/Market3.jpg\" data-orig-size=\"946,394\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"Market3\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/Market3-300x124.jpg\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2012\/06\/Market3.jpg\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2018\/12\/installed_script.png\" alt=\"installed_script\" class=\"wp-image-150\"\/><\/figure>\n<p>The CAB file is loaded first, just to install the malware, and then deleted.<\/p>\n<p>All the espionage-related features are performed by the BLOB that is loaded later and kept persistent in the memory of the loader.<\/p>\n<p>In addition to being in a custom format, BLOB is also heavily obfuscated.<\/p>\n<p>We can observe its attempts to connect to one of the CnCs:<\/p>\n<pre class=\"wp-block-preformatted\">png.eirahrlichmann.com : 443 engine.lanaurmi.com :3389 movies.onaldest.com : 44818 images.andychroeder.com : 80 png.eirahrlichmann.com : 44818 engine.lanaurmi.com : 44818 movies.onaldest.com : 9091 images.andychroeder.com : 9091 png.eirahrlichmann.com : 3389 <\/pre>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/malwarenotepadhome.files.wordpress.com\/2019\/03\/cnc_connection.png\" alt=\"cnc_connection\" class=\"wp-image-199\"\/><\/figure>\n<p>Some of those domains are known from previous reports on Ocean Lotus, i.e. [<a rel=\"noreferrer noopener\" href=\"https:\/\/www.cylance.com\/content\/dam\/cylance-web\/en-us\/resources\/knowledge-center\/resource-library\/reports\/SpyRATsofOceanLotusMalwareWhitePaper.pdf\" target=\"_blank\">the Cyclance white paper<\/a>].<\/p>\n<h3>Ocean Lotus: a creative APT<\/h3>\n<p>Ocean Lotus often surprises researchers with its creative obfuscation techniques. Recently, a different sample of Ocean Lotus was found using steganography to hide their executables (you can read more about it in <a rel=\"noreferrer noopener\" aria-label=\"the report of ThreatVector (opens in a new tab)\" href=\"https:\/\/threatvector.cylance.com\/en_us\/home\/report-oceanlotus-apt-group-leveraging-steganography.html\" target=\"_blank\">the report of ThreatVector<\/a>). The format that we described is just one of many unusual forms that their implants can take.<\/p>\n<h3>Appendix<\/h3>\n<p>Parser for the described format: <a href=\"https:\/\/github.com\/hasherezade\/funky_malware_formats\/tree\/master\/lotus_parser\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"https:\/\/github.com\/hasherezade\/funky_malware_formats\/tree\/master\/lotus_parser (opens in a new tab)\">https:\/\/github.com\/hasherezade\/funky_malware_formats\/tree\/master\/lotus_parser<\/a><br \/>Presentation from the SAS conference:<\/p>\n<figure class=\"wp-block-embed-speaker-deck wp-block-embed is-type-rich is-provider-speaker-deck wp-embed-aspect-16-9 wp-has-aspect-ratio\">\n<div class=\"wp-block-embed__wrapper\"> <iframe loading=\"lazy\"  src=\"\/\/speakerdeck.com\/player\/62f37c4b57934ad29be4bbe1b3138c52\" width=\"100%\" height=\"420\" frameborder=\"0\" ><\/iframe>  <\/div>\n<\/figure>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/\">Funky malware format found in Ocean Lotus sample<\/a> appeared first on <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\">Malwarebytes Labs<\/a>.<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/\" target=\"bwo\" >https:\/\/blog.malwarebytes.com\/feed\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><strong>Credit to Author: hasherezade| Date: Fri, 19 Apr 2019 18:37:54 +0000<\/strong><\/p>\n<table cellpadding='10'>\n<tr>\n<td valign='top' align='center'><a href='https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/' title='Funky malware format found in Ocean Lotus sample'><img src='https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/04\/shutterstock_81523963.jpg' border='0'  width='300px'  \/><\/a><\/td>\n<\/tr>\n<tr>\n<td valign='top' align='left'>Recently, one of our researchers presented at the SAS conference on &#8220;Funky malware formats&#8221;\u2014atypical executable formats used by malware that are only loaded by proprietary loaders. In this post, we analyze one of those formats in a sample called Ocean Lotus from the APT 32 threat group in Vietnam.<\/p>\n<p>Categories: <\/p>\n<ul class=\"post-categories\">\n<li><a href=\"https:\/\/blog.malwarebytes.com\/category\/threat-analysis\/malware-threat-analysis\/\" rel=\"category tag\">Malware<\/a><\/li>\n<li><a href=\"https:\/\/blog.malwarebytes.com\/category\/threat-analysis\/\" rel=\"category tag\">Threat analysis<\/a><\/li>\n<\/ul>\n<p>Tags: <a href=\"https:\/\/blog.malwarebytes.com\/tag\/apt-32\/\" rel=\"tag\">APT 32<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/atypical-malware-formats\/\" rel=\"tag\">atypical malware formats<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/blob\/\" rel=\"tag\">BLOB<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/cab\/\" rel=\"tag\">CAB<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/custom-format\/\" rel=\"tag\">custom format<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/malware-format\/\" rel=\"tag\">malware format<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/ocean-lotus\/\" rel=\"tag\">ocean lotus<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/vietnam\/\" rel=\"tag\">Vietnam<\/a><\/p>\n<table width='100%'>\n<tr>\n<td align=right>\n<p><b>(<a href='https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/' title='Funky malware format found in Ocean Lotus sample'>Read more&#8230;<\/a>)<\/b><\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/td>\n<\/tr>\n<\/table>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/04\/funky-malware-format-found-in-ocean-lotus-sample\/\">Funky malware format found in Ocean Lotus sample<\/a> appeared first on <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\">Malwarebytes Labs<\/a>.<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[10488,10378],"tags":[21596,21597,21598,9642,21599,3764,21600,21601,10494,5946],"class_list":["post-15137","post","type-post","status-publish","format-standard","hentry","category-malwarebytes","category-security","tag-apt-32","tag-atypical-malware-formats","tag-blob","tag-cab","tag-custom-format","tag-malware","tag-malware-format","tag-ocean-lotus","tag-threat-analysis","tag-vietnam"],"_links":{"self":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/15137","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=15137"}],"version-history":[{"count":0,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/15137\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=15137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=15137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=15137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}