KEYPLUG is a modular backdoor written in C++ and active since at least 2021. It has Windows and Linux variants and is closely associated with China-linked espionage activity, especially APT41 and related clusters including STORM-0866/Red Dev 40. The malware has also been assessed as likely shared across multiple suspected China-based intrusion sets, reflecting broader tooling overlap in that ecosystem.
KEYPLUG supports flexible command-and-control communications across multiple protocols, including HTTP, TCP, KCP over UDP, and TLS-encrypted WebSockets. Operators have also used Cloudflare CDN-associated infrastructure to proxy or redirect its command-and-control traffic, and the Windows variant has retrieved command-and-control addresses from encoded data embedded in posts on tech community forums, functioning as dead drop resolvers. Reported behavior also includes obtaining the current tick count from infected systems.
Operational reporting places KEYPLUG in intrusions against government entities, including U.S. government targets, and in campaigns focused on telecommunications providers and government organizations in the Middle East and South Asia. It has also been linked to activity targeting a major Japanese enterprise in operations involving exploitation of Fortinet devices, staging infrastructure, reconnaissance tooling, and webshell deployment. In victim environments, KEYPLUG has been observed coexisting with other espionage implants, underscoring its role as a maintained post-compromise access platform.
The malware is regarded as a staple backdoor in long-term espionage operations because of its modular design, multi-protocol networking, and adaptable infrastructure tradecraft.
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.
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.
22 distinct techniques documented for this family, organized by ATT&CK tactic.
“A PHP-based webshell capable of AES and XOR-decrypted payload execution was included.”
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)
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.
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)
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)
Both backdoors first gather and exfiltrate system and user information in designated functions
18 indicators attributed across vendor reports, sandbox runs, and researcher write-ups. Values are masked here and available in full in Mallory.
20 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.