{"id":24082,"date":"2024-03-04T05:20:54","date_gmt":"2024-03-04T13:20:54","guid":{"rendered":"https:\/\/www.palada.net\/index.php\/2024\/03\/04\/news-17812\/"},"modified":"2024-03-04T05:20:54","modified_gmt":"2024-03-04T13:20:54","slug":"news-17812","status":"publish","type":"post","link":"https:\/\/www.palada.net\/index.php\/2024\/03\/04\/news-17812\/","title":{"rendered":"It&#8217;ll be back: Attackers still abusing Terminator tool and variants"},"content":{"rendered":"<p><strong>Credit to Author: Matt Wixey| Date: Mon, 04 Mar 2024 11:00:08 +0000<\/strong><\/p>\n<div class=\"entry-content lg:prose-lg mx-auto prose max-w-4xl\">\n<p>BYOVD (Bring Your Own Vulnerable Driver) is a class of attack in which threat actors drop known vulnerable drivers on a compromised machine and then exploit the bug(s) to gain kernel-level privileges. At this level of access, attackers can accomplish a lot: hide malware, dump credentials, and, crucially, attempt to disable EDR solutions.<\/p>\n<p>Threat actors are spoiled for choice when it comes to choosing vulnerable drivers; as of this writing, there are 364 entries tagged as \u201cvulnerable driver\u201d listed on <a href=\"https:\/\/www.loldrivers.io\/\">loldrivers.io<\/a>, an open-source repository of vulnerable drivers and corresponding signatures and hashes. Perhaps as a result of this, BYOVD attacks \u2013 previously the province of highly sophisticated threat actors \u2013 have become popular amongst ransomware operators and lower-tier attackers in recent years.<\/p>\n<p>In February 2020, for example, we reported on a <a href=\"https:\/\/news.sophos.com\/en-us\/2020\/02\/06\/living-off-another-land-ransomware-borrows-vulnerable-driver-to-remove-security-software\/\">RobbinHood ransomware campaign<\/a> in which the threat actor abused a legitimate driver signed by a motherboard manufacturer, to disable EDR products. Since then, we\u2019ve also reported on a <a href=\"https:\/\/news.sophos.com\/en-us\/2022\/10\/04\/blackbyte-ransomware-returns\/\">BlackByte ransomware campaign<\/a> abusing a graphics card driver; a BYOVD campaign in which threat actors <a href=\"https:\/\/news.sophos.com\/en-us\/2022\/12\/13\/signed-driver-malware-moves-up-the-software-trust-chain\/\">leveraged a Windows driver<\/a>; and <a href=\"https:\/\/news.sophos.com\/en-us\/2023\/04\/19\/aukill-edr-killer-malware-abuses-process-explorer-driver\/\">multiple incidents involving AuKill<\/a>, a tool that abuses an outdated Process Explorer driver, and which we\u2019ve observed threat actors use in several ransomware incidents.<\/p>\n<p>Another possible reason for BYOVD becoming popular with lower-tier threat actors is that off-the-shelf kits and tools are now bought and sold on criminal forums. One in particular attracted a significant amount of attention in May 2023, when a threat actor known as <strong>spyboy<\/strong> <a href=\"https:\/\/www.bleepingcomputer.com\/news\/security\/terminator-antivirus-killer-is-a-vulnerable-windows-driver-in-disguise\/\">advertised a tool called Terminator<\/a> on the Russian-language ransomware forum RAMP. The seller claimed that the tool, priced between $300 USD to $3,000 USD, could disable twenty-four security products.<\/p>\n<h1>Hasta la driver, baby<\/h1>\n<p><a href=\"https:\/\/www.reddit.com\/r\/crowdstrike\/comments\/13wjrgn\/20230531_situational_awareness_spyboy_defense\/\">A 2023 analysis by CrowdStrike<\/a> revealed that Terminator appears to be a BYOVD tool, with the vulnerable driver in question being <strong>zam64.sys<\/strong> (Zemana Anti-Logger) or <strong>zamguard64.sys<\/strong> (Zemana Anti-Malware, or ZAM), published and signed by <a href=\"https:\/\/zemana.com\/us\/antimalware.html\">Zemana<\/a>. Both drivers share almost the same code base.<\/p>\n<p><a href=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-953867\" src=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image1.png\" alt=\"A side-by-side comparison of two screenshots of decompiled code\" width=\"640\" height=\"452\" srcset=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image1.png 796w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image1.png?resize=300,212 300w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image1.png?resize=768,542 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p><em>Figure 1: Comparing decompiled disassembly code of both Zemana drivers reveals almost the same code base<\/em><\/p>\n<p>Both drivers also contain the same vulnerability, an insufficient verification of the processes that can send IOCTL codes to them and request various functionalities. The drivers maintain an \u2018allow list\u2019 of legitimate, trustworthy processes. However, by sending an IOCTL code 0x80002010 and passing the process ID of a running process as a parameter, an attacker can add their own process to the allow list and circumvent this security measure. Once added, the attacker can request a number of functionalities from the driver, such as attempting to terminate a targeted process by sending an IOCTL request with code 0x80002048. A comprehensive list of functionalities is provided in this <a href=\"https:\/\/voidsec.com\/reverse-engineering-terminator-aka-zemana-antimalware-antilogger-driver\/\">article<\/a>.<\/p>\n<p><a href=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-953868\" src=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image2.png\" alt=\"A diagram showing the process of exploiting the vulnerable driver\" width=\"640\" height=\"249\" srcset=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image2.png 853w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image2.png?resize=300,117 300w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image2.png?resize=768,299 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p><em>Figure 2: IOCTL code requests needed to be able to abuse the vulnerability<\/em><\/p>\n<p>To abuse the driver in this way, however, a threat actor would need administrative privileges and a User Account Control (UAC) bypass (or they would need to convince a user to install the driver via social engineering). So while leveraging vulnerable legitimate drivers could certainly allow a threat actor to terminate AV and EDR processes, it\u2019s not necessarily straightforward, and escalating privileges may trigger other security protections.<\/p>\n<h1>Multiple variants<\/h1>\n<p>Many of the vendors on spyboy\u2019s list, including Sophos, moved quickly to investigate variants of the drivers and develop protections. Since the initial release of Terminator, we have also tracked multiple variants of the tool \u2013 including open-source versions such as <a href=\"https:\/\/github.com\/ZeroMemoryEx\/Terminator\">Terminator<\/a>, which reproduces spyboy\u2019s technique; <a href=\"https:\/\/github.com\/mertdas\/SharpTerminator\">SharpTerminator<\/a>, a C# port of the previous project; and <a href=\"https:\/\/github.com\/nbaertsch\/Ternimator\">Ternimator<\/a>, a version written in Nim . (Like Rust, Nim is a popular language for writing <a href=\"https:\/\/medium.com\/walmartglobaltech\/investigation-into-the-state-of-nim-malware-14cc543af811\">red teaming tools or malware<\/a>, because as a relatively new language it may be more likely to circumvent static detections or static based heuristic models; it also offers cross-platform support).<\/p>\n<p>Even multiple months after the initial discovery, the drivers are still a popular topic in darknet forums. For instance, we discovered the following November 2023 post on a Russian-language criminal forum:<\/p>\n<p><a href=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/forum_edit.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-953869\" src=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/forum_edit-e1709297251824.png\" alt=\"A screenshot of a post on a criminal forum\" width=\"1078\" height=\"104\" \/><\/a><\/p>\n<p><em>Figure 3: A threat actor posts on a criminal forum offering a BYOVD tool for sale<\/em><\/p>\n<p>After further investigation of the thread, we assess that this likely refers to a different release version of the Zemana driver(s), or a hash that is not, as of this writing, reported on loldrivers.io. When challenged by another user, who said that: \u201cits [sic] ZAM, not worth spending time on (blacklisted &amp; detected)\u201d, the original poster replied: \u201cit is not in the databases\u2026in the databases there is a different version of the driver and not this one.\u201d<\/p>\n<p>Further discussion in the forum revealed that threat actors are aware of the widespread coverage of the vulnerable Zemana drivers. The discussion ended with another threat actor suggesting that developing a malicious driver from scratch and using a valid certificate \u2013 be it stolen, leaked, or otherwise acquired \u2013 to sign it, is a more viable strategy than using known vulnerable drivers.<\/p>\n<p>While we weren\u2019t able to glean any further useful information from the thread, we decided to do some investigation and analysis, to determine the extent of Zemana driver abuse and to see whether attackers are making further tweaks and changes to the original Terminator tool.<\/p>\n<h1>Real-world attacks<\/h1>\n<p>We reviewed our behavioral detection telemetry for the past six months and discovered several incidents in which attackers used the Zemana Anti-Logger or Anti-Malware drivers. In some cases, threat actors also ported the open-source projects discussed earlier to different languages or obfuscated them through packers to circumvent detection. We\u2019ve highlighted the incidents below as they\u2019re illustrative of patterns we saw across a wider evidence base.<\/p>\n<h2>From Citrix to Ter<\/h2>\n<p>On September 13, 2023 and October 10, 2023, Sophos thwarted attacks which both used very similar methodologies. In both cases, initial access was likely obtained via exploiting a vulnerable Citrix application. From there, the attackers injected a payload into the Windows Error Reporting process, <strong>wermgr.exe<\/strong>. Next, they tried to disable Sophos by issuing the following commands:<\/p>\n<pre>wmic service where \"PathName like '%sophos%'\" call delete \/nointeractive  wmic service where \"PathName like '%sophos%'\" call stopservice \/nointeractive<\/pre>\n<p>Tamper protection was enabled on the targeted devices, so the attempts to simply disable and remove the Sophos services failed. Finally, the threat actor switched to deploying an EXE file named <strong>ter.exe<\/strong>. The binary unpacks itself to a slightly modified version of Terminator. The driver itself was dropped separately before this.<\/p>\n<p>Upon execution, the binary loads the \u201cBINARY\u201d resource. The content is decrypted via AES-256. The key is hardcoded in the binary. Finally, the binary writes the decrypted content into a newly allocated section and executes it. The attempt to load the driver was blocked by one of our behavioral protection rules.<\/p>\n<p><a href=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-953870\" src=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image4.png\" alt=\"A screenshot of decompiled code\" width=\"617\" height=\"645\" srcset=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image4.png 617w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image4.png?resize=287,300 287w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image4.png?resize=32,32 32w\" sizes=\"auto, (max-width: 617px) 100vw, 617px\" \/><\/a><\/p>\n<p><em>Figure 4: Unpacking routine of ter.exe<\/em><\/p>\n<p>After investigating the disassembly of the unpacked ter.exe binary, we found the PDB path string with the original project name \u201cTerminator-master,\u201d suggesting that the threat actor modified code from the Terminator GitHub repository.<\/p>\n<p><a href=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-953871\" src=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image5.png\" alt=\"A screenshot of disassembled code, showing a filepath\" width=\"640\" height=\"207\" srcset=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image5.png 937w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image5.png?resize=300,97 300w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image5.png?resize=768,248 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p><em>Figure 5: Path to PDB file, found in the unpacked ter.exe<\/em><\/p>\n<h2>Healthcare under attack<\/h2>\n<p>On December 15, 2023 we blocked an attack targeting a healthcare organization. Immediately after initial access, the attackers attempted to execute a PowerShell command to download a text file from a C2 server.<\/p>\n<p>The text file itself is a PowerShell script designed to install the <a href=\"https:\/\/news.sophos.com\/en-us\/tag\/xmrig\/\">XMRig cryptominer<\/a> on the targeted system. The attempt was blocked by one of our behavioral protection rules.<\/p>\n<p>Later, the threat actors tried to disable the EDR client via running ternimator, the Nim version of Terminator, on one of the infected machines. The attempt to load the driver was also blocked by behavioral protection rules.<\/p>\n<p><a href=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-953872\" src=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image6.png\" alt=\"A diagram showing an overview of the attack chain\" width=\"640\" height=\"220\" srcset=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image6.png 882w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image6.png?resize=300,103 300w, https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/image6.png?resize=768,264 768w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p><em>Figure 6: Overview of the attack on the healthcare organization<\/em><\/p>\n<h2>From ZAM to AuKill<\/h2>\n<p>In this attack, which occurred on Christmas Day 2023, the threat actor gained access to a single machine, although the initial attack vector is unclear. First, they tried to load the Zemana Anti-Logger driver, masquerading as updatedrv.sys, from different locations:<\/p>\n<pre>%sysdir%driversupdatedrv.sys  &lt;d&gt;programdatausosharedupdatedrv.sys<\/pre>\n<p>After these attempts failed, they switched to using <a href=\"https:\/\/news.sophos.com\/en-us\/2023\/04\/19\/aukill-edr-killer-malware-abuses-process-explorer-driver\/\">AuKill<\/a>, another known EDR killer, where the Process Explorer driver was named ped.sys in the temp folder. We reported this to the customer, and did not see any further detections triggered; we are therefore highly confident that the attack was thwarted.<\/p>\n<h1>Mitigation and protection<\/h1>\n<p>Detecting the abuse of vulnerable drivers is a unique challenge for the security industry. While efforts to compile repositories of known vulnerable drivers, such as loldrivers.io, are certainly useful, it is worth noting that these drivers are legitimate, and may be crucial for the operating system or for mission-critical services and applications. Blocking them wholesale, without careful validation, can be time-consuming, counter-productive, and result in unforeseen problems for organizations. A solely reactive approach is therefore usually not enough to solve this issue, particularly since there are so many known vulnerable drivers \u2013 with potentially more containing zero-day vulnerabilities.<\/p>\n<p>However, it\u2019s relatively rare for threat actors to deploy legitimate drivers with zero-day vulnerabilities; most of the time, the drivers and their vulnerabilities are known and documented, as is the case here (albeit they may be packed, obfuscated, or tweaked to avoid static detection). So keeping up-to-date with vulnerable drivers, and blocklisting any that you don\u2019t already have installed, can be worthwhile.<\/p>\n<p>We also recommend taking the following proactive actions:<\/p>\n<ul>\n<li>Check if your endpoint security product implements tamper protection (see <a href=\"https:\/\/doc.sophos.com\/esg\/enterprise-console\/5-5\/help\/en-us\/esg\/Enterprise-Console\/tasks\/tamper_02_enable.html\">here<\/a> for advice on how to do it for Sophos products)<\/li>\n<li>Practice strong Windows security roles hygiene. BYOVD attacks are typically made possible through privilege escalation and UAC bypasses<\/li>\n<li>Keep both your OS and individual applications and tools updated, and remove older software if it\u2019s no longer used or required<\/li>\n<li>If you\u2019re not doing so already, consider adding vulnerable drivers to your vulnerability management program; threat actors could seek to exploit vulnerable legitimate drivers that already exist on a compromised system<\/li>\n<\/ul>\n<p>In addition to static detections of some of the Zemana components mentioned in this article, Sophos behavioral protection rules and <a href=\"https:\/\/news.sophos.com\/en-us\/2023\/10\/19\/pioneering-automated-moving-target-defense-amtd\/\">Adaptive Attack Protection<\/a> provide further layers of defense. Moreover, BYOVD events do not happen in isolation, and some of the activities that accompany a BYOVD attack \u2013 exploitation of an initial attack vector; lateral movement; establishing persistence; and privilege escalation \u2013 offer further opportunities to detect and block an attack in progress.<\/p>\n<h1>Conclusion<\/h1>\n<p>BYOVD attacks are attractive to threat actors, as they can provide a means by which to disable AV and EDR solutions at the kernel level. The sheer amount of known vulnerable drivers means that attackers have a wealth of options to choose from. Our investigation into the misuse of Zemana drivers illustrates that threat actors will continue to use such components even if they\u2019re publicly known and signatured \u2013 because they are known to work, and because they are often bundled into off-the-shelf kits and tools. However, it\u2019s also worth noting our finding on the forum \u2013 that some threat actors are instead advocating for purpose-built malicious drivers, signed with stolen or leaked certificates.<\/p>\n<p>Like many others in the security community, we are constantly researching and evaluating the threat landscape to keep track of both vulnerable and custom-built drivers, as per our previous coverage of AuKill and other campaigns. We are also continuing to devise and test new methods to proactively block maliciously used drivers.<\/p>\n<p>IOCs for the attacks described in this article are available on <a href=\"https:\/\/github.com\/sophoslabs\/IoCs\/blob\/master\/Zemana-driver-IoCs.csv\">our GitHub repository<\/a>.<\/p>\n<h2>Protections<\/h2>\n<p>&nbsp;<\/p>\n<\/p><\/div>\n<p><a href=\"https:\/\/news.sophos.com\/en-us\/2024\/03\/04\/itll-be-back-attackers-still-abusing-terminator-tool-and-variants\/\" target=\"bwo\" >http:\/\/feeds.feedburner.com\/sophos\/dgdY<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/news.sophos.com\/wp-content\/uploads\/2024\/03\/shutterstock_339023852.jpg\"\/><\/p>\n<p><strong>Credit to Author: Matt Wixey| Date: Mon, 04 Mar 2024 11:00:08 +0000<\/strong><\/p>\n<p>First released in May 2023, an EDR killer \u2013 and the vulnerable Zemana drivers it leverages \u2013 are still of interest to threat actors, along with variants and ported versions<\/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":[10378,10377],"tags":[29152,25302,27784,28131,129,3765,27030,23286,16771,30970],"class_list":["post-24082","post","type-post","status-publish","format-standard","hentry","category-security","category-sophos","tag-aukill","tag-blackbyte","tag-byovd","tag-drivers","tag-featured","tag-ransomware","tag-sophos-x-ops","tag-terminator","tag-threat-research","tag-zam"],"_links":{"self":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/24082","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=24082"}],"version-history":[{"count":0,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/24082\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=24082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=24082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=24082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}