What We Do
How We Do
Resources
Company
Partners
Get Started
Blog

The Return of the Bat: FakeBat’s Payk RunPE Arsenal

BY eSentire Threat Response Unit (TRU)

April 9, 2024 | 5 MINS READ

Attacks/Breaches

Threat Intelligence

Threat Response Unit

TRU Positive/Bulletin

Want to learn more on how to achieve Cyber Resilience?

TALK TO AN EXPERT

Adversaries don’t work 9-5 and neither do we. At eSentire, our 24/7 SOCs are staffed with Elite Threat Hunters and Cyber Analysts who hunt, investigate, contain and respond to threats within minutes.

We have discovered some of the most dangerous threats and nation state attacks in our space – including the Kaseya MSP breach and the more_eggs malware.

Our Security Operations Centers are supported with Threat Intelligence, Tactical Threat Response and Advanced Threat Analytics driven by our Threat Response Unit – the TRU team.

In TRU Positives, eSentire’s Threat Response Unit (TRU) provides a summary of a recent threat investigation. We outline how we responded to the confirmed threat and what recommendations we have going forward.

Here’s the latest from our TRU Team…

What did we find?

In March 2024, the eSentire Threat Response Unit (TRU) detected an infection by FakeBat, a loader malware, on the network of our software industry client (Figure 1). FakeBat spreads through a technique known as malvertising, which involves exploiting online advertising platforms, including Google Ads, to spread malware.

The user accessed a malicious page masquerading as a legitimate one, offering a fake Trello MSIX software installer named Trello-Full-Installer-x64.msix (MD5: 61714d10ee99d136957e524173000884). Jérôme Segura, Senior Principal Threat Researcher at Malwarebytes, observed the same malicious activity described in the article.

Figure 1: Infection chain

The MSIX file contains the obfuscated PowerShell script (Refresh2.ps, MD5:67f4237d0a28cd6e6c5bac4286c92d93) with symbolic obfuscation (Figure 2).

Figure 2: Contents of Refresh2.ps1

The decrypted script is shown in Figure 3. The script communicates with the C2 server via a user-agent “Mozilla/5.0 (Macintosh; Intel Mac OS X 14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.46 OPR/105.0.0.0”.

Figure 3: Decrypted content of Refresh2.ps1

If the client's IP is listed in the threat actor's Command and Control (C2) panel, the C2 will deliver the subsequent stage payload. This measure aims to hinder researchers from examining the final stage payloads.

Figures 4 and 5 show the refined and deobfuscated script of the secondary stage payload, obtained from the C2.

Figure 4: The deobfuscated second-stage PowerShell script

The script downloads the Anti-Malware Scan Interface (AMSI) bypass script from GitHub, enabling malicious payloads to execute undetected on a system by circumventing AMSI. Subsequently, it connects to a Telegra[.]ph page (Figure 6) – an anonymous article publishing site – retrieves the webpage and searches for links ending in “.dat” and “.gpg” within the content.

The snippet of the deobfuscated script that retrieves the GNU Privacy Guard encrypted payload from the Telegra[.]ph page is shown in Figure 5; it’s worth mentioning that the gpg.exe (GNU Privacy Guard) itself is located under the “VFS\AppData\local\” folder within the MSIX file.

Upon decrypting the payload, it appears to be SectopRAT or ArechClient2 that gets injected into the MSBuild.exe process via the IDAT loader technique.

Figure 5: Retrieving GNU Privacy Guard from Telegra[.]ph
Figure 6: Telegra[.]ph page

Payk RunPE

The links to the payloads on the Telegra[.]ph page are shown in Figure 7. The .dat file reveals the Payk RunPE or RunPE payload associated with the FakeBat developers. A RunPE (Run Portable Executable) payload is a method malware utilizes to inject and execute a portable executable (PE) file within the memory space of a legitimate Windows process.

eSentire TRU assesses that FakeBat has likely used RunPE payloads from at least November 2023.

Figure 7: Embedded links on Telegra[.]ph containing the final payloads

Payk RunPe is obfuscated with .NET Reactor (thanks to @cod3nym for helping in identifying the packer). The payload contains the AntiVM function, that checks for running processes such as:

If a specified process is detected, payload execution will terminate. Notably, the process name “Vmtoolsd” is capitalized, implying that it will not recognize a running “vmtoolsd.exe” process. Consequently, this allows the payload to be executed in VMWare environments.

The payload contains base64-encoded strings for the resource name, the passphrase used in deriving the AES key, and the executable into which the payload will be injected via process hollowing (T1055.012) into RegAsm.exe.

Figure 8: Reference to AntiVM function, passphrase and decoded path for process injection

The encrypted payload resides in the resources and is encrypted with AES.

Figure 9: AES decryption routine

We discovered 20 Payk RunPE payloads on VirusTotal. The hashes are available in the Indicators of Compromise section or can be accessed here.

What can you learn from this TRU Positive?

What did we do?

Our 24/7 SOC Cyber Analysts investigated the suspicious activities, notified the client, and isolated the affected device.

Recommendations from our Threat Response Unit (TRU) Team:

Indicators of Compromise

You can access the indicators of compromise here.

References

eSentire Threat Response Unit (TRU)
eSentire Threat Response Unit (TRU)

The eSentire Threat Response Unit (TRU) is an industry-leading threat research team committed to helping your organization become more resilient. TRU is an elite team of threat hunters and researchers that supports our 24/7 Security Operations Centers (SOCs), builds threat detection models across the eSentire XDR Cloud Platform, and works as an extension of your security team to continuously improve our Managed Detection and Response service. By providing complete visibility across your attack surface and performing global threat sweeps and proactive hypothesis-driven threat hunts augmented by original threat research, we are laser-focused on defending your organization against known and unknown threats.

Read the Latest from eSentire