{"id":12398,"date":"2018-05-25T08:10:06","date_gmt":"2018-05-25T16:10:06","guid":{"rendered":"https:\/\/www.palada.net\/index.php\/2018\/05\/25\/news-6167\/"},"modified":"2018-05-25T08:10:06","modified_gmt":"2018-05-25T16:10:06","slug":"news-6167","status":"publish","type":"post","link":"http:\/\/www.palada.net\/index.php\/2018\/05\/25\/news-6167\/","title":{"rendered":"Malware analysis: decoding Emotet, part 1"},"content":{"rendered":"<p><strong>Credit to Author: Vishal Thakur| Date: Fri, 25 May 2018 15:00:00 +0000<\/strong><\/p>\n<p>Emotet Banking Trojan malware has been around for quite some time now. As such, infosec researchers have made several attempts to develop tools to de-obfuscate and even decrypt the AES-encrypted code belonging to this malware.<\/p>\n<p>The problem with these tools is that they target active versions of the malware. They run into problems when the authors of the malware change the code. The change could be anything from slight variations to the code structure to drastic changes such as moving from a VBA project to PowerShell scripting.\u00a0Usually, even a minor code variation breaks the tools.<\/p>\n<p>The main goal of this article is to help readers understand the structure and flow of Emotet in detail, so that code variations do not pose challenges to analysts who are trying to decode it in the future. We will also take a deep dive into some important parts of the code itself in order to understand the execution in a detailed, step-by-step process.<\/p>\n<p>In the first part of this two-part analysis, we look at the VBA code, where you&#8217;ll learn how to recognize and discard &#8220;dead&#8221; code thrown in to complicate the analysis process. We also look at techniques that can be used to extract the obfuscated commands, and how the code executes.<\/p>\n<h3>Emotet overview<\/h3>\n<p>For the purpose of our analysis, we&#8217;re taking a look at <a href=\"https:\/\/www.virustotal.com\/#\/file\/707fedfeadbfa4248cfc6711b5a0b98e1684cd37a6e0544e9b7bde4b86096963\/detection\" target=\"_blank\" rel=\"noopener\">this sample<\/a>:<\/p>\n<p>File: PAYMENT 225EWF.doc<\/p>\n<p>MD5: e8e468710c0a4f0906305c435a761902<\/p>\n<p>SHA-256: 707fedfeadbfa4248cfc6711b5a0b98e1684cd37a6e0544e9b7bde4b86096963<\/p>\n<p>The current version of the Emotet downloader uses PowerShell to execute final commands.\u00a0The infection vector is a traditional email phishing campaign. The phish would contain a link that the victim is supposed to click on, which in turn would start the download of the malware. The malware is usually a Word document, which prompts the victim to enable macros. Once the macros are enabled, the VBA executes in the background, and the payload is downloaded and executed on the victim\u2019s computer.<\/p>\n<h3>VBA code<\/h3>\n<p>Let\u2019s take a quick look at how we can access the VBA code from the infected Microsoft Word document. In order to enable the Developer view in Word, go to File and select &#8220;Options.&#8221; In Options, click on &#8220;Customize Ribbon.&#8221; Enable the &#8220;Developer&#8221; option and hit OK.<\/p>\n<p>This should now get you a &#8220;Developer&#8221; item in the top menu bar. Once you click on &#8220;Developer,&#8221; you\u2019ll see the option &#8220;Visual Basic.&#8221;<\/p>\n<p>Click on Visual Basic and you\u2019ll be presented with the entire project in a separate window. We can now start analyzing the code.<\/p>\n<p><span class=\"s1\">Alternatively, we can use an automated way of extracting this Powershell script by running the document in a VM and checking the parameters with which the Powershell was deployed, i.e. with the help of ProcessExplorer. Also, sandboxes such as <a href=\"https:\/\/www.hybrid-analysis.com\/sample\/2b06d4b5091f7c657efe1aa0d643f65f4d497c3fda1a00c64fadd14f7f65fb3a?environmentId=100\" target=\"_blank\" rel=\"noopener\">Hybrid Analysis<\/a> extract it automatically.\u00a0<\/span><\/p>\n<h4>Code execution<\/h4>\n<p>Once the <a href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2015\/10\/beware-of-doc-a-look-on-malicious-macros\/\" target=\"_blank\" rel=\"noopener\">&#8220;content&#8221; is enabled (macros)<\/a>, the execution starts.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23878\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/vbacode\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/Vbacode.png\" data-orig-size=\"962,762\" 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=\"Vbacode\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/Vbacode-300x238.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/Vbacode-600x475.png\" class=\"aligncenter wp-image-23878 size-full\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/Vbacode.png\" alt=\"\" width=\"962\" height=\"762\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/Vbacode.png 962w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/Vbacode-300x238.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/Vbacode-600x475.png 600w\" sizes=\"auto, (max-width: 962px) 100vw, 962px\" \/><\/p>\n<p>The VBA code comes as part of the malicious MS Office document. As soon as the macros are enabled, the code executes in the background.<\/p>\n<p>As an attempt at obfuscating the code, the developers have included a lot of text that is not used. Only part of the entire code is usable, and it is quite well hidden.<\/p>\n<p>A faster way to get straight into the code is to start at the macro code that is called for execution of the initial commands. In the case of the sample analyzed here, it is the Sub AutoOpen(). We start by following this sub procedure.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23879\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/subpicture\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/subpicture.png\" data-orig-size=\"974,212\" 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=\"subpicture\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/subpicture-300x65.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/subpicture-600x131.png\" class=\"aligncenter wp-image-23879 size-full\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/subpicture.png\" alt=\"\" width=\"974\" height=\"212\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/subpicture.png 974w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/subpicture-300x65.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/subpicture-600x131.png 600w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/p>\n<p>We will now discard all the useless code that has been included in the sub to complicate analysis.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23880\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/goodcode\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/goodcode.png\" data-orig-size=\"564,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=\"goodcode\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/goodcode-300x55.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/goodcode.png\" class=\"aligncenter wp-image-23880 size-full\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/goodcode.png\" alt=\"\" width=\"564\" height=\"104\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/goodcode.png 564w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/goodcode-300x55.png 300w\" sizes=\"auto, (max-width: 564px) 100vw, 564px\" \/><\/p>\n<p>We can see at the end of the sub procedure, the Application.run method is called:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23881\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/apprun\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/apprun.png\" data-orig-size=\"625,56\" 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=\"apprun\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/apprun-300x27.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/apprun-600x54.png\" class=\"aligncenter size-large wp-image-23881\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/apprun-600x54.png\" alt=\"\" width=\"600\" height=\"54\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/apprun-600x54.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/apprun-300x27.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/apprun.png 625w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>To execute the method shown above, we can see that the method calls on a sub and a function.<\/p>\n<p>First, we take a look at sub <strong>ndUzTzJ<\/strong>.<\/p>\n<p>This sub again has some useless text that is just there to add complexity for the purposes of analysis. We will focus on usable code only.<\/p>\n<p>This is what the sub should look like after we\u2019ve discarded the useless code:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23882\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/sub\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sub.png\" data-orig-size=\"729,135\" 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=\"sub\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sub-300x56.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sub-600x111.png\" class=\"aligncenter size-large wp-image-23882\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sub-600x111.png\" alt=\"\" width=\"600\" height=\"111\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sub-600x111.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sub-300x56.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sub.png 729w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>vbHide will be assigned a value of 0, which means the window is hidden and focus is passed to the hidden window.<\/p>\n<p>DsPBkKtzcIwF &#8211; generates the command.<\/p>\n<p>ndUzTzJ &#8211; calls WScript.Shell to execute the command.<\/p>\n<p>Let\u2019s take a look at a section of the Function DsPBkKtzcIwF():<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-23883\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-600x70.png\" alt=\"\" width=\"600\" height=\"70\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-600x70.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-300x35.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-965x114.png 965w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function.png 974w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-23883\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-600x70.png\" alt=\"\" width=\"600\" height=\"70\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-600x70.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-300x35.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-965x114.png 965w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function.png 974w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23883\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/function-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function.png\" data-orig-size=\"974,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=\"function\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-300x35.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-600x70.png\" class=\"aligncenter size-full wp-image-23883\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function.png\" alt=\"\" width=\"974\" height=\"114\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function.png 974w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-300x35.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-600x70.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function-965x114.png 965w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/p>\n<p>In the code snippet above, we can see a few notable things:<\/p>\n<p>Variables are being used to store assigned values. The values will then be passed to a different function, yy222222222222222y(), for processing. Once processed, the values are then assigned to different variables again and these variables will be used to construct the encrypted code that will be passed onto the system for decryption using PowerShell.<\/p>\n<h3>Deep dive<\/h3>\n<p>Let\u2019s take a deep dive here and closely analyze the code:<\/p>\n<p>JMArl = &#8220;zahajUZomiAjVADEAMAA4ADMdpokrTZ&#8221;<\/p>\n<p>Variable JMArl is assigned the value of \u201czahajUZomiAjVADEAMAA4ADMdpokrTZ\u201d<\/p>\n<p>szFqp = sRWNiPRldXLv = 21790 + 2115454 * PhcMjZjwl &#8211; CLng(8712932) \/ (zunFnTXk &#8211; Sqr(1328634 * Oct(7463260) &#8211; 1977628 &#8211; 4976151) * (294265 \/ XiFEWH))<\/p>\n<p>vLkhkiRclJ = GcDcX = 3122978 + 1398811 * JTkURPW &#8211; CLng(9593915) \/ (krXPEiFIa &#8211; Sqr(1266549 * Oct(1775652) &#8211; 8314095 &#8211; 5625841) * (8872696 \/ mNsSkdPD))<\/p>\n<p>This code is not usable\u2014we will discard it.<\/p>\n<p>sEVQo = IjKrpJC + yy222222222222222y(JMArl, 14, 11)<\/p>\n<p>This is where most of the action takes place. The variable sEVQo is assigned the value of the output of \u201cIjKrpJC + yy222222222222222y(JMArl, 14, 11)\u201d<\/p>\n<p>\u201cIjKrpJC\u201d doesnt serve any purpose, we will discard it.<\/p>\n<p>yy222222222222222y() is the function being called. Let\u2019s take a look at the function itself:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23885\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/function2-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function2.png\" data-orig-size=\"974,224\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"function2\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function2-300x69.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function2-600x138.png\" class=\"aligncenter wp-image-23885 size-full\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function2.png\" alt=\"\" width=\"974\" height=\"224\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function2.png 974w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function2-300x69.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/function2-600x138.png 600w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/p>\n<p>Now, let\u2019s get rid of all the garbage code from the function and then have another look at it:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23886\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/garbagecode\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/garbagecode.png\" data-orig-size=\"887,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=\"garbagecode\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/garbagecode-300x62.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/garbagecode-600x124.png\" class=\"aligncenter wp-image-23886 size-full\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/garbagecode.png\" alt=\"\" width=\"887\" height=\"183\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/garbagecode.png 887w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/garbagecode-300x62.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/garbagecode-600x124.png 600w\" sizes=\"auto, (max-width: 887px) 100vw, 887px\" \/><\/p>\n<p>The function calls on the Mid function, which processes the data for further use.<\/p>\n<h4>Mid function<\/h4>\n<p>hPoMiTjfoDT is the TEXT; twOYMDvfbGk is the START_POSITION; VSTcawBYGW is the NUMBER_OF_CHARACTERS<\/p>\n<p>Now that we understand how the code flow has been structured, let\u2019s take a look at how the program executes.<\/p>\n<p>Here\u2019s the variable sEVQo\u00a0 before it has been assigned any value:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23887\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/sevq\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sevq.png\" data-orig-size=\"641,193\" 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=\"sevq\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sevq-300x90.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sevq-600x181.png\" class=\"aligncenter size-large wp-image-23887\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sevq-600x181.png\" alt=\"\" width=\"600\" height=\"181\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sevq-600x181.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sevq-300x90.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/sevq.png 641w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>sEVQo now calls on yy222222222222222y(). We can see that the value \u201c14\u201d has been passed on to the function variable \u201ctwOYMDvfbGk\u201d:<\/p>\n<p>sEVQo = IjKrpJC + yy222222222222222y(JMArl, 14, 11)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23888\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/anotherpic\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/anotherpic.png\" data-orig-size=\"974,112\" 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=\"anotherpic\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/anotherpic-300x34.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/anotherpic-600x69.png\" class=\"aligncenter size-large wp-image-23888\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/anotherpic-600x69.png\" alt=\"\" width=\"600\" height=\"69\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/anotherpic-600x69.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/anotherpic-300x34.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/anotherpic-965x112.png 965w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/anotherpic.png 974w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Moving on, we can see the value \u201c11\u201d has been passed on to the function variable \u201cVSTcawBYGW\u201d:<\/p>\n<p>sEVQo = IjKrpJC + yy222222222222222y(JMArl, 14, 11)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23889\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/pic3\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic3.png\" data-orig-size=\"974,108\" 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=\"pic3\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic3-300x33.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic3-600x67.png\" class=\"aligncenter size-large wp-image-23889\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic3-600x67.png\" alt=\"\" width=\"600\" height=\"67\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic3-600x67.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic3-300x33.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic3-965x108.png 965w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic3.png 974w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Finally, the text string will be passed on to the variable mbPRLWAjZ, which is EMPTY at first:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23890\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/pic4\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic4.png\" data-orig-size=\"974,102\" 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=\"pic4\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic4-300x31.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic4-600x63.png\" class=\"aligncenter size-large wp-image-23890\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic4-600x63.png\" alt=\"\" width=\"600\" height=\"63\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic4-600x63.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic4-300x31.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic4-965x102.png 965w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic4.png 974w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23891\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/pic5\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic5.png\" data-orig-size=\"974,120\" 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=\"pic5\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic5-300x37.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic5-600x74.png\" class=\"aligncenter size-large wp-image-23891\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic5-600x74.png\" alt=\"\" width=\"600\" height=\"74\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic5-600x74.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic5-300x37.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic5-965x120.png 965w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/pic5.png 974w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Now, this data will be processed using the Mid function, as described above.<\/p>\n<p>Let\u2019s take a look at how that unfolds:<\/p>\n<p>mbPRLWAjZ= zahajUZomiAjVADEAMAA4ADMdpokrTZ<\/p>\n<p>twOYMDvfbGk= 14<\/p>\n<p>VSTcawBYGW= 11<\/p>\n<p>Mid(hPoMiTjfoDT, twOYMDvfbGk, VSTcawBYGW):<\/p>\n<p>Mid(\u201czahajUZomiAjVADEAMAA4ADMdpokrTZ\u201d, 14, 11)<\/p>\n<p>It should translate to:<\/p>\n<p><strong>ADEAMAA4AD <\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23892\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/14th\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/14th.png\" data-orig-size=\"595,158\" 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=\"14th\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/14th-300x80.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/14th.png\" class=\"aligncenter size-full wp-image-23892\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/14th.png\" alt=\"\" width=\"595\" height=\"158\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/14th.png 595w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/14th-300x80.png 300w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/p>\n<p><strong>\u00a0<\/strong>Now let\u2019s take a look at the function in execution again:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23893\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/fun\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fun.png\" data-orig-size=\"702,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=\"fun\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fun-300x65.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fun-600x130.png\" class=\"aligncenter size-large wp-image-23893\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fun-600x130.png\" alt=\"\" width=\"600\" height=\"130\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fun-600x130.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fun-300x65.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fun.png 702w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>And it will be passed back to the calling variable:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23894\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/callingvariable\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/callingvariable.png\" data-orig-size=\"754,208\" 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=\"callingvariable\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/callingvariable-300x83.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/callingvariable-600x166.png\" class=\"aligncenter size-large wp-image-23894\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/callingvariable-600x166.png\" alt=\"\" width=\"600\" height=\"166\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/callingvariable-600x166.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/callingvariable-300x83.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/callingvariable.png 754w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>And now the value for the variable sEVQo has been assigned to <strong>ADEAMAA4AD.\u00a0<\/strong>That was a look at one of the many variables that were used in this function.<\/p>\n<p>To see how it all flows into the end result for this value, we can take a look at the final assignment of the variable:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23895\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/variable-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/variable.png\" data-orig-size=\"974,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=\"variable\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/variable-300x61.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/variable-600x121.png\" class=\"aligncenter wp-image-23895 size-full\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/variable.png\" alt=\"\" width=\"974\" height=\"197\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/variable.png 974w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/variable-300x61.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/variable-600x121.png 600w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/p>\n<p>The value assigned to DsPBkKtzcIwF after the above line of code is executed is the command that will be executed by sub ndUzTzJ:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23896\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/11-4\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/11.png\" data-orig-size=\"827,143\" 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=\"11\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/11-300x52.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/11-600x104.png\" class=\"aligncenter size-full wp-image-23896\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/11.png\" alt=\"\" width=\"827\" height=\"143\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/11.png 827w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/11-300x52.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/11-600x104.png 600w\" sizes=\"auto, (max-width: 827px) 100vw, 827px\" \/><\/p>\n<p>We can now print the output to screen (using MsgBox) to have a quick look or to the immediate window (using Debug.Print) for a complete result.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23897\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/bigboy\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/bigboy.png\" data-orig-size=\"974,402\" 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=\"bigboy\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/bigboy-300x124.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/bigboy-600x248.png\" class=\"aligncenter size-full wp-image-23897\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/bigboy.png\" alt=\"\" width=\"974\" height=\"402\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/bigboy.png 974w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/bigboy-300x124.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/bigboy-600x248.png 600w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23898\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/fuck\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fuck.png\" data-orig-size=\"974,220\" 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=\"fuck\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fuck-300x68.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fuck-600x136.png\" class=\"aligncenter size-full wp-image-23898\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fuck.png\" alt=\"\" width=\"974\" height=\"220\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fuck.png 974w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fuck-300x68.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/fuck-600x136.png 600w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/p>\n<p>Here\u2019s the part of the command from above that invokes PowerShell:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23899\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/eeeennnd\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/eeeennnd.png\" data-orig-size=\"974,239\" 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=\"eeeennnd\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/eeeennnd-300x74.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/eeeennnd-600x147.png\" class=\"aligncenter size-full wp-image-23899\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/eeeennnd.png\" alt=\"\" width=\"974\" height=\"239\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/eeeennnd.png 974w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/eeeennnd-300x74.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/eeeennnd-600x147.png 600w\" sizes=\"auto, (max-width: 974px) 100vw, 974px\" \/><\/p>\n<p>Which should translate (look at the highlighted text) to:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"23900\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/attachment\/tinypic\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/tinypic.png\" data-orig-size=\"389,70\" 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=\"tinypic\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/tinypic-300x54.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/tinypic.png\" class=\"aligncenter size-full wp-image-23900\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/tinypic.png\" alt=\"\" width=\"389\" height=\"70\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/tinypic.png 389w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/tinypic-300x54.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/p>\n<p>That was a look at how to get the final command with the encrypted data out of the VBA code. In part two of this series, we&#8217;ll decrypt this data to extract the stage two payload URLs from it.<\/p>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/\">Malware analysis: decoding Emotet, part 1<\/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\/2018\/05\/malware-analysis-decoding-emotet-part-1\/\" target=\"bwo\" >https:\/\/blog.malwarebytes.com\/feed\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><strong>Credit to Author: Vishal Thakur| Date: Fri, 25 May 2018 15:00:00 +0000<\/strong><\/p>\n<table cellpadding='10'>\n<tr>\n<td valign='top' align='center'><a href='https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/' title='Malware analysis: decoding Emotet, part 1'><img src='https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/05\/shutterstock_248596792.jpg' border='0'  width='300px'  \/><\/a><\/td>\n<\/tr>\n<tr>\n<td valign='top' align='left'>In the first part of this two-part analysis of Emotet, we look at the VBA code, where you&#8217;ll learn how to recognize and discard &#8220;dead&#8221; code thrown in to complicate the analysis process.<\/p>\n<p>Categories: <\/p>\n<ul class=\"post-categories\">\n<li><a href=\"https:\/\/blog.malwarebytes.com\/category\/threat-analysis\/malware-threat-analysis\/\" rel=\"category tag\">Malware<\/a><\/li>\n<li><a href=\"https:\/\/blog.malwarebytes.com\/category\/threat-analysis\/\" rel=\"category tag\">Threat analysis<\/a><\/li>\n<\/ul>\n<p>Tags: <a href=\"https:\/\/blog.malwarebytes.com\/tag\/code-variation\/\" rel=\"tag\">code variation<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/emotet\/\" rel=\"tag\">emotet<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/macros\/\" rel=\"tag\">macros<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/malware-analysis\/\" rel=\"tag\">malware analysis<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/vba-code\/\" rel=\"tag\">vba code<\/a><\/p>\n<table width='100%'>\n<tr>\n<td align=right>\n<p><b>(<a href='https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/05\/malware-analysis-decoding-emotet-part-1\/' title='Malware analysis: decoding Emotet, part 1'>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\/2018\/05\/malware-analysis-decoding-emotet-part-1\/\">Malware analysis: decoding Emotet, part 1<\/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":[18523,15715,10796,3764,16466,10494,18524],"class_list":["post-12398","post","type-post","status-publish","format-standard","hentry","category-malwarebytes","category-security","tag-code-variation","tag-emotet","tag-macros","tag-malware","tag-malware-analysis","tag-threat-analysis","tag-vba-code"],"_links":{"self":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/12398","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=12398"}],"version-history":[{"count":0,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/12398\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=12398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=12398"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=12398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}