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.
The MSIX file contains the obfuscated PowerShell script (Refresh2.ps, MD5:67f4237d0a28cd6e6c5bac4286c92d93) with symbolic obfuscation (Figure 2).
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”.
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.
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 “VFSAppDatalocal” 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.
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.
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:
- Vmtoolsd
- vboxservice
- Vmwareuser
- Vmwaretrat
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.
The encrypted payload resides in the resources and is encrypted with AES.
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?
- Social engineering attacks conducted via drive-by downloads continue to be a prevalent method for distributing various malware loaders. From TRU’s analysis, FakeBat employs multiple delivery tactics, with malvertising and counterfeit software downloads being the primary strategies.
- The usage of obfuscation techniques, including symbolic obfuscation in PowerShell scripts, underscores the extensive measures attackers undertake to conceal their malicious operations. This demands that organizations implement script logging to enhance detection capabilities.
- The malware communicates with Command and Control (C2) servers using a specific user-agent string, emphasizing the importance of network monitoring for unusual patterns of traffic that could indicate a compromised system.
- The technique of injecting the payload into legitimate Windows process spaces, such as via the IDAT loader into the MSBuild.exe process, and the use of process hollowing underscores the need for behavior-based detection mechanisms. These mechanisms can identify malicious actions performed by otherwise legitimate processes.
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:
- Ensure that all endpoints are protected with up-to-date antivirus software or Endpoint Detection and Response (EDR) tool capable of detecting and blocking malicious files.
- Implement a Phishing and Security Awareness Training (PSAT) program that educates and informs your employees on emerging threats in the threat landscape.
- We recommend modifying the default ‘open-with’ settings for script files, ensuring they open with a basic text editor like Notepad instead of executing.
- Control MSIX execution via AppLocker.
Indicators of Compromise
You can access the indicators of compromise here.
References
Source: Original Post