{"id":13802,"date":"2018-11-12T08:10:05","date_gmt":"2018-11-12T16:10:05","guid":{"rendered":"http:\/\/www.palada.net\/index.php\/2018\/11\/12\/news-7569\/"},"modified":"2018-11-12T08:10:05","modified_gmt":"2018-11-12T16:10:05","slug":"news-7569","status":"publish","type":"post","link":"https:\/\/www.palada.net\/index.php\/2018\/11\/12\/news-7569\/","title":{"rendered":"What&#8217;s new in TrickBot? Deobfuscating elements"},"content":{"rendered":"<p><strong>Credit to Author: hasherezade| Date: Mon, 12 Nov 2018 15:00:22 +0000<\/strong><\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/detections\/trojan-trickbot\/\" target=\"_blank\" rel=\"noopener\">Trojan.TrickBot<\/a> has been present in the threat landscape from quite a while. We wrote about its first version <a href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2016\/10\/trick-bot-dyrezas-successor\/\" target=\"_blank\" rel=\"noopener\">in October 2016<\/a>. From the beginning, it was a well organized modular malware, written by developers with mature skills. It is often called a banker, however its modular structure allows to freely add new functionalities without modifying the core bot. In fact, the functionality of a banker is represented just by one of <a href=\"https:\/\/www.webroot.com\/blog\/2018\/03\/21\/trickbot-banking-trojan-adapts-new-module\/\" target=\"_blank\" rel=\"noopener\">many of its modules<\/a>.<\/p>\n<p>With time, developers extended TrickBot capabilities by implementing new modules &#8211; for example, the one for <a href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2017\/08\/trickbot-comes-with-new-tricks-attacking-outlook-and-browsing-data\/\" target=\"_blank\" rel=\"noopener\">stealing Outlook credentials<\/a>. But the evolution of the core bot, that was used for the deployment of those modules, was rather slow. The scripts written to decode modules from the first version worked till recent months, showing that the encryption schema used to protect them stayed unchanged.<\/p>\n<p>October 2018 marks end of the second year since TrickBot&#8217;s appearance. Possibly the authors decided to celebrate the anniversary by a makeover of some significant elements of the core.<\/p>\n<p>This post will be an analysis of the updated obfuscation used by TrickBot&#8217;s main module.<\/p>\n<h3>Behavioral analysis<\/h3>\n<p>The latest TrickBot starts its actions from disabling Windows Defender&#8217;s real-time monitoring. It is done by deploying a PowerShell command:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26051\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/trick_disable_defender\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_disable_defender.png\" data-orig-size=\"447,262\" 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=\"trick_disable_defender\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_disable_defender-300x176.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_disable_defender.png\" class=\"alignnone size-full wp-image-26051\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_disable_defender.png\" alt=\"\" width=\"447\" height=\"262\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_disable_defender.png 447w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_disable_defender-300x176.png 300w\" sizes=\"auto, (max-width: 447px) 100vw, 447px\" \/><\/p>\n<p>After that, we can observe behaviors typical for TrickBot.<\/p>\n<p>As before, the main bot deploys multiple instances of svchost, where it injects the modules.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25936\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/trick_working\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_working.png\" data-orig-size=\"690,96\" 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=\"trick_working\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_working-300x42.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_working-600x83.png\" class=\"alignnone size-full wp-image-25936\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_working.png\" alt=\"\" width=\"690\" height=\"96\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_working.png 690w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_working-300x42.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_working-600x83.png 600w\" sizes=\"auto, (max-width: 690px) 100vw, 690px\" \/><\/p>\n<p>Persistence is achieved by adding a scheduled task:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25934\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/trick_task\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_Task.png\" data-orig-size=\"728,236\" 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=\"trick_Task\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_Task-300x97.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_Task-600x195.png\" class=\"alignnone size-full wp-image-25934\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_Task.png\" alt=\"\" width=\"728\" height=\"236\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_Task.png 728w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_Task-300x97.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/trick_Task-600x195.png 600w\" sizes=\"auto, (max-width: 728px) 100vw, 728px\" \/><\/p>\n<p>It installs itself in %APPDATA%, in a folder with a name that depends on the bot&#8217;s version.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26309\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/installed_trickbot\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/installed_trickbot.png\" data-orig-size=\"483,162\" 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=\"installed_trickbot\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/installed_trickbot-300x101.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/installed_trickbot.png\" class=\"alignnone size-full wp-image-26309\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/installed_trickbot.png\" alt=\"\" width=\"483\" height=\"162\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/installed_trickbot.png 483w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/installed_trickbot-300x101.png 300w\" sizes=\"auto, (max-width: 483px) 100vw, 483px\" \/><\/p>\n<p>Encrypted modules are stored in the\u00a0Data folder (old name: Modules), along with their configuration:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25932\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/modules1\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/modules1.png\" data-orig-size=\"587,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=\"modules1\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/modules1-300x110.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/modules1.png\" class=\"alignnone size-full wp-image-25932\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/modules1.png\" alt=\"\" width=\"587\" height=\"216\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/modules1.png 587w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/modules1-300x110.png 300w\" sizes=\"auto, (max-width: 587px) 100vw, 587px\" \/><\/p>\n<p>As it turns out, recently the encryption of the modules has changed (and we had to update <a href=\"https:\/\/github.com\/hasherezade\/malware_analysis\/tree\/master\/trickbot\" target=\"_blank\" rel=\"noopener\">the scripts for decoding<\/a>).<\/p>\n<p>The new element in the main installation folder is the settings file, that comes under various names, that seems to be randomly chosen from some hardcoded pool. It&#8217;s most commonly occurring name is settings.ini (hardcoded), but there are other variants such as: profiles.ini, SecurityPreloadState.txt, pkcs11.txt. The format of the file looks new for the TrickBot:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25938\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/settings-8\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/settings.png\" data-orig-size=\"789,563\" 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=\"settings\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/settings-300x214.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/settings-600x428.png\" class=\"alignnone size-full wp-image-25938\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/settings.png\" alt=\"\" width=\"789\" height=\"563\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/settings.png 789w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/settings-300x214.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/settings-600x428.png 600w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>We can see many strings, that at first looks scrambled\/encrypted. But as it turns out, they are junk entries that are added for obfuscation. The real configuration is stored in between of them, in a string that looks like base64 encoded. Its meaning will be explained in the further part of this post.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25939\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/base64_entry\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/base64_entry.png\" data-orig-size=\"1074,200\" 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=\"base64_entry\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/base64_entry-300x56.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/base64_entry-600x112.png\" class=\"alignnone size-full wp-image-25939\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/base64_entry.png\" alt=\"\" width=\"1074\" height=\"200\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/base64_entry.png 1074w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/base64_entry-300x56.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/base64_entry-600x112.png 600w\" sizes=\"auto, (max-width: 1074px) 100vw, 1074px\" \/><\/p>\n<h3>Inside<\/h3>\n<p>In order to better understand the changes, we need to take a deep dive in the code. As always, the <a href=\"https:\/\/www.virustotal.com\/en\/file\/9b6ff6f6f45a18bf3d05bba18945a83da2adfbe6e340a68d3f629c4b88b243a8\/analysis\/\" target=\"_blank\" rel=\"noopener\">original sample<\/a> comes packed &#8211; this time there are two layers of protection to be removed before we get <a href=\"https:\/\/www.virustotal.com\/en\/file\/3a56e9ce42c6d028f1c1dd3efe535dbcdd90490b12a093eec312bf276bda0b37\/analysis\/\" target=\"_blank\" rel=\"noopener\">the main bot<\/a>.<\/p>\n<p>The main bot comes with 2 resources: RES and DIAL, that are analogical to the resources used before.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25940\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/resources-6\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/resources.png\" data-orig-size=\"773,99\" 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=\"resources\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/resources-300x38.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/resources-600x77.png\" class=\"alignnone size-full wp-image-25940\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/resources.png\" alt=\"\" width=\"773\" height=\"99\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/resources.png 773w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/resources-300x38.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/resources-600x77.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/resources-767x99.png 767w\" sizes=\"auto, (max-width: 773px) 100vw, 773px\" \/><\/p>\n<p>RES &#8211; is an encrypted configuration file, in XML format. It is encrypted in the same way as before (using AES, with key derived by hashing rounds), and we can decode it using an old script: <a href=\"https:\/\/github.com\/hasherezade\/malware_analysis\/blob\/master\/trickbot\/trick_config_decoder.py\" target=\"_blank\" rel=\"noopener\">trickbot_config_decoder.py<\/a>. (Mind the fact that the first DWORD in the resource is a size, and not a part of the encrypted data &#8211; so, it needs to be removed before using the script).<\/p>\n<p>DIAL &#8211; is an elliptic curve public key (ECC curve p-384), that is used to verify the signature of the aforementioned encrypted configuration, after it is decrypted.<\/p>\n<p><strong>Obfuscation<\/strong><\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2016\/10\/trick-bot-dyrezas-successor\/\" target=\"_blank\" rel=\"noopener\">In the first edition<\/a>, TrickBot was not at all obfuscated &#8211; we could even find all the strings in clear. Slowly, during the two years of evolution, it has slowly changed. Several months ago, the authors decided to obfuscate all the strings, using a custom algorithm (based on base64). All the obfuscated strings are aggregated from a single hardcoded list:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26174\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/str_list-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/str_list-1.png\" data-orig-size=\"849,392\" 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=\"str_list\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/str_list-1-300x139.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/str_list-1-600x277.png\" class=\"alignnone size-full wp-image-26174\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/str_list-1.png\" alt=\"\" width=\"849\" height=\"392\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/str_list-1.png 849w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/str_list-1-300x139.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/str_list-1-600x277.png 600w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/p>\n<p>When any of them is needed, it is selected by its index and passed to the decoding function:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26172\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/decode_string\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/decode_string.png\" data-orig-size=\"330,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=\"decode_string\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/decode_string-300x236.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/decode_string.png\" class=\"alignnone size-full wp-image-26172\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/decode_string.png\" alt=\"\" width=\"330\" height=\"260\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/decode_string.png 330w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/decode_string-300x236.png 300w\" sizes=\"auto, (max-width: 330px) 100vw, 330px\" \/><\/p>\n<p>Example &#8211; string fetched by the <a href=\"https:\/\/gist.github.com\/hasherezade\/ff0b9ebacb1e47464cf6783e787e69b8#file-extracted_list-txt-L226\" target=\"_blank\" rel=\"noopener\">index 162<\/a>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26269\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/security_descriptor\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/security_descriptor.png\" data-orig-size=\"686,243\" 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=\"security_descriptor\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/security_descriptor-300x106.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/security_descriptor-600x213.png\" class=\"alignnone size-full wp-image-26269\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/security_descriptor.png\" alt=\"\" width=\"686\" height=\"243\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/security_descriptor.png 686w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/security_descriptor-300x106.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/security_descriptor-600x213.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/security_descriptor-470x165.png 470w\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" \/><\/p>\n<p>The deobfuscation process, along with <a href=\"https:\/\/gist.github.com\/hasherezade\/2f09ae061b196ce16fce777472649346\" target=\"_blank\" rel=\"noopener\">the used utility<\/a>, was described <a href=\"https:\/\/www.youtube.com\/watch?v=KMcSAlS9zGE\" data-rel=\"lightbox-video-0\" target=\"_blank\" rel=\"noopener\">here<\/a>. Due to the fact that the API of the decoding functions didn&#8217;t change since then, the same method can be used until today. The list of deobfuscated strings, extracted from the currently analyzed sample can be found <a href=\"https:\/\/gist.github.com\/hasherezade\/ff0b9ebacb1e47464cf6783e787e69b8#file-extracted_list-txt\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>Additionally, we can find other, more popular methods of strings obfuscation. For example, some of the strings that are divided into chunks, one DWORD per each:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25957\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/domain_obfuscated\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/domain_obfuscated.png\" data-orig-size=\"351,138\" 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=\"domain_obfuscated\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/domain_obfuscated-300x118.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/domain_obfuscated.png\" class=\"alignnone size-full wp-image-25957\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/domain_obfuscated.png\" alt=\"\" width=\"351\" height=\"138\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/domain_obfuscated.png 351w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/domain_obfuscated-300x118.png 300w\" sizes=\"auto, (max-width: 351px) 100vw, 351px\" \/><\/p>\n<p>The same method was used by GandCrab, and can be deobfuscated with <a href=\"https:\/\/github.com\/hasherezade\/malware_analysis\/blob\/master\/crabstr.py\" target=\"_blank\" rel=\"noopener\">the following scrip<\/a>t.<\/p>\n<p>Similarly, the Unicode strings are divided:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26310\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/string_obfusc\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/string_obfusc.png\" data-orig-size=\"598,631\" 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=\"string_obfusc\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/string_obfusc-284x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/string_obfusc-569x600.png\" class=\"alignnone size-full wp-image-26310\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/string_obfusc.png\" alt=\"\" width=\"598\" height=\"631\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/string_obfusc.png 598w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/string_obfusc-284x300.png 284w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/string_obfusc-569x600.png 569w\" sizes=\"auto, (max-width: 598px) 100vw, 598px\" \/><\/p>\n<p>Most of the imports used by TrickBot are loaded dynamically. That makes static analysis more difficult, because we cannot directly see the full picture: the pointers are retrieved just before they are used.<\/p>\n<p>We can solve this problem in various ways, i.e. by adding tags by <a href=\"https:\/\/github.com\/hasherezade\/tiny_tracer\" target=\"_blank\" rel=\"noopener\">an automated tracer<\/a>. Created CSV\/tags file for one of the analyzed samples is available <a href=\"https:\/\/gist.github.com\/malwarezone\/b406da290b873d2ae7867ec79029a88e\" target=\"_blank\" rel=\"noopener\">here<\/a> (it can be loaded to the IDA database with the help of <a href=\"https:\/\/github.com\/hasherezade\/ida_ifl\" target=\"_blank\" rel=\"noopener\">IFL plugin<\/a>).<\/p>\n<p>The picture given below shows the fragment of Trick Bot&#8217;s code after the tags are loaded. As we can see, the addresses of the imported functions are retrieved from the internal structure rather than from the standard Import Table, and then they are called via registers.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25958\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/dynamic_calls\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/dynamic_calls.png\" data-orig-size=\"421,256\" 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=\"dynamic_calls\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/dynamic_calls-300x182.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/dynamic_calls.png\" class=\"alignnone size-full wp-image-25958\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/dynamic_calls.png\" alt=\"\" width=\"421\" height=\"256\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/dynamic_calls.png 421w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/dynamic_calls-300x182.png 300w\" sizes=\"auto, (max-width: 421px) 100vw, 421px\" \/><\/p>\n<p>Apart from the mentioned obfuscation methods, on the way of its evolution, TrickBot is going in the direction of string randomization. Many strings that were hardcoded in the initial versions are now randomized or generated per victim machine. For example the mutex name:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26270\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/make_mutex\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/make_mutex.png\" data-orig-size=\"424,526\" 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=\"make_mutex\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/make_mutex-242x300.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/make_mutex.png\" class=\"alignnone size-full wp-image-26270\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/make_mutex.png\" alt=\"\" width=\"424\" height=\"526\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/make_mutex.png 424w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/make_mutex-242x300.png 242w\" sizes=\"auto, (max-width: 424px) 100vw, 424px\" \/><\/p>\n<p><strong>Used encryption<\/strong><\/p>\n<p>In the past, modules were <a href=\"https:\/\/github.com\/hasherezade\/malware_analysis\/blob\/master\/trickbot\/trick_config_decoder.py#L20\" target=\"_blank\" rel=\"noopener\">encrypted by AES in CBC mode<\/a>. The key used for encryption was derived by <a href=\"https:\/\/github.com\/hasherezade\/malware_analysis\/blob\/master\/trickbot\/trick_config_decoder.py#L14\" target=\"_blank\" rel=\"noopener\">hashing initial bytes of the buffer<\/a>. Once knowing the algorithm, we could easily decrypt the stored modules along with their configuration.<\/p>\n<p>In the recent update the authors decided to complicate it a bit. Yet they didn&#8217;t change the main algorithm, but just introduced an additional <a href=\"https:\/\/github.com\/hasherezade\/malware_analysis\/blob\/master\/trickbot\/trick_config_decoder.py#L67\" target=\"_blank\" rel=\"noopener\">XOR layer<\/a>. Before the data is passed to the AES, it is first XORed with a 64 character long, dynamically generated string, that we will refer as a the bot key:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25960\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/to_read_file\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/to_read_file.png\" data-orig-size=\"579,399\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"to_read_file\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/to_read_file-300x207.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/to_read_file.png\" class=\"alignnone size-full wp-image-25960\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/to_read_file.png\" alt=\"\" width=\"579\" height=\"399\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/to_read_file.png 579w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/to_read_file-300x207.png 300w\" sizes=\"auto, (max-width: 579px) 100vw, 579px\" \/><\/p>\n<p>The mentioned bot key is generated per victim machine. First, GetAdapterInfo function is used:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25961\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/from_adapter_info\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/from_adapter_info.png\" data-orig-size=\"440,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=\"from_adapter_info\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/from_adapter_info-300x108.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/from_adapter_info.png\" class=\"alignnone size-full wp-image-25961\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/from_adapter_info.png\" alt=\"\" width=\"440\" height=\"158\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/from_adapter_info.png 440w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/from_adapter_info-300x108.png 300w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/p>\n<p>The retrieved structure (194 bytes) is hashed by SHA256 and then the hash is converted into string:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25966\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/hash_data-3\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/hash_data.png\" data-orig-size=\"389,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=\"hash_data\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/hash_data-300x141.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/hash_data.png\" class=\"alignnone size-full wp-image-25966\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/hash_data.png\" alt=\"\" width=\"389\" height=\"183\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/hash_data.png 389w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/hash_data-300x141.png 300w\" sizes=\"auto, (max-width: 389px) 100vw, 389px\" \/><\/p>\n<p>The reconstructed algorithm to generate the Bot Key (and the utility to generate the keys) can be found <a href=\"https:\/\/github.com\/hasherezade\/malware_analysis\/blob\/master\/trickbot\/make_bot_key.cpp\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>This key is then stored in the dropped settings file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25964\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/read_settings\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/read_settings.png\" data-orig-size=\"391,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=\"read_settings\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/read_settings-300x254.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/read_settings.png\" class=\"alignnone size-full wp-image-25964\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/read_settings.png\" alt=\"\" width=\"391\" height=\"331\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/read_settings.png 391w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/read_settings-300x254.png 300w\" sizes=\"auto, (max-width: 391px) 100vw, 391px\" \/><\/p>\n<p><strong>Encoding settings<br \/> <\/strong><\/p>\n<p>As mentioned before, new editions of TrickBot drop a new settings file, containing some encoded information. Example of the information that is stored in the settings:<\/p>\n<pre>0441772F66559A1C71F4559DC4405438FC9B8383CE1229139257A7FE6D7B8DE9 1085117245 5 6 13  <\/pre>\n<p>The elements:<\/p>\n<p>1. the BotKey (generated per machine)<\/p>\n<p>2. a checksum of a test string: (0-256 bytes encoded with the same charset) &#8211; used for the purpose of a charset validation<\/p>\n<p>3. three random numbers<\/p>\n<p>The whole line is base64 encoded using a custom charset, that is generated basing on the hardcoded one: &#8220;HJIA\/CB+FGKLNOP3RSlUVWXYZfbcdeaghi5kmn0pqrstuvwx89o12467MEDyzQjT&#8221;.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26046\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/use_custom_charset\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/use_custom_charset.png\" data-orig-size=\"720,215\" 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=\"use_custom_charset\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/use_custom_charset-300x90.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/use_custom_charset-600x179.png\" class=\"alignnone size-full wp-image-26046\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/use_custom_charset.png\" alt=\"\" width=\"720\" height=\"215\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/use_custom_charset.png 720w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/use_custom_charset-300x90.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/10\/use_custom_charset-600x179.png 600w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/p>\n<p>Yet, even at this point we can see the effort of the authors to avoid using repeatable patterns. The last 8 characters of the charset are swapped randomly. The pseudocode of the generation algorithm:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26284\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/random_swap_last\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/random_swap_last.png\" data-orig-size=\"397,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=\"random_swap_last\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/random_swap_last-300x82.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/random_swap_last.png\" class=\"alignnone size-full wp-image-26284\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/random_swap_last.png\" alt=\"\" width=\"397\" height=\"108\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/random_swap_last.png 397w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/random_swap_last-300x82.png 300w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><\/p>\n<p>Randomization of the n characters:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"26308\" data-permalink=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/attachment\/randomizing_charset\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/randomizing_charset.png\" data-orig-size=\"646,447\" 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=\"randomizing_charset\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/randomizing_charset-300x208.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/randomizing_charset-600x415.png\" class=\"alignnone size-full wp-image-26308\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/randomizing_charset.png\" alt=\"\" width=\"646\" height=\"447\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/randomizing_charset.png 646w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/randomizing_charset-300x208.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/randomizing_charset-600x415.png 600w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/p>\n<p>Example of the transformation:<\/p>\n<p>inp: &#8220;HJIA\/CB+FGKLNOP3RSlUVWXYZfbcdeaghi5kmn0pqrstuvwx89o12467<strong>M<\/strong>E<strong>Dyz<\/strong>Q<strong>jT<\/strong>&#8221;<\/p>\n<p>out: &#8220;HJIA\/CB+FGKLNOP3RSlUVWXYZfbcdeaghi5kmn0pqrstuvwx89o12467<strong>jD<\/strong>E<strong>zTy<\/strong>Q<strong>M<\/strong>&#8221;<\/p>\n<p>The decoder can be found here:\u00a0<a href=\"https:\/\/github.com\/hasherezade\/malware_analysis\/blob\/master\/trickbot\/trick_settings_decoder.py\" target=\"_blank\" rel=\"noopener\">trick_settings_decoder.py <\/a><\/p>\n<h3>Slowly improving obfuscation<\/h3>\n<p>The authors of TrickBot never cared much about obfuscation. With time they slowly started to introduce its elements, but, apart from some twists, it&#8217;s still nothing really complex. We can rather expect that this trend will not change rapidly, and after updating the scripts for new additions, decoding Trick Bot elements will be as easy for the analysts as it was before.<\/p>\n<p>It seems that the authors believe in a success based on quantity of distribution, rather than on attempts of being stealthy in the system. They also focus on constant adding new modules, to diversify the functionality (i.e. recently, they added a new module for attacking <a href=\"https:\/\/www.vkremez.com\/2018\/11\/lets-learn-introducing-latest-trickbot.html\" target=\"_blank\" rel=\"noopener\">Point-Of-Sale systems<\/a>).<\/p>\n<p>&nbsp;<\/p>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/\">What&#8217;s new in TrickBot? Deobfuscating elements<\/a> appeared first on <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\">Malwarebytes Labs<\/a>.<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/\" target=\"bwo\" >https:\/\/blog.malwarebytes.com\/feed\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><strong>Credit to Author: hasherezade| Date: Mon, 12 Nov 2018 15:00:22 +0000<\/strong><\/p>\n<table cellpadding='10'>\n<tr>\n<td valign='top' align='center'><a href='https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/' title='What's new in TrickBot? Deobfuscating elements'><img src='https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/11\/Trojan.code_.jpg' border='0'  width='300px'  \/><\/a><\/td>\n<\/tr>\n<tr>\n<td valign='top' align='left'>Trojan.TrickBot has been present in the threat landscape from quite a while. We wrote about its first version in October 2016. From the beginning, it was a well organized modular malware, written by developers with mature skills. It is often called a banker, however its modular structure allows to freely add new functionalities without modifying&#8230;<\/p>\n<p>Categories: <\/p>\n<ul class=\"post-categories\">\n<li><a href=\"https:\/\/blog.malwarebytes.com\/category\/malwarebytes-news\/\" rel=\"category tag\">Malwarebytes news<\/a><\/li>\n<\/ul>\n<p>Tags: <a href=\"https:\/\/blog.malwarebytes.com\/tag\/botkey\/\" rel=\"tag\">BotKey<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/gandcrab\/\" rel=\"tag\">gandcrab<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/gandcrab-ransomware\/\" rel=\"tag\">gandcrab ransomware<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/ifl-plugin\/\" rel=\"tag\">IFL plugin<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/pkcs11-txt\/\" rel=\"tag\">pkcs11.txt<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/powershell\/\" rel=\"tag\">powershell<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/profiles-ini\/\" rel=\"tag\">profiles.ini<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/securitypreloadstate-txt\/\" rel=\"tag\">SecurityPreloadState.txt<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/svchost\/\" rel=\"tag\">svchost<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/svchost-exe\/\" rel=\"tag\">svchost.exe<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/trickbot\/\" rel=\"tag\">trickbot<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/trickbot_config_decoder-py\/\" rel=\"tag\">trickbot_config_decoder.py<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/trojan-trickbot\/\" rel=\"tag\">Trojan.TrickBot<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/xor-layer\/\" rel=\"tag\">XOR layer<\/a><\/p>\n<table width='100%'>\n<tr>\n<td align=right>\n<p><b>(<a href='https:\/\/blog.malwarebytes.com\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/' title='What's new in TrickBot? Deobfuscating elements'>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\/malwarebytes-news\/2018\/11\/whats-new-trickbot-deobfuscating-elements\/\">What&#8217;s new in TrickBot? Deobfuscating elements<\/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":[20119,17363,17364,20120,10546,20121,11191,20122,20123,20124,17595,13256,20125,20126,20127],"class_list":["post-13802","post","type-post","status-publish","format-standard","hentry","category-malwarebytes","category-security","tag-botkey","tag-gandcrab","tag-gandcrab-ransomware","tag-ifl-plugin","tag-malwarebytes-news","tag-pkcs11-txt","tag-powershell","tag-profiles-ini","tag-securitypreloadstate-txt","tag-svchost","tag-svchost-exe","tag-trickbot","tag-trickbot_config_decoder-py","tag-trojan-trickbot","tag-xor-layer"],"_links":{"self":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/13802","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/comments?post=13802"}],"version-history":[{"count":0,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/13802\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=13802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=13802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=13802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}