A recent investigation by Trend Micro has uncovered a potential supply chain attack targeting the Pakistani government. The attack involves an MSI installer for the Pakistani government app E-Office, which was found to deliver a ShadowPad sample. ShadowPad is an advanced malware family discovered in 2017 following a supply chain attack on server management software, attributed to APT41. Since 2019, this malware has been shared among multiple Chinese threat actors such as Earth Akhlut or Earth Lusca.
The MSI installer’s metadata contains tags mentioning the eOffice and its developing agency. The installer was found to contain three additional files:
The Telerik.Windows.Data.Validation.dll is a 64-bit non-DLL PE executable file, which is the legitimate applaunch.exe file signed by Microsoft. This executable is known to be abused by multiple threat actors to sideload malicious files named mscoree.dll. The mscoree.dll is a malicious DLL that decrypts and loads the mscoree.dll.dat file, which is the ShadowPad payload.
The ShadowPad malware uses a DLL sideloading vulnerability in the applaunch.exe file. The malware checks some bytes of the loading executable at a hard-coded offset to verify that they match a particular value. If this is not the case, the DLL closes itself. This code excerpt is intended as an anti-sandbox analysis code.
The malware uses two different obfuscation techniques, both of which are used in the DLL and the decrypted payload. The first technique prevents the disassembler from statically following the code flow, as every instruction is followed by a call to a function that calculates the address of the next instruction. The second technique adds useless instructions and branches that are never taken.
Indicators of Compromise (IOCs)
The following are the IOCs related to this threat:
MITRE ATT&CK TTPs
The following MITRE ATT&CK TTPs are relevant to this attack:
- T1195: Supply Chain Compromise
- T1073: DLL Side-Loading
- T1055: Process Injection
- T1027: Obfuscated Files or Information
- T1105: Remote File Copy
- T1001: Data Obfuscation
- T1036: Masquerading
Possibly related CVEs
CVE-2021-26855 is a server-side request forgery (SSRF) vulnerability in Microsoft Exchange Server that allows an attacker to send arbitrary HTTP requests and authenticate as the Exchange server. This vulnerability has been exploited by the HAFNIUM APT group, among others, and was a part of a series of zero-day vulnerabilities in Microsoft Exchange Server that were exploited in the wild.
CVE-2022-29464 is an unrestricted file upload vulnerability affecting various WSO2 products. This critical vulnerability allows unauthenticated and remote attackers to execute arbitrary code on the affected system. It has been exploited in the wild since April 2022 to install Cobalt Strike beacons, coin-miners, and other types of malware.
Both CVE-2021-26855 and CVE-2022-29464 have been exploited in various campaigns:
- CVE-2021-26855 was exploited by the HAFNIUM APT group and was part of a series of zero-day vulnerabilities in Microsoft Exchange Server that were exploited in the wild. More details can be found in this Microsoft Security Blog post.
- CVE-2022-29464 has been exploited in the wild since April 2022 to install Cobalt Strike beacons, coin-miners, and other types of malware. More details can be found in this Rapid7 Blog post.
This campaign demonstrates the capabilities of a highly skilled threat actor that managed to compromise a governmental application installer to target sensitive entities. The use of ShadowPad malware potentially links the actor to the nexus of Chinese threat actors, although a specific group cannot be confidently identified. The actor’s ability to blend in with legitimate network traffic shows a high level of preparation and sophistication. It is expected that more threat actors will use this updated ShadowPad version in the future.
- ShadowPad backdoor exploiting vulnerabilities – Trend Micro Business Support
- Shadowpad – Privately sold malware espionage tool – Cymulate
- Attacks on industrial control systems using ShadowPad – Kaspersky ICS CERT
- A glimpse into the shadowy realm of a Chinese APT: detailed analysis of a ShadowPad intrusion – NCC Group Research
- ShadowPad (Malware Family) – Malpedia
- APT Hackers Targeting Industrial Control Systems with ShadowPad Backdoor
- ShadowPad Malware Detection: Backdoor Popular Among Chinese Clusters of Espionage Activity – SOC Prime
- China-Backed APT Pwns Building-Automation Systems With ProxyLogon – Dark Reading
- APT Hackers Targeting Industrial Control Systems with ShadowPad… – Vulners
- Group of Hackers Attack Asian Governments Using ShadowPad RAT Malware – GBHackers