KEYPLUG
- Type
- Backdoor
- Capabilities
- ReconnaissanceExfiltrationPost exploitationDefense evasion
- Platforms
- WindowsLinux
KEYPLUG is a modular backdoor implemented in C++ with Windows and Linux variants. It is used by multiple China-linked threat clusters, including APT41 and STORM-0866/Red Dev 40, rather than being exclusive to a single actor. Its use has been documented in intrusions against U.S. government entities and in operations targeting government organizations and telecommunications providers in the Middle East and South Asia.
KEYPLUG collects host information, exfiltrates system and user data, and manages plugins. It supports multiple command-and-control transports, including HTTP, TCP, UDP, WebSocket, TLS-encrypted WebSocket, QUIC, and KCP over UDP. It can retrieve the infected computer's tick count and use derived values for execution timing and protocol-specific keys.
The Windows variant can retrieve command-and-control addresses from encoded data embedded in posts on legitimate technology community forums, using these services as dead drop resolvers. Operators have also routed its communications through Cloudflare CDN infrastructure to conceal backend command-and-control servers. Deployment-related evasion techniques include splitting KEYPLUG binaries into multiple sections on disk and changing file extensions to hinder detection.
Associated vulnerabilities
2 CVEs Mallory has correlated with this family across public research and vendor advisories. Each card links to the full Mallory page for that vulnerability.
Associated threat actors
3 distinct threat actors Mallory has associated with this family across public reporting. Open in Mallory to see the full evidence chain and overlapping campaigns.
The modular backdoor KEYPLUG is a staple in STORM-0866/Red Dev 40’s arsenal. Mandiant first reported on KEYPLUG as part of intrusions into U.S. government entities by the Chinese APT group APT41.
The fake FBI domain is one of the group’s favourites... five of which are observed to be used as the C2 server for malware such as KEYPLUG, SOGU, Cobalt Strike BEACON, GRAYRABBIT and Gh0st.
Techniques & procedures
22 distinct techniques documented for this family, organized by ATT&CK tactic.
Persistence
1 technique
Persistence
“A PHP-based webshell capable of AES and XOR-decrypted payload execution was included.”
Stealth
5 techniques
Stealth
The content repeatedly describes payloads, strings, configuration files, scripts, URLs, and binaries being obfuscated or encoded using Base64, XOR, RC4, AES, RSA, hex encoding, custom algorithms, and other methods across many malware families and threat actors.
[KEYPLUG](https://attack.mitre.org/software/S1051) can use a hardcoded one-byte XOR encoded configuration file.(Citation: Mandiant APT41)
During the 2016 Ukraine Electric Power Attack, DLLs and EXEs with filenames associated with common electric power sector protocols were used to masquerade files.
APT28 has changed extensions on files containing exfiltrated data to make them appear benign.
[KEYPLUG](https://attack.mitre.org/software/S1051) can decode its configuration file to determine C2 protocols.(Citation: Mandiant APT41)
Credential Access
1 technique
Credential Access
At the heart of this new Winnti backdoor is a focused cloud credential harvesting engine that systematically walks through each major provider’s metadata and credential storage mechanisms. On AWS, the implant queries the instance metadata endpoint at 169.254.169.254 to extract IAM role credentials, while also reading the standard ~/.aws/credentials file if it exists. On GCP, it requests service account tokens from the metadata server and checks for application default credentials, and on Azure it pulls managed identity tokens from the IMDS endpoint and scans ~/.azure profiles. For Alibaba Cloud, the malware targets ECS metadata to obtain RAM role credentials and inspects the local Alibaba CLI configuration files.
Discovery
3 techniques
Discovery
Both backdoors first gather and exfiltrate system and user information in designated functions, with overlaps in gathered information (for example, MAC address, OS version, IP address, computer name, and username).
Both backdoors first gather and exfiltrate system and user information in designated functions, with overlaps in gathered information (for example, MAC address, OS version, IP address, computer name, and username).
[KEYPLUG](https://attack.mitre.org/software/S1051) can obtain the current tick count of an infected computer.(Citation: Mandiant APT41)
Command and Control
11 techniques
Command and Control
The malware uses KCP protocol for backdoor communication... This backdoor has 20 commands and connects with C2 servers via KCP over UDP.
[KEYPLUG](https://attack.mitre.org/software/S1051) has the ability to communicate over HTTP and WebSocket Protocol (WSS) for C2.(Citation: Mandiant APT41)
[KEYPLUG](https://attack.mitre.org/software/S1051) has used Cloudflare CDN associated infrastructure to redirect C2 communications to malicious domains.(Citation: Mandiant APT41)
"APT41 used a tool called CLASSFON to covertly proxy network communications." / "BADCALL functions as a proxy server between the victim and C2 server." / "Sandworm Team's BCS-server tool can create an internal proxy server to redirect traffic..."
"APT41 used the Cloudflare CDN to proxy C2 traffic." / "Earth Lusca adopted Cloudflare as a proxy for compromised servers." / "KEYPLUG has used Cloudflare CDN associated infrastructure to redirect C2 communications..." / "Gamaredon Group has used the Cloudflare Tunnel client to proxy C2 traffic."
[KEYPLUG](https://attack.mitre.org/software/S1051) can use TCP and KCP (KERN Communications Protocol) over UDP for C2 communication.(Citation: Mandiant APT41)
The [KEYPLUG](https://attack.mitre.org/software/S1051) Windows variant has retrieved C2 addresses from encoded data in posts on tech community forums.(Citation: Mandiant APT41)
LuaDream and KEYPLUG then instantiate threads designated for sending and receiving C2 data, establish connection to the C2 server, and continue to process backdoor commands and manage plugins. Plugin management includes loading and unloading plugins.
Examples include: "COATHANGER uses an HTTP GET request to initialize a follow-on TLS tunnel for command and control" and "Drovorub can use the WebSocket protocol and has initiated communication with C2 servers with an HTTP Upgrade request."
The content repeatedly describes malware and threat actors using SSL, TLS, HTTPS, RSA, AES, Blowfish, RC4, ECIES, Diffie-Hellman, OpenSSL, WolfSSL, and mutual TLS to protect command and control traffic.
[KEYPLUG](https://attack.mitre.org/software/S1051) can use TLS-encrypted WebSocket Protocol (WSS) for C2.(Citation: Mandiant APT41)
Exfiltration
1 technique
Exfiltration
Both backdoors first gather and exfiltrate system and user information in designated functions
Observables
18 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
Recent activity
23 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.