{"id":16082,"date":"2019-08-15T08:10:08","date_gmt":"2019-08-15T16:10:08","guid":{"rendered":"http:\/\/www.palada.net\/index.php\/2019\/08\/15\/news-9825\/"},"modified":"2019-08-15T08:10:08","modified_gmt":"2019-08-15T16:10:08","slug":"news-9825","status":"publish","type":"post","link":"http:\/\/www.palada.net\/index.php\/2019\/08\/15\/news-9825\/","title":{"rendered":"The Hidden Bee infection chain, part 1: the stegano pack"},"content":{"rendered":"<p><strong>Credit to Author: hasherezade| Date: Thu, 15 Aug 2019 15:26:55 +0000<\/strong><\/p>\n<p>About a year ago, <a rel=\"noreferrer noopener\" aria-label=\"we described Hidden Bee miner delivered by the Underminer Exploit Kit (opens in a new tab)\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/07\/hidden-bee-miner-delivered-via-improved-drive-by-download-toolkit\/\" target=\"_blank\">we described the Hidden Bee miner delivered by the Underminer Exploit Kit<\/a>. <\/p>\n<p>Hidden Bee has a complex and multi-layered internal structure that is unusual among cybercrime toolkits, making it an interesting phenomenon on the threat landscape. That&#8217;s why we&#8217;re dedicating a series of posts to exploring particular elements and updates made during one year of its evolution. <\/p>\n<p>Recently, we decided to revisit this interesting miner, <a rel=\"noreferrer noopener\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/05\/hidden-bee-lets-go-down-the-rabbit-hole\/\" target=\"_blank\">describing its loader<\/a> that starts the infection from a single malicious executable. This post will present an alternative loader that is deployed when the infection starts from the Underminer Exploit Kit. It is analogous to the loader we described in the following posts from 2018: [<a rel=\"noreferrer noopener\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/07\/hidden-bee-miner-delivered-via-improved-drive-by-download-toolkit\/\" target=\"_blank\">1<\/a>] and [<a rel=\"noreferrer noopener\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/reversing-malware-in-a-custom-format-hidden-bee-elements\/\" target=\"_blank\">2<\/a>]. <\/p>\n<h3 id=\"mce_22\">The dropped payloads: an overview<\/h3>\n<p>The first time we spotted Hidden Bee, it started the infection from a flash exploit. It downloaded and injected two elements with WASM extensions that in reality were executable modules in a custom format. We described them in detail <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/reversing-malware-in-a-custom-format-hidden-bee-elements\/\" target=\"_blank\">here<\/a>. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39999\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/queried_urls_-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/queried_urls_.png\" data-orig-size=\"780,58\" 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=\"queried_urls_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/queried_urls_-300x22.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/queried_urls_-600x45.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/queried_urls_.png\" alt=\"\" class=\"wp-image-39999\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/queried_urls_.png 780w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/queried_urls_-300x22.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/queried_urls_-600x45.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/queried_urls_-767x58.png 767w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><figcaption>The files with WASM extensions, observed a year ago<\/figcaption><\/figure>\n<p>Those elements were the initial loaders, responsible for initiating <a rel=\"noreferrer noopener\" aria-label=\"the infection chain, that at the end resulted in installing the miner (opens in a new tab)\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/05\/hidden-bee-lets-go-down-the-rabbit-hole\/\" target=\"_blank\">the infection chain that at the end installed the miner<\/a>.<\/p>\n<p>Nowadays, those elements have changed. If we take a look at the elements dropped by the same EK today, we will no longer find those WASM extensions. Instead, we encounter various multimedia files: a WAV (alternatively two WAVs), a JPEG, and a PNG. <\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_png.png\" data-rel=\"lightbox-0\" title=\"\"><img decoding=\"async\" data-attachment-id=\"39866\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/download_png\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_png.png\" data-orig-size=\"780,194\" 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=\"download_png\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_png-300x75.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_png-600x149.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_png.png\" alt=\"\" class=\"wp-image-39866\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_png.png 780w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_png-300x75.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_png-600x149.png 600w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/a><figcaption>The elements downloaded nowadays: WAV, JPG, PNG<\/figcaption><\/figure>\n<p>The WAV files are downloaded by iexplore.exe, the browser where the exploit is run. In contrast, the images are downloaded at later stages of infection. For example, the JPG is always downloaded from the dllhost.exe process. The PNG is often downloaded from yet another process.<\/p>\n<p>In some runs, we observed the PNG to be downloaded instead of the JPG:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/dropped_payloads2.png\" target=\"_blank\" rel=\"noreferrer noopener\" data-rel=\"lightbox-1\" title=\"\"><img decoding=\"async\" data-attachment-id=\"38761\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/dropped_payloads2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/dropped_payloads2.png\" data-orig-size=\"959,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=\"dropped_payloads2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/dropped_payloads2-300x38.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/dropped_payloads2-600x76.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/dropped_payloads2.png\" alt=\"\" class=\"wp-image-38761\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/dropped_payloads2.png 959w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/dropped_payloads2-300x38.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/dropped_payloads2-600x76.png 600w\" sizes=\"(max-width: 959px) 100vw, 959px\" \/><\/a><figcaption>Alternative: PNG being downloaded after WAV<\/figcaption><\/figure>\n<p>We will start our journey of Hidden Bee analysis by looking at these files. Then, we will move to see the code responsible for processing them in order to reveal their hidden purpose.<\/p>\n<p>The roadmap of the full described package:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"40023\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/steganopack_diagram2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/steganopack_diagram2.png\" data-orig-size=\"641,803\" 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=\"steganopack_diagram2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/steganopack_diagram2-239x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/steganopack_diagram2-479x600.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/steganopack_diagram2.png\" alt=\"\" class=\"wp-image-40023\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/steganopack_diagram2.png 641w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/steganopack_diagram2-239x300.png 239w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/steganopack_diagram2-479x600.png 479w\" sizes=\"(max-width: 641px) 100vw, 641px\" \/><figcaption>Diagram showing the transitions between the elements<\/figcaption><\/figure>\n<h4 id=\"mce_48\">The downloaded WAV<\/h4>\n<p>The WAV file sounds like grey noise, and we suspect that it is meant to hide some binary belonging to the malware. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39768\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/wav_visualization\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/wav_visualization.png\" data-orig-size=\"830,151\" 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=\"wav_visualization\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/wav_visualization-300x55.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/wav_visualization-600x109.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/wav_visualization.png\" alt=\"\" class=\"wp-image-39768\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/wav_visualization.png 830w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/wav_visualization-300x55.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/wav_visualization-600x109.png 600w\" sizes=\"(max-width: 830px) 100vw, 830px\" \/><figcaption>An oscillogram of the WAV file<\/figcaption><\/figure>\n<p>The data is unreadable, probably encrypted or obfuscated:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38748\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/wav_bgn\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_bgn.png\" data-orig-size=\"626,197\" 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=\"wav_bgn\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_bgn-300x94.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_bgn-600x189.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_bgn.png\" alt=\"\" class=\"wp-image-38748\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_bgn.png 626w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_bgn-300x94.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_bgn-600x189.png 600w\" sizes=\"(max-width: 626px) 100vw, 626px\" \/><\/figure>\n<p>We also found a repeating pattern inside, which looks like an encrypted padding. The size of the chunk is 8 bytes.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38751\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/wav_pattern-3\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_pattern-2.png\" data-orig-size=\"609,97\" 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=\"wav_pattern\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_pattern-2-300x48.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_pattern-2-600x96.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_pattern-2.png\" alt=\"\" class=\"wp-image-38751\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_pattern-2.png 609w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_pattern-2-300x48.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_pattern-2-600x96.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/wav_pattern-2-604x97.png 604w\" sizes=\"(max-width: 609px) 100vw, 609px\" \/><figcaption>The repeating pattern inside the file: 8 bytes long<\/figcaption><\/figure>\n<p>This time, using the repeating pattern as an XOR key didn&#8217;t help in getting a readable result, so probably some more complex block cipher was used.<\/p>\n<h4>The JPG<\/h4>\n<p>Below is a sample JPG, downloaded from the URL in the format: <code>\/views\/[unique_string].jpg<\/code><\/p>\n<p>In contrast to the WAV content, the JPG always looks like a valid image. (Interestingly, all the JPGs we observed have a consistent theme of manga-styled girls.) However, if we take a closer look at the image, we can see that some data is appended at the end.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38726\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/malware_girl\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/malware_girl.png\" data-orig-size=\"533,467\" 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=\"malware_girl\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/malware_girl-300x263.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/malware_girl.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/malware_girl.png\" alt=\"\" class=\"wp-image-38726\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/malware_girl.png 533w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/malware_girl-300x263.png 300w\" sizes=\"(max-width: 533px) 100vw, 533px\" \/><\/figure>\n<p>Let&#8217;s analyze the JPG and try to extract the payload. <\/p>\n<p>First, I opened the image in a hexeditor (i.e. HxD). The size of the full image is 156,005 bytes. The last 118,762 bytes belong to the malware. So, we need remove the first 37,243 bytes (156,005-118,762=37,243) in order to get the payload.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38728\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/payload_jpg\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_jpg.png\" data-orig-size=\"633,183\" 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=\"payload_jpg\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_jpg-300x87.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_jpg-600x173.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_jpg.png\" alt=\"\" class=\"wp-image-38728\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_jpg.png 633w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_jpg-300x87.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_jpg-600x173.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_jpg-630x183.png 630w\" sizes=\"(max-width: 633px) 100vw, 633px\" \/><figcaption>The appended part of the JPG<\/figcaption><\/figure>\n<p>The payload does not look like a valid code, so it is probably obfuscated. Let&#8217;s try the easiest option first and see if there are any candidates for the XOR key. We can see that the payload has padding at the end:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38729\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/payload_padding\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_padding.png\" data-orig-size=\"627,129\" 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=\"payload_padding\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_padding-300x62.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_padding-600x123.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_padding.png\" alt=\"\" class=\"wp-image-38729\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_padding.png 627w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_padding-300x62.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/payload_padding-600x123.png 600w\" sizes=\"(max-width: 627px) 100vw, 627px\" \/><\/figure>\n<p>Let&#8217;s try to apply the repeating character (in the given example it is 0xE5) as an XOR key. This is the result (<a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/malshare.com\/sample.php?action=detail&amp;hash=1953032199142ea8c5872107da8f2297\" target=\"_blank\">1953032199142ea8c5872107da8f2297<\/a>):<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38730\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/rcx_package\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_package.png\" data-orig-size=\"626,245\" 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=\"rcx_package\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_package-300x117.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_package-600x235.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_package.png\" alt=\"\" class=\"wp-image-38730\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_package.png 626w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_package-300x117.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_package-600x235.png 600w\" sizes=\"(max-width: 626px) 100vw, 626px\" \/><\/figure>\n<p>Repeating the experiment on various payloads, we can see that the result always start from the keyword <code>!rcx<\/code>. As we know from analyzing <a rel=\"noreferrer noopener\" aria-label=\"other elements of Hidden Bee (opens in a new tab)\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/05\/hidden-bee-lets-go-down-the-rabbit-hole\/\" target=\"_blank\">other elements of Hidden Bee<\/a>, the authors of this malware decided to use various custom formats named after <a rel=\"noreferrer noopener\" aria-label=\"64 bit Intel registers (opens in a new tab)\" href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/debugger\/x64-architecture\" target=\"_blank\">64-bit Intel registers<\/a>. We also encountered packages starting from <code>!rbx<\/code>  and <code>!rsi<\/code> at different layers. So, this is the first element in the chain that uses this convention.<\/p>\n<p>When we load the <code>!rcx<\/code> module into IDA, we can confirm that it contains valid code. More detailed explanation about the <code>!rcx<\/code>  format will be given later on in this article.<\/p>\n<h4 id=\"mce_79\">The PNG<\/h4>\n<p>Let&#8217;s have a look at a sample PNG, download from the &#8220;captcha.png&#8221; (URL format: <code>\/images\/captcha.png?mod=attachment&amp;u=[unique_id]<\/code>):<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38763\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/captcha_png\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/captcha_png.png\" data-orig-size=\"429,238\" 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=\"captcha_png\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/captcha_png-300x166.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/captcha_png.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/captcha_png.png\" alt=\"\" class=\"wp-image-38763\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/captcha_png.png 429w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/captcha_png-300x166.png 300w\" sizes=\"(max-width: 429px) 100vw, 429px\" \/><\/figure>\n<p>Although it is a PNG in a valid format, it looks like noise. It probably represents bytes of some encrypted data. An attempt of converting PNG to raw bytes didn&#8217;t give any readable results. We need to analyze the code in order to discover what it hides.<\/p>\n<h3 id=\"mce_73\">Code analysis: the initial SWF file <\/h3>\n<p>The initial SWF file is embedded on the website and responsible for serving the exploit. If we look inside it, we will not find anything malicious at first. However, among the binary data we can find another suspicious WAV as an audio asset:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38752\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/assets\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/assets.png\" data-orig-size=\"395,197\" 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=\"assets\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/assets-300x150.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/assets.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/assets.png\" alt=\"\" class=\"wp-image-38752\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/assets.png 395w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/assets-300x150.png 300w\" sizes=\"(max-width: 395px) 100vw, 395px\" \/><\/figure>\n<p>The beginning of the file:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38753\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/audio_in_swf\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/audio_in_swf.png\" data-orig-size=\"743,128\" 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=\"audio_in_swf\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/audio_in_swf-300x52.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/audio_in_swf-600x103.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/audio_in_swf.png\" alt=\"\" class=\"wp-image-38753\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/audio_in_swf.png 743w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/audio_in_swf-300x52.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/audio_in_swf-600x103.png 600w\" sizes=\"(max-width: 743px) 100vw, 743px\" \/><\/figure>\n<p>This SWF file also contains a decoder for it:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38754\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decide_wav\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/decide_wav.png\" data-orig-size=\"614,548\" 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=\"decide_wav\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/decide_wav-300x268.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/decide_wav-600x536.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/decide_wav.png\" alt=\"\" class=\"wp-image-38754\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/decide_wav.png 614w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/decide_wav-300x268.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/decide_wav-600x536.png 600w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n<p>The function &#8220;decode&#8221; takes four parameters. The first of them is the byte array containing the WAV asset: That is the content to be decoded. The second argument is an MD5 (the &#8220;setup&#8221; function is an MD5 implementation) made of concatenation of the AppId and the AppToken: That is probably the encryption key. The third parameter is a salt (probably the initialization vector of the crypto).<\/p>\n<p>The salt is fetched from the HTML page, where the Flash component is embedded:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/salt_passed.png\" target=\"_blank\" rel=\"noreferrer noopener\" data-rel=\"lightbox-2\" title=\"\"><img decoding=\"async\" data-attachment-id=\"38764\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/salt_passed\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/salt_passed.png\" data-orig-size=\"886,298\" 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=\"salt_passed\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/salt_passed-300x101.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/salt_passed-600x202.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/salt_passed.png\" alt=\"\" class=\"wp-image-38764\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/salt_passed.png 886w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/salt_passed-300x101.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/salt_passed-600x202.png 600w\" sizes=\"(max-width: 886px) 100vw, 886px\" \/><\/a><\/figure>\n<h4 id=\"mce_22\">Alternative case: two WAV files<\/h4>\n<p>Sometimes, rather than embedding the WAV containing the Flash exploit, authors use another model of delivering it. They store the URL to the WAV, and then they retrieve the file.<\/p>\n<p>In the below example, we can see how this model is applied to Hidden Bee. The salt, along with the WAV URL, are both stored in the Javascript embedded in the HTML:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39839\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/external_audio_res\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_res.png\" data-orig-size=\"731,331\" 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=\"external_audio_res\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_res-300x136.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_res-600x272.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_res.png\" alt=\"\" class=\"wp-image-39839\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_res.png 731w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_res-300x136.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_res-600x272.png 600w\" sizes=\"(max-width: 731px) 100vw, 731px\" \/><\/figure>\n<p>The Flash file first loads it and then decodes as the next step:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39840\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/external_audio_load\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_load.png\" data-orig-size=\"595,387\" 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=\"external_audio_load\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_load-300x195.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_load.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_load.png\" alt=\"\" class=\"wp-image-39840\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_load.png 595w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio_load-300x195.png 300w\" sizes=\"(max-width: 595px) 100vw, 595px\" \/><\/figure>\n<p>Looking at the traffic capture, we can see that in this case, not one, but <em>two<\/em> WAV files are downloaded:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio1.png\" data-rel=\"lightbox-3\" title=\"\"><img decoding=\"async\" data-attachment-id=\"39841\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/external_audio1\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio1.png\" data-orig-size=\"863,94\" 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=\"external_audio1\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio1-300x33.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio1-600x65.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio1.png\" alt=\"\" class=\"wp-image-39841\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio1.png 863w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio1-300x33.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/external_audio1-600x65.png 600w\" sizes=\"(max-width: 863px) 100vw, 863px\" \/><\/a><figcaption>A case when two WAV files were downloaded (and none embedded in the Flash)<\/figcaption><\/figure>\n<p>The algorithms used to encrypt the content of the first WAV may vary and sometimes the algorithm is supplied as one of the parameters. After the content is fetched, the data from the WAV files is decoded using one of the available algorithms:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39843\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decode_read_content\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_read_content.png\" data-orig-size=\"605,121\" 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=\"decode_read_content\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_read_content-300x60.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_read_content-600x120.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_read_content.png\" alt=\"\" class=\"wp-image-39843\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_read_content.png 605w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_read_content-300x60.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_read_content-600x120.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_read_content-604x121.png 604w\" sizes=\"(max-width: 605px) 100vw, 605px\" \/><\/figure>\n<p>We can see that the expected content is a Flash file that is then loaded:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39844\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/run_new_clip\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/run_new_clip.png\" data-orig-size=\"644,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=\"run_new_clip\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/run_new_clip-300x48.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/run_new_clip-600x97.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/run_new_clip.png\" alt=\"\" class=\"wp-image-39844\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/run_new_clip.png 644w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/run_new_clip-300x48.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/run_new_clip-600x97.png 600w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><\/figure>\n<h4>The &#8220;decode&#8221; function<\/h4>\n<p>The function &#8220;decode&#8221; is imported from the package &#8220;com.google&#8221;:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39741\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/google_decode\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode.png\" data-orig-size=\"475,54\" 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=\"google_decode\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode-300x34.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode.png\" alt=\"\" class=\"wp-image-39741\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode.png 475w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode-300x34.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode-470x54.png 470w\" sizes=\"(max-width: 475px) 100vw, 475px\" \/><\/figure>\n<p>The full decompiled code is available <a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/gist.github.com\/malwarezone\/3aea44e1d4c66821f92b1092461fb815\" target=\"_blank\">here<\/a>.<\/p>\n<p>When we look inside, we see that the code is slightly obfuscated:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode_obf.png\" data-rel=\"lightbox-4\" title=\"\"><img decoding=\"async\" data-attachment-id=\"39742\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/google_decode_obf\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode_obf.png\" data-orig-size=\"1033,367\" 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=\"google_decode_obf\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode_obf-300x107.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode_obf-600x213.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode_obf.png\" alt=\"\" class=\"wp-image-39742\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode_obf.png 1033w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode_obf-300x107.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/google_decode_obf-600x213.png 600w\" sizes=\"(max-width: 1033px) 100vw, 1033px\" \/><\/a><\/figure>\n<p>Looking at the decompiled code, we see some interesting constants. For example, &#8211;889275714 in hex is 0xCAFEBABE. As we found during <a rel=\"noreferrer noopener\" aria-label=\"analysis of other Hidden Bee's elements (opens in a new tab)\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/05\/hidden-bee-lets-go-down-the-rabbit-hole\/\" target=\"_blank\">analysis of other Hidden Bee elements<\/a>, this DWORD was used by the same authors before as a magic number identifying one of the custom formats.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39743\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/cafebabe\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/cafebabe.png\" data-orig-size=\"448,570\" 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=\"cafebabe\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/cafebabe-236x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/cafebabe.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/cafebabe.png\" alt=\"\" class=\"wp-image-39743\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/cafebabe.png 448w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/cafebabe-236x300.png 236w\" sizes=\"(max-width: 448px) 100vw, 448px\" \/><\/figure>\n<p>Internally, there are references to a function from another module: E_ENCRYPT_process_bytes(). Inside this function, we see calls suggesting that the <a rel=\"noreferrer noopener\" aria-label=\"Rabbit Cipher (opens in a new tab)\" href=\"https:\/\/en.wikipedia.org\/wiki\/Rabbit_(cipher)\" target=\"_blank\">Rabbit Cipher<\/a> has been used:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39746\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/rabbit_cipher\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/rabbit_cipher.png\" data-orig-size=\"466,460\" 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=\"rabbit_cipher\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/rabbit_cipher-300x296.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/rabbit_cipher.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/rabbit_cipher.png\" alt=\"\" class=\"wp-image-39746\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/rabbit_cipher.png 466w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/rabbit_cipher-300x296.png 300w\" sizes=\"(max-width: 466px) 100vw, 466px\" \/><\/figure>\n<p>Rabbit uses a 128-bit key (the same length as the MD5 hash that was mentioned before) and a 64-bit initialization vector. (In different runs, a different encryption algorithm may be selected.)<\/p>\n<p>After the decoding process is complete, the revealed content is loaded:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/load_on_complete.png\" data-rel=\"lightbox-5\" title=\"\"><img decoding=\"async\" data-attachment-id=\"39745\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/load_on_complete\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/load_on_complete.png\" data-orig-size=\"795,412\" 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_on_complete\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/load_on_complete-300x155.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/load_on_complete-600x311.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/load_on_complete.png\" alt=\"\" class=\"wp-image-39745\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/load_on_complete.png 795w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/load_on_complete-300x155.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/07\/load_on_complete-600x311.png 600w\" sizes=\"(max-width: 795px) 100vw, 795px\" \/><\/a><\/figure>\n<h4 id=\"mce_29\">The first WAV: a Flash exploit<\/h4>\n<p>The decoded WAV contains a package with two elements embedded: a Flash file (movies.swf) and the configuration file (config.cfg). The decrypted data starts from the magic DWORD 0xCAFEBABE, which we noticed in the code of the previous SWF.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39835\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/maybe_decoded\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/maybe_decoded.png\" data-orig-size=\"626,264\" 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=\"maybe_decoded\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/maybe_decoded-300x127.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/maybe_decoded-600x253.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/maybe_decoded.png\" alt=\"\" class=\"wp-image-39835\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/maybe_decoded.png 626w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/maybe_decoded-300x127.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/maybe_decoded-600x253.png 600w\" sizes=\"(max-width: 626px) 100vw, 626px\" \/><\/figure>\n<p>The Flash file (movies.swf) contains an embedded exploit. In the analyzed case, the exploit used is <a rel=\"noreferrer noopener\" aria-label=\"CVE-2015-5122  (opens in a new tab)\" href=\"https:\/\/cve.mitre.org\/cgi-bin\/cvename.cgi?name=CVE-2015-5122\" target=\"_blank\">CVE-2015-5122<\/a>, however, a different exploit may be used on a different machine:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39836\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/exploit_flash\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/exploit_flash.png\" data-orig-size=\"270,225\" 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=\"exploit_flash\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/exploit_flash.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/exploit_flash.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/exploit_flash.png\" alt=\"\" class=\"wp-image-39836\"\/><\/figure>\n<p>The payload (shellcode) is stored in form of an array (binary version available here: <a rel=\"noreferrer noopener\" aria-label=\"9aec11ff93b9df14f060f78fbb1b47a2 (opens in a new tab)\" href=\"https:\/\/malshare.com\/sample.php?action=detail&amp;hash=9aec11ff93b9df14f060f78fbb1b47a2\" target=\"_blank\">9aec11ff93b9df14f060f78fbb1b47a2<\/a>):<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/payload32.png\" data-rel=\"lightbox-6\" title=\"\"><img decoding=\"async\" data-attachment-id=\"39837\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/payload32\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/payload32.png\" data-orig-size=\"798,260\" 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=\"payload32\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/payload32-300x98.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/payload32-600x195.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/payload32.png\" alt=\"\" class=\"wp-image-39837\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/payload32.png 798w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/payload32-300x98.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/payload32-600x195.png 600w\" sizes=\"(max-width: 798px) 100vw, 798px\" \/><\/a><\/figure>\n<p>The configuration file (config.cfg) contains the URL to another WAV file. <\/p>\n<p>The payload is padded with NOP (0x90) bytes, and the parameters, including the configuration, are filled there before the payload runs.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"40013\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/params_filled-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/params_filled-1.png\" data-orig-size=\"471,401\" 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=\"params_filled\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/params_filled-1-300x255.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/params_filled-1.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/params_filled-1.png\" alt=\"\" class=\"wp-image-40013\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/params_filled-1.png 471w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/params_filled-1-300x255.png 300w\" sizes=\"(max-width: 471px) 100vw, 471px\" \/><figcaption>The fragment of the code feeding the configuration into the payload<\/figcaption><\/figure>\n<h4 id=\"mce_55\">The shellcode: downloading the second WAV<\/h4>\n<p>The second WAV, in contrast to the first one, is always downloaded and never embedded. It is retrieved by the &#8220;PayloadWin32&#8221; shellcode (<a rel=\"noreferrer noopener\" href=\"https:\/\/malshare.com\/sample.php?action=detail&amp;hash=9aec11ff93b9df14f060f78fbb1b47a2\" target=\"_blank\">9aec11ff93b9df14f060f78fbb1b47a2<\/a>), deployed after the successful exploitation.<\/p>\n<p>Looking inside this shellcode, we find the function that is responsible for downloading and decrypting another WAV. The shellcode uses parameters that were filled by the previous layer. This buffer contains the URL that will be queried and the key that will be used for decryption of the payload. It loads functions from wininet.dll using their checksums. After the initialization steps, it queries the supplied URL. The expected result is a buffer with a header typical for WAV files.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39979\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/download_wav\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_wav.png\" data-orig-size=\"700,362\" 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=\"download_wav\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_wav-300x155.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_wav-600x310.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_wav.png\" alt=\"\" class=\"wp-image-39979\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_wav.png 700w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_wav-300x155.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/download_wav-600x310.png 600w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/figure>\n<p>As we already suspected, the data of the WAV (starting from the offset 0x2C) contains the encrypted content. Indeed, blocks that are 8 bytes long are decrypted in a loop:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39980\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decrypting_loop\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypting_loop.png\" data-orig-size=\"428,319\" 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=\"decrypting_loop\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypting_loop-300x224.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypting_loop.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypting_loop.png\" alt=\"\" class=\"wp-image-39980\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypting_loop.png 428w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypting_loop-300x224.png 300w\" sizes=\"(max-width: 428px) 100vw, 428px\" \/><\/figure>\n<p>After the decryption is complete, the next module will be revealed. It is interesting to take a look at the expected header of the payload to learn which format is used for the output element. This time, the decoded data is supposed to start with the following magic numbers: 0x01, 0x04, &#8230;, 0x10.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39981\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/check_and_call_payload\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_and_call_payload.png\" data-orig-size=\"701,384\" 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=\"check_and_call_payload\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_and_call_payload-300x164.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_and_call_payload-600x329.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_and_call_payload.png\" alt=\"\" class=\"wp-image-39981\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_and_call_payload.png 701w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_and_call_payload-300x164.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_and_call_payload-600x329.png 600w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><\/figure>\n<h4 id=\"mce_27\">The second WAV: an executable in proprietary format<\/h4>\n<p>On the illustration below, we can see how the data of the WAV looks after being decrypted (<a rel=\"noreferrer noopener\" aria-label=\"9b37c9ec19a53007d450b9b9c8febbe2 (opens in a new tab)\" href=\"https:\/\/malshare.com\/sample.php?action=detail&amp;hash=9b37c9ec19a53007d450b9b9c8febbe2\" target=\"_blank\">9b37c9ec19a53007d450b9b9c8febbe2<\/a>):<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39889\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decode_riff_stage2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_riff_stage2.png\" data-orig-size=\"456,216\" 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=\"decode_riff_stage2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_riff_stage2-300x142.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_riff_stage2.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_riff_stage2.png\" alt=\"\" class=\"wp-image-39889\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_riff_stage2.png 456w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_riff_stage2-300x142.png 300w\" sizes=\"(max-width: 456px) 100vw, 456px\" \/><\/figure>\n<p>This is an executable component that is loaded into Internet Explorer. After it decodes the imports, it starts to look much more familiar:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39890\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/riff_after_decode\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/riff_after_decode.png\" data-orig-size=\"451,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=\"riff_after_decode\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/riff_after_decode-300x101.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/riff_after_decode.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/riff_after_decode.png\" alt=\"\" class=\"wp-image-39890\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/riff_after_decode.png 451w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/riff_after_decode-300x101.png 300w\" sizes=\"(max-width: 451px) 100vw, 451px\" \/><\/figure>\n<p>We can see that it follows an analogical structure to the one described in last year&#8217;s article.<\/p>\n<p>This module is first executed within Internet Explorer. Then, it creates another process (dllhost.exe) in a suspended state:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39892\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/create_process_from_payl\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/create_process_from_payl.png\" data-orig-size=\"521,295\" 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=\"create_process_from_payl\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/create_process_from_payl-300x170.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/create_process_from_payl.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/create_process_from_payl.png\" alt=\"\" class=\"wp-image-39892\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/create_process_from_payl.png 521w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/create_process_from_payl-300x170.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/create_process_from_payl-400x225.png 400w\" sizes=\"(max-width: 521px) 100vw, 521px\" \/><\/figure>\n<p>It injects its original copy there (<a rel=\"noreferrer noopener\" aria-label=\"769a05f0eddd6ef2ebdd13618b244758 (opens in a new tab)\" href=\"https:\/\/malshare.com\/sample.php?action=detail&amp;hash=769a05f0eddd6ef2ebdd13618b244758\" target=\"_blank\">769a05f0eddd6ef2ebdd13618b244758<\/a>):<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39894\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/encoded_version_injected\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/encoded_version_injected.png\" data-orig-size=\"621,462\" 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=\"encoded_version_injected\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/encoded_version_injected-300x223.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/encoded_version_injected-600x446.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/encoded_version_injected-600x446.png\" alt=\"\" class=\"wp-image-39894\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/encoded_version_injected-600x446.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/encoded_version_injected-300x223.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/encoded_version_injected.png 621w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/figure>\n<p>Then it redirects execution to its loading function. Below, we can see the Entry Point of the implanted module within dllhost.exe.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39893\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/implanted_module_ep\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/implanted_module_ep.png\" data-orig-size=\"524,321\" 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=\"implanted_module_ep\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/implanted_module_ep-300x184.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/implanted_module_ep.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/implanted_module_ep.png\" alt=\"\" class=\"wp-image-39893\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/implanted_module_ep.png 524w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/implanted_module_ep-300x184.png 300w\" sizes=\"(max-width: 524px) 100vw, 524px\" \/><\/figure>\n<p>A detailed analysis of the execution flow of this module and its format will be given later in the article.<\/p>\n<p>At this point, it is important to note that the dllhost.exe is the module that further downloads the aforementioned images.<\/p>\n<h3>The modules with the custom format<\/h3>\n<p>The module with the custom format is analogous to the one <a rel=\"noreferrer noopener\" aria-label=\"described before (opens in a new tab)\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/reversing-malware-in-a-custom-format-hidden-bee-elements\/\" target=\"_blank\">described before<\/a>. However, we can see that it has significantly evolved. <\/p>\n<p>There are changes in the header, as well as improvements in the implementation.<\/p>\n<h4>Changes in the custom format<\/h4>\n<p>The new header is similar to the <a rel=\"noreferrer noopener\" aria-label=\" previous one (opens in a new tab)\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/reversing-malware-in-a-custom-format-hidden-bee-elements\/#\" target=\"_blank\">previous one<\/a>. The few details that have changed are: the magic number at the beginning (from 0x1000<strong>03<\/strong>01 to 0x1000<strong>04<\/strong>01), and the format in which the DLLs are stored (the length of a DLL name has been added). That&#8217;s why we will refer to this format as &#8220;0x10000401 format.&#8221;<\/p>\n<p>Another change is that now the names of the DLLs are obfuscated by a simple XOR with 1 byte character. They are deobfuscated just before being loaded.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39899\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/loading_func_by_name\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/loading_func_by_name.png\" data-orig-size=\"324,382\" 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=\"loading_func_by_name\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/loading_func_by_name-254x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/loading_func_by_name.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/loading_func_by_name.png\" alt=\"\" class=\"wp-image-39899\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/loading_func_by_name.png 324w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/loading_func_by_name-254x300.png 254w\" sizes=\"(max-width: 324px) 100vw, 324px\" \/><\/figure>\n<p>Summing up, we can visualize the new format in the following way:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/new_hdr-2.png\" data-rel=\"lightbox-7\" title=\"\"><img decoding=\"async\" data-attachment-id=\"39901\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/new_hdr-3\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/new_hdr-2.png\" data-orig-size=\"804,597\" 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=\"new_hdr\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/new_hdr-2-300x223.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/new_hdr-2-600x446.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/new_hdr-2.png\" alt=\"\" class=\"wp-image-39901\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/new_hdr-2.png 804w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/new_hdr-2-300x223.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/new_hdr-2-600x446.png 600w\" sizes=\"(max-width: 804px) 100vw, 804px\" \/><\/a><\/figure>\n<h4 id=\"mce_43\">Obfuscation used<\/h4>\n<p>This time, authors decide to obfuscate all the strings used inside the module. Now all the strings are decoded just before use.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39868\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decode_and_use\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_use.png\" data-orig-size=\"335,121\" 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=\"decode_and_use\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_use-300x108.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_use.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_use.png\" alt=\"\" class=\"wp-image-39868\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_use.png 335w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_use-300x108.png 300w\" sizes=\"(max-width: 335px) 100vw, 335px\" \/><figcaption>Example: decoding the string before the use<\/figcaption><\/figure>\n<p>The decoding algorithm is simple, based on XOR:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39929\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decode_memory\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_memory.png\" data-orig-size=\"403,364\" 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=\"decode_memory\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_memory-300x271.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_memory.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_memory.png\" alt=\"\" class=\"wp-image-39929\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_memory.png 403w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_memory-300x271.png 300w\" sizes=\"(max-width: 403px) 100vw, 403px\" \/><figcaption>The string-decoding algorithm<\/figcaption><\/figure>\n<h3>Inside the images downloader<\/h3>\n<p>Let&#8217;s look inside the first module in the 0x10000401 format that we encountered. This module is an initial stage, and its role is to download and unpack the other components. One such component is in a CAB format (that&#8217;s why we can see the Cabinet.dll among the imported DLLs). <\/p>\n<p>The role of this module is similar to the first &#8220;WASM&#8221; mentioned in our post a year ago. However, the current version is not only better protected, but also comes with some improvements. This time the downloaded content is hidden in the images. So, analyzing this element can help us to understand how the used stenography works.<\/p>\n<p>First, we can see that the URLs are retrieved from their Base64 form:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39871\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decoding_urls-3\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decoding_urls.png\" data-orig-size=\"577,125\" 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=\"decoding_urls\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decoding_urls-300x65.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decoding_urls.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decoding_urls.png\" alt=\"\" class=\"wp-image-39871\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decoding_urls.png 577w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decoding_urls-300x65.png 300w\" sizes=\"(max-width: 577px) 100vw, 577px\" \/><\/figure>\n<p>This string decodes to a list containing URLs of the PNG and JPG files that are going to be downloaded. For each sample, this set is unique. None of the  URLs can be reused: the server gives a response only once. An example of a URL set:<\/p>\n<p><pre>http:\/\/38.75.137.9:9088\/pubs\/wiki.php?id=937a4eadd6f5a94b3738a58dcc79ca13 http:\/\/38.75.137.9:9088\/images\/captcha.png?mod=attachment&u=357e27e8af72925144ec1db2421d0cc5&lt http:\/\/38.75.137.9:9088\/views\/q5ul78uv4b4q8bg8d95canrsns.jpg <\/pre>\n<\/p>\n<p>So, we can confirm that this module is the one responsible for downloading and processing the observed images. Indeed, inside we can find the functions responsible for their decoding.<\/p>\n<h4>Decoding the JPG<\/h4>\n<p>After the payload is retrieved, the JPG header is validated.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39874\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/check_jpg_hdr\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_jpg_hdr.png\" data-orig-size=\"403,257\" 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=\"check_jpg_hdr\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_jpg_hdr-300x191.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_jpg_hdr.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_jpg_hdr.png\" alt=\"\" class=\"wp-image-39874\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_jpg_hdr.png 403w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_jpg_hdr-300x191.png 300w\" sizes=\"(max-width: 403px) 100vw, 403px\" \/><\/figure>\n<p>Then, the payload is decoded by simply using an XOR with the last byte. The decoded content is expected to start from the !rcx magic ID.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39875\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/xor_decoded\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/xor_decoded.png\" data-orig-size=\"317,350\" 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=\"xor_decoded\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/xor_decoded-272x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/xor_decoded.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/xor_decoded.png\" alt=\"\" class=\"wp-image-39875\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/xor_decoded.png 317w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/xor_decoded-272x300.png 272w\" sizes=\"(max-width: 317px) 100vw, 317px\" \/><\/figure>\n<p>After decoding the content, the hash of the !rcx module is validated with the help of SHA256 hash. The valid hash is stored in the module&#8217;s header and compared with the calculated hash of the file content.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39876\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/validate_sha265_hash\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/validate_sha265_hash.png\" data-orig-size=\"268,503\" 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=\"validate_sha265_hash\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/validate_sha265_hash-160x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/validate_sha265_hash.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/validate_sha265_hash.png\" alt=\"\" class=\"wp-image-39876\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/validate_sha265_hash.png 268w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/validate_sha265_hash-160x300.png 160w\" sizes=\"(max-width: 268px) 100vw, 268px\" \/><\/figure>\n<p>If the validation passed, the shellcode stored in the !rcx module is loaded. More details about the execution flow will be given later.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39877\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/load_shellc\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_shellc.png\" data-orig-size=\"327,343\" 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_shellc\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_shellc-286x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_shellc.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_shellc.png\" alt=\"\" class=\"wp-image-39877\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_shellc.png 327w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_shellc-286x300.png 286w\" sizes=\"(max-width: 327px) 100vw, 327px\" \/><\/figure>\n<p>The !rcx package has a simple header:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39878\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/rcx_package-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rcx_package.png\" data-orig-size=\"744,283\" 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=\"rcx_package\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rcx_package-300x114.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rcx_package-600x228.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rcx_package.png\" alt=\"\" class=\"wp-image-39878\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rcx_package.png 744w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rcx_package-300x114.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rcx_package-600x228.png 600w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><\/figure>\n<h4>Decoding the PNG<\/h4>\n<p>Retrieving the content from the PNG is more complex.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39905\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/captcha-4\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/captcha-1.png\" data-orig-size=\"82,82\" 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=\"captcha\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/captcha-1.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/captcha-1.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/captcha-1.png\" alt=\"\" class=\"wp-image-39905\"\/><figcaption>&#8220;captcha.png&#8221; &#8211; the encrypted CAB file<\/figcaption><\/figure>\n<p>First, after downloading, the PNG header is checked:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39879\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/check_the_png\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_the_png.png\" data-orig-size=\"249,245\" 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=\"check_the_png\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_the_png.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_the_png.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_the_png.png\" alt=\"\" class=\"wp-image-39879\"\/><\/figure>\n<p>The function decoding the PNG has the following flow:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_load_coresdb.png\" data-rel=\"lightbox-8\" title=\"\"><img decoding=\"async\" data-attachment-id=\"39971\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decode_and_load_coresdb\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_load_coresdb.png\" data-orig-size=\"776,649\" 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=\"decode_and_load_coresdb\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_load_coresdb-300x251.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_load_coresdb-600x502.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_load_coresdb.png\" alt=\"\" class=\"wp-image-39971\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_load_coresdb.png 776w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_load_coresdb-300x251.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_load_coresdb-600x502.png 600w\" sizes=\"(max-width: 776px) 100vw, 776px\" \/><\/a><\/figure>\n<p>It converts the PNG into byte content and decrypts it with the help of <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/en.wikipedia.org\/wiki\/ARIA_(cipher)\" target=\"_blank\">ARIA cipher<\/a>. The result should be a CAB format. The unpacked CAB is supposed to contain a module &#8220;bin\/i386\/core.sdb&#8221; that also occurred in our previous encounters with Hidden Bee.<\/p>\n<p>The authors are careful not to reuse URLs as well as encryption keys. That&#8217;s why the Aria key is different for every unique payload. It is stored just after the end of the 0x10000401 module :<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"40015\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/aria_key_appended\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/aria_key_appended.png\" data-orig-size=\"609,65\" 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=\"aria_key_appended\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/aria_key_appended-300x32.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/aria_key_appended-600x64.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/aria_key_appended.png\" alt=\"\" class=\"wp-image-40015\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/aria_key_appended.png 609w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/aria_key_appended-300x32.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/aria_key_appended-600x64.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/aria_key_appended-604x65.png 604w\" sizes=\"(max-width: 609px) 100vw, 609px\" \/><figcaption>Key format: WORD key length; BYTE key_bytes[];<\/figcaption><\/figure>\n<p>During the module&#8217;s loading, the key is rewritten into another memory area, from which it is used to decrypt the downloaded module.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"40017\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/copy_the_key\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/copy_the_key.png\" data-orig-size=\"630,456\" 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=\"copy_the_key\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/copy_the_key-300x217.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/copy_the_key-600x434.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/copy_the_key.png\" alt=\"\" class=\"wp-image-40017\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/copy_the_key.png 630w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/copy_the_key-300x217.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/copy_the_key-600x434.png 600w\" sizes=\"(max-width: 630px) 100vw, 630px\" \/><\/figure>\n<p>The CAB file retrieved from the PNG is available here: <a rel=\"noreferrer noopener\" aria-label=\"001bdc26b2845dcf839f67a8760c6839 (opens in a new tab)\" href=\"https:\/\/malshare.com\/sample.php?action=detail&amp;hash=001bdc26b2845dcf839f67a8760c6839\" target=\"_blank\">001bdc26b2845dcf839f67a8760c6839<\/a><\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39903\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/inside_the_cab\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/inside_the_cab.png\" data-orig-size=\"491,109\" 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=\"inside_the_cab\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/inside_the_cab-300x67.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/inside_the_cab.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/inside_the_cab.png\" alt=\"\" class=\"wp-image-39903\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/inside_the_cab.png 491w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/inside_the_cab-300x67.png 300w\" sizes=\"(max-width: 491px) 100vw, 491px\" \/><\/figure>\n<p>It contains core.sdb (<a rel=\"noreferrer noopener\" aria-label=\"d1a2fdc79c154b120a0e52c46a73478d (opens in a new tab)\" href=\"https:\/\/malshare.com\/sample.php?action=detail&amp;hash=d1a2fdc79c154b120a0e52c46a73478d\" target=\"_blank\">d1a2fdc79c154b120a0e52c46a73478d<\/a>). That is a second module in Hidden Bee&#8217;s custom format.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39904\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/core_sdb_hdr-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/core_sdb_hdr.png\" data-orig-size=\"724,266\" 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=\"core_sdb_hdr\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/core_sdb_hdr-300x110.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/core_sdb_hdr-600x220.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/core_sdb_hdr.png\" alt=\"\" class=\"wp-image-39904\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/core_sdb_hdr.png 724w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/core_sdb_hdr-300x110.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/core_sdb_hdr-600x220.png 600w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/figure>\n<h3 id=\"mce_36\">Inside core.sdb<\/h3>\n<p>This module (retrieved from the PNG) is a second downloader component in the 0x10000401 format. This time, it uses a custom TCP-based protocol, referenced by the authors as SLTP. (This protocol was also used by the analogical component seen one year ago). The embedded links:<\/p>\n<p><code>sltp:\/\/dns.howtocom.site:1108\/minimal.bin?id=998 sltp:\/\/bbs.favcom.space:1108\/setup.bin?id=999 <\/code><\/p>\n<h4 id=\"mce_50\">Execution flow<\/h4>\n<ol>\n<li>Checks for blacklisted processes. If any are detected, exits.<\/li>\n<li>Removes functions: <code>DbgBreakPoint<\/code>, <code>DbgUserBreakPoint<\/code> by overwriting their beginning with the RET instruction.<\/li>\n<li>Checks if the malware is already installed. If yes, exits.<\/li>\n<li>Creates an installation mutex <code>{71BB7F1C-D700-4487-B9C6-6DD9863DFE91}-ins.<\/code><\/li>\n<li>If the module was run with the flag==1:\n<ol>\n<li>Connects to the first address:  <code>sltp:\/\/dns.howtocom.site:1108\/minimal.bin?id=998 <\/code><\/li>\n<li>Sets an environment variable <code>INSTALL_SOURCE<\/code> to the value given as an argument.<\/li>\n<li>Runs the downloaded next stage module.<\/li>\n<\/ol>\n<\/li>\n<li>If the module was run with the flag!=1:\n<ol>\n<li>Performs checks against VM. If detected, exits.<\/li>\n<li>Connects to the second address: <code>sltp:\/\/bbs.favcom.space:1108\/setup.bin?id=999<\/code>. This time, appends the victim&#8217;s fingerprint to the URL. Format: <code>&lt;URL&gt;&amp;sid=&lt;INSTALL_SID&gt;&amp;sz=&lt;unique machine ID: 16 bytes hex&gt;&amp;os=&lt;Windows version number&gt;&amp;ar=&lt;architecture&gt;<\/code><\/li>\n<li>Runs the downloaded next stage module.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h4>Defensive checks<\/h4>\n<p>At this stage, many anti-analysis checks are deployed. First, there are checks to detect if any of the blacklisted processes are running. The enumeration of the processes is implemented using a low-level function: <code>NtQuerySystemInformation<\/code> with a parameter 5 (<code>SystemProcessInformation<\/code>).<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39908\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/search_blacklisted\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/search_blacklisted.png\" data-orig-size=\"714,486\" 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=\"search_blacklisted\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/search_blacklisted-300x204.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/search_blacklisted-600x408.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/search_blacklisted.png\" alt=\"\" class=\"wp-image-39908\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/search_blacklisted.png 714w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/search_blacklisted-300x204.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/search_blacklisted-600x408.png 600w\" sizes=\"(max-width: 714px) 100vw, 714px\" \/><\/figure>\n<p>The blacklist contains popular debuggers and sniffers:<\/p>\n<p>&#8220;devenv.exe&#8221; , &#8220;wireshark.exe&#8221;,  &#8220;vmacthlp.exe&#8221;, &#8220;procmon.exe&#8221;, &#8220;ollydbg.exe&#8221;, &#8220;idag.exe&#8221;,  &#8220;ImmunityDebugger.exe&#8221;,  &#8220;windbg.exe&#8221;<br \/> &#8220;EHSniffer.exe&#8221;,  &#8220;iris.exe&#8221;,  &#8220;procexp.exe&#8221;,  &#8220;filemon.exe&#8221;,  &#8220;fiddler.exe&#8221;<\/p>\n<p>The names of the processes are obfuscated, so they are not visible on the strings list. If any of those processes are detected, the execution of the module terminates.<\/p>\n<p>Another function deploys a set of anti-VM checks. The anti-VM checks include:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39967\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/check_sets1\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sets1.png\" data-orig-size=\"297,169\" 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=\"check_sets1\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sets1.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sets1.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sets1.png\" alt=\"\" class=\"wp-image-39967\"\/><\/figure>\n<p>CPUID with EAX=40000000 (<a rel=\"noreferrer noopener\" aria-label=\"a  check for Hypervisor's Brand (opens in a new tab)\" href=\"https:\/\/rayanfam.com\/topics\/defeating-malware-anti-vm-techniques-cpuid-based-instructions\/\" target=\"_blank\">a check for Hypervisor&#8217;s Brand<\/a>):<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39933\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/cpuid_check1\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_check1.png\" data-orig-size=\"391,66\" 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=\"cpuid_check1\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_check1-300x51.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_check1.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_check1.png\" alt=\"\" class=\"wp-image-39933\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_check1.png 391w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_check1-300x51.png 300w\" sizes=\"(max-width: 391px) 100vw, 391px\" \/><\/figure>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39934\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/cpuid_2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_2.png\" data-orig-size=\"272,107\" 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=\"cpuid_2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_2.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_2.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/cpuid_2.png\" alt=\"\" class=\"wp-image-39934\"\/><\/figure>\n<p>The VMWAre I\/O Port (more details [<a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/handlers.sans.org\/tliston\/ThwartingVMDetection_Liston_Skoudis.pdf\" target=\"_blank\">here<\/a>]):<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39931\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/vmware_in-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vmware_in-1.png\" data-orig-size=\"405,106\" 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=\"vmware_in\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vmware_in-1-300x79.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vmware_in-1.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vmware_in-1.png\" alt=\"\" class=\"wp-image-39931\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vmware_in-1.png 405w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vmware_in-1-300x79.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vmware_in-1-400x106.png 400w\" sizes=\"(max-width: 405px) 100vw, 405px\" \/><\/figure>\n<p>VPCEXT instruction (more details [<a rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\" href=\"https:\/\/shasaurabh.blogspot.com\/2017\/07\/virtual-machine-detection-techniques.html\" target=\"_blank\">here<\/a>])<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39932\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/vpcext_based\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vpcext_based.png\" data-orig-size=\"394,93\" 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=\"vpcext_based\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vpcext_based-300x71.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vpcext_based.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vpcext_based.png\" alt=\"\" class=\"wp-image-39932\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vpcext_based.png 394w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/vpcext_based-300x71.png 300w\" sizes=\"(max-width: 394px) 100vw, 394px\" \/><\/figure>\n<p>Checking <a rel=\"noreferrer noopener\" aria-label=\"the list of common VM vendors (opens in a new tab)\" href=\"https:\/\/wiki.osdev.org\/CPUID\" target=\"_blank\">the list of common VM vendors<\/a>:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39968\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/check_vm2-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_vm2-1.png\" data-orig-size=\"511,482\" 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=\"check_vm2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_vm2-1-300x283.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_vm2-1.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_vm2-1.png\" alt=\"\" class=\"wp-image-39968\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_vm2-1.png 511w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_vm2-1-300x283.png 300w\" sizes=\"(max-width: 511px) 100vw, 511px\" \/><\/figure>\n<p>Checking the BIOS versions typical for virtual environments:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_reg_keys.png\" data-rel=\"lightbox-9\" title=\"\"><img decoding=\"async\" data-attachment-id=\"39969\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/check_reg_keys\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_reg_keys.png\" data-orig-size=\"1067,590\" 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=\"check_reg_keys\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_reg_keys-300x166.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_reg_keys-600x332.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_reg_keys.png\" alt=\"\" class=\"wp-image-39969\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_reg_keys.png 1067w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_reg_keys-300x166.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_reg_keys-600x332.png 600w\" sizes=\"(max-width: 1067px) 100vw, 1067px\" \/><\/a><\/figure>\n<p>Detection of any of the features suggesting a VM results in termination of the component.<\/p>\n<h4>Downloading new modules<\/h4>\n<p>The next elements of HiddenBee are downloaded over the custom &#8220;STLP&#8221; protocol. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"40034\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/check_sltp_protocol\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sltp_protocol.png\" data-orig-size=\"310,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=\"check_sltp_protocol\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sltp_protocol-300x128.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sltp_protocol.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sltp_protocol.png\" alt=\"\" class=\"wp-image-40034\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sltp_protocol.png 310w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/check_sltp_protocol-300x128.png 300w\" sizes=\"(max-width: 310px) 100vw, 310px\" \/><\/figure>\n<p>The raw TCP socket created to communicate using the SLTP protocol:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"40037\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/sltp_socket-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/sltp_socket-1.png\" data-orig-size=\"791,664\" 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=\"sltp_socket\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/sltp_socket-1-300x252.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/sltp_socket-1-600x504.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/sltp_socket-1.png\" alt=\"\" class=\"wp-image-40037\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/sltp_socket-1.png 791w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/sltp_socket-1-300x252.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/sltp_socket-1-600x504.png 600w\" sizes=\"(max-width: 791px) 100vw, 791px\" \/><\/figure>\n<p>The communication is encrypted. We can see that the expected output is a shellcode that is loaded and executed:<\/p>\n<figure class=\"wp-block-image\"><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_new_module-1.png\" data-rel=\"lightbox-10\" title=\"\"><img decoding=\"async\" data-attachment-id=\"39970\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/load_new_module-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_new_module-1.png\" data-orig-size=\"813,648\" 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_new_module\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_new_module-1-300x239.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_new_module-1-600x478.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_new_module-1.png\" alt=\"\" class=\"wp-image-39970\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_new_module-1.png 813w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_new_module-1-300x239.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/load_new_module-1-600x478.png 600w\" sizes=\"(max-width: 813px) 100vw, 813px\" \/><\/a><\/figure>\n<p>The way in which it is loaded reminds me of the elements we described recently in &#8220;<a rel=\"noreferrer noopener\" aria-label=\"Hidden Bee - let's go down the rabbit hole (opens in a new tab)\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/05\/hidden-bee-lets-go-down-the-rabbit-hole\/\" target=\"_blank\">Hidden Bee: Let&#8217;s go down the rabbit hole<\/a>&#8220;. The current module loads a list of functions that will be passed to the next module. It is a minimalistic, custom version of Import Table. It also passes the memory with the downloaded filesystem to be used for further loading of components.<\/p>\n<h3 id=\"mce_22\">The !rcx package<\/h3>\n<p>This element retrieves the custom filesystem used by this malware. As we know from previous analysis, Hidden Bee uses its own, custom filesystems that are mounted in the memory of the malware and passed to its components. This filesystem is important for the execution flow because it contains many other components that are supposed to be installed on the attacked system in order to continue the infection.<\/p>\n<p>As mentioned before, unpacking the JPG gave us an !rcx package. After this package is downloaded, and its SHA256 checksum is validated, it is repackaged. First, at the end of the !rcx package, the list of URLs (JPG, PNG) from the previous module is copied. Then, the ARIA key is copied. The size of the module and its SHA256 hash are updated. Then, the execution is redirected to the first stage shellcode fetched from the !rcx.<\/p>\n<p>This shellcode was the one that we saw at first, after decoding the !rcx package from the JPG. Yet, looking at this part, we do not see anything malicious. The elements that are more important are well protected and revealed at the next execution stages.<\/p>\n<p>The shellcode from the !rcx package is executed in two stages. The first one unpacks and prepares the second. First, it loads its own imports using hardcoded names of libraries.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39974\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/hardcoded_names-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/hardcoded_names-1.png\" data-orig-size=\"302,244\" 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=\"hardcoded_names\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/hardcoded_names-1-300x242.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/hardcoded_names-1.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/hardcoded_names-1.png\" alt=\"\" class=\"wp-image-39974\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/hardcoded_names-1.png 302w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/hardcoded_names-1-300x242.png 300w\" sizes=\"(max-width: 302px) 100vw, 302px\" \/><\/figure>\n<p>The checksums of the functions that are going to be used are stored in the module and compared with the names calculated by the function: <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39972\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/checksum_algo\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/checksum_algo.png\" data-orig-size=\"424,292\" 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=\"checksum_algo\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/checksum_algo-300x207.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/checksum_algo.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/checksum_algo.png\" alt=\"\" class=\"wp-image-39972\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/checksum_algo.png 424w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/checksum_algo-300x207.png 300w\" sizes=\"(max-width: 424px) 100vw, 424px\" \/><figcaption>The checksum calculation algorithm<\/figcaption><\/figure>\n<p>It uses the functions from kernel32.dll: GetProcessHeap, VirtualAlloc, VirtualFree, and from ntdll.dll: RtlAllocateHeap, RtlFreeHeap, NtQueryInformationProcess.<\/p>\n<p>The repackaged !rcx module is supposed to be supplied as one of the arguments at the Entry Point of the first shellcode. It is most important because the second stage shellcode will be unpacked from the supplied !rcx package.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"38759\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/rcx_arg-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_arg-1.png\" data-orig-size=\"323,114\" 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=\"rcx_arg\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_arg-1-300x106.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_arg-1.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_arg-1.png\" alt=\"\" class=\"wp-image-38759\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_arg-1.png 323w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/05\/rcx_arg-1-300x106.png 300w\" sizes=\"(max-width: 323px) 100vw, 323px\" \/><figcaption>Checking the !rcx magic (first stage shellcode)<\/figcaption><\/figure>\n<p> A new memory area is allocated, and the second stage shellcode is unpacked there.<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39976\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decode_and_call_next\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_call_next.png\" data-orig-size=\"856,559\" 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=\"decode_and_call_next\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_call_next-300x196.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_call_next-600x392.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_call_next.png\" alt=\"\" class=\"wp-image-39976\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_call_next.png 856w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_call_next-300x196.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decode_and_call_next-600x392.png 600w\" sizes=\"(max-width: 856px) 100vw, 856px\" \/><figcaption>Decoding and calling next module<\/figcaption><\/figure>\n<p>Inside the second shellcode, we see strings referencing further components of the Hidden Bee malware:<\/p>\n<p><code> \/bin\/i386\/preload<br \/> \/bin\/i386\/coredll.bin <\/code><\/p>\n<p>The role of the second stage is unpacking another part from the !rcx: an !rdx package. <\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"40022\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decrypt_rdx_func\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_func.png\" data-orig-size=\"614,470\" 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=\"decrypt_rdx_func\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_func-300x230.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_func-600x459.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_func.png\" alt=\"\" class=\"wp-image-40022\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_func.png 614w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_func-300x230.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_func-600x459.png 600w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/figure>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"39975\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/rdx_check\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rdx_check.png\" data-orig-size=\"309,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=\"rdx_check\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rdx_check-300x86.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rdx_check.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rdx_check.png\" alt=\"\" class=\"wp-image-39975\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rdx_check.png 309w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/rdx_check-300x86.png 300w\" sizes=\"(max-width: 309px) 100vw, 309px\" \/><figcaption>Checking the !rdx magic (second stage shellcode)<\/figcaption><\/figure>\n<p>From our previous experience, we know that the !rdx package is a custom filesystem containing modules. Indeed, after the decryption is complete, the custom filesystem is revealed:<\/p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" data-attachment-id=\"40019\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/attachment\/decrypt_rdx_filesystem\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_filesystem.png\" data-orig-size=\"478,723\" 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=\"decrypt_rdx_filesystem\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_filesystem-198x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_filesystem-397x600.png\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_filesystem.png\" alt=\"\" class=\"wp-image-40019\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_filesystem.png 478w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_filesystem-198x300.png 198w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/decrypt_rdx_filesystem-397x600.png 397w\" sizes=\"(max-width: 478px) 100vw, 478px\" \/><\/figure>\n<p>So the part that was hidden in the JPG is, in reality, a package that decrypts the custom filesystem and deploys the next stage modules: <code>\/bin\/i386\/preload<\/code> and <code>\/bin\/i386\/coredll.bin<\/code>. This filesystem has even more elements that are loaded at later stages of the infection. Their full functionality will be described in the next article in our series.<\/p>\n<h3>Even more hidden<\/h3>\n<p>From the beginning, Hidden Bee malware has been well designed and innovative. Looking at one year of its evolution, we can be sure that the authors are serious about making it even more stealthy\u2014and they don&#8217;t stop improving it.<\/p>\n<p>Although the initial dropper uses components analogous to ones observed in the past, revealing their encrypted content now takes many more steps and much more patience. The additional difficulty in the analysis is introduced by the fact that the URLs and encryption keys are never reused, and work only for a single session.<\/p>\n<p>The team behind this malware is skilled and determined. We expect that the Hidden Bee malware won&#8217;t be going extinct anytime soon.<\/p>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/\">The Hidden Bee infection chain, part 1: the stegano pack<\/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\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/\" target=\"bwo\" >https:\/\/blog.malwarebytes.com\/feed\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><strong>Credit to Author: hasherezade| Date: Thu, 15 Aug 2019 15:26:55 +0000<\/strong><\/p>\n<table cellpadding='10'>\n<tr>\n<td valign='top' align='center'><a href='https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/' title='The Hidden Bee infection chain, part 1: the stegano pack'><img src='https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2019\/08\/shutterstock_1468118333.jpg' border='0'  width='300px'  \/><\/a><\/td>\n<\/tr>\n<tr>\n<td valign='top' align='left'>The Hidden Bee cryptominer has a complex and multi-layered internal structure that is unusual among cybercrime toolkits. That&#8217;s why we&#8217;re dedicating a series of posts to exploring its elements and updates made during one year of its evolution. <\/p>\n<p>Categories: <\/p>\n<ul class=\"post-categories\">\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\/cryptominers\/\" rel=\"tag\">cryptominers<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/custom-code\/\" rel=\"tag\">custom code<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/exploit-kits\/\" rel=\"tag\">exploit kits<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/exploits\/\" rel=\"tag\">exploits<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/hidden-bee\/\" rel=\"tag\">hidden bee<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/infection-chain\/\" rel=\"tag\">infection chain<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/infection-vector\/\" rel=\"tag\">infection vector<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/malware-modules\/\" rel=\"tag\">malware modules<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/miner\/\" rel=\"tag\">miner<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/miners\/\" rel=\"tag\">miners<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/obfuscation\/\" rel=\"tag\">obfuscation<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/payloads\/\" rel=\"tag\">payloads<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/underminer\/\" rel=\"tag\">Underminer<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/underminer-ek\/\" rel=\"tag\">Underminer EK<\/a><\/p>\n<table width='100%'>\n<tr>\n<td align=right>\n<p><b>(<a href='https:\/\/blog.malwarebytes.com\/threat-analysis\/2019\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/' title='The Hidden Bee infection chain, part 1: the stegano pack'>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\/08\/the-hidden-bee-infection-chain-part-1-the-stegano-pack\/\">The Hidden Bee infection chain, part 1: the stegano pack<\/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":[15826,22673,10528,10987,19070,22674,20255,22675,16398,15902,12039,17773,10494,19148,19948],"class_list":["post-16082","post","type-post","status-publish","format-standard","hentry","category-malwarebytes","category-security","tag-cryptominers","tag-custom-code","tag-exploit-kits","tag-exploits","tag-hidden-bee","tag-infection-chain","tag-infection-vector","tag-malware-modules","tag-miner","tag-miners","tag-obfuscation","tag-payloads","tag-threat-analysis","tag-underminer","tag-underminer-ek"],"_links":{"self":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/16082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/comments?post=16082"}],"version-history":[{"count":0,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/16082\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=16082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=16082"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=16082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}