In short
KeyPlug is a modular backdoor written in C++, with Windows and Linux variants, that the China-nexus group APT41 has used since at least June 2021. It talks to its controllers over HTTP, TCP, KCP over UDP or WebSocket over TLS. Mandiant reported its use against US state government networks and after Log4Shell exploitation.
Key takeaways
- What it is
- A custom modular C++ backdoor for Windows and Linux, tracked by MITRE ATT&CK as S1051 and tied to APT41.
- How it works
- It decodes a one-byte XOR config, then reaches its controller over HTTP, TCP, KCP over UDP or WebSocket over TLS, sometimes through Cloudflare.
- Why it matters
- Mandiant tied it to intrusions at US state governments, and Recorded Future to a wide target set across many sectors.
- What Odin Research saw
- Five KeyPlug candidate endpoints on four IPs. Two presented the default wolfSSL sample certificate, CN=www.wolfssl[.]com.
- What to do first
- Hunt the wolfSSL test certificate, alert on servers dialing out to ports 10443 and 10444, and patch internet-facing apps fast.
What is KeyPlug?
KeyPlug is a modular backdoor written in C++, with variants for Windows and Linux, used by the China-nexus group APT41 since at least June 2021. It gives the operator long-term remote access and can talk to its controller over several protocols. Mandiant described it in detail in a March 2022 report.
MITRE ATT&CK tracks it as software S1051 and lists APT41 as its user. Mandiant tracks the Linux port separately as KEYPLUG.LINUX. The names are usually written in capitals in vendor reports.
KeyPlug is custom malware, not a public tool. Unlike red team frameworks, it has no legitimate user base. Finding it on a host means a backdoor is present, and the response should treat it as an espionage intrusion.
How KeyPlug works
According to Mandiant and MITRE ATT&CK, KeyPlug works like this:
- Encoded configuration. The settings are stored with one-byte XOR encoding and decoded at run time.
- Several C2 protocols. It supports HTTP, raw TCP, KCP over UDP and WebSocket over TLS (WSS). Mandiant described WSS as a newly added capability in 2022.
- Cloudflare in front. In the WSS mode, the configuration lists Cloudflare CDN address ranges. KeyPlug picks a random address in a range, and Cloudflare forwards the traffic to the real C2 domain. This hides the true server and makes blocking harder.
- Dead drop resolvers. In several cases, the Windows variant fetched its real C2 address from encoded data in posts on two tech community forums (T1102.001).
- Evasion on Linux. Mandiant saw a KEYPLUG.LINUX binary packed with VMProtect but given UPX section names, and split into four files to hinder forensic collection.
MITRE ATT&CK maps these behaviors to web protocols (T1071.001), TLS encrypted channels (T1573.002), non-application layer protocols (T1095) and proxies (T1090).
How APT41 has used KeyPlug
- US state governments. Mandiant reported in March 2022 that APT41 heavily used the Windows KeyPlug variant at US state government victims between June and December 2021.
- After Log4Shell. Mandiant said APT41 exploited Log4Shell (CVE-2021-44228) within hours of the December 2021 advisory, then deployed KEYPLUG.LINUX on Linux servers at several victims.
- A wide target set. Recorded Future's Insikt Group calls the related activity RedGolf, a group it assesses closely overlaps with APT41. It tracks a cluster of KeyPlug samples and infrastructure, which it calls GhostWolf, from at least 2021 to 2023. Targets included aviation, automotive, education, government, media, IT and religious organizations.
Recorded Future also reported that RedGolf uses Cobalt Strike and PlugX next to KeyPlug.
The wolfSSL slip. In May 2025, wolfSSL wrote about a KeyPlug-linked server identified by its test certificate. That certificate ships with wolfSSL as a sample, its private key is public, and its subject is www.wolfssl[.]com. wolfSSL warned never to use test certificates in production.
What Odin Research observed
Monograph 27 grouped KeyPlug with other modular implants that keep footholds on Linux and Windows.
- Five candidates, four IPs. KeyPlug endpoints listened on ports 10443, 10444, 8443 and 443. None was confirmed, so all addresses are withheld.
- The default wolfSSL certificate. Two endpoints presented
CN=www.wolfssl[.]com, the library's unchanged sample certificate: one on Hangzhou Alibaba in China on 10443, one on Baxet Group in Spain on 443. The report calls this default rare on a real service and easy to hunt. - Paired ports. One Alibaba-hosted host listened on both 10443 and 10444, seen on 18 and 19 November 2026.
- Raw and WebSocket transports. The report notes that KeyPlug in binary mode on 10443 and 10444 skips HTTP framing, so network rules need TLS certificate checks and endpoint data.
A certificate match is a strong lead, not attribution. Odin Research does not tie these endpoints to APT41.
How to detect KeyPlug
- Test certificates. Alert on TLS server certificates with the subject
www.wolfssl[.]com. wolfSSL also lists 1024-bit keys and test-style organizational units as warning signs. - Server egress to odd ports. Servers rarely need outbound sessions to ports 10443 or 10444. Alert and check the process.
- WebSocket paths. Odin Research's rules look for WebSocket upgrades to
/ws/keyplugon 443, 8443, 8888, 10443 or 10444. - Config markers. Mandiant published a YARA rule that matches KeyPlug's XOR-encoded config strings, such as
TCP://,UDP://andWSS://, in ELF and PE files. - Forum lookups. On Windows, look for unusual processes reading tech forum pages, which can be dead drop resolvers.
Monograph 27 carries a Suricata signature for KeyPlug WebSocket transport, a Sentinel KQL hunt, a Sigma rule for KeyPlug daemons on Linux and a YARA rule for KeyPlug relay files. They are in the Defense Kit.
How to respond to KeyPlug
- Treat it as espionage. KeyPlug is custom state-linked malware. Engage your incident response plan and preserve memory and disk images.
- Find the way in. Mandiant tied KeyPlug deployments to web application exploitation, including Log4Shell. Check exposed apps and patch them. See how to respond to exploited vulnerabilities.
- Look past the CDN. Blocking one Cloudflare address does little. Block the C2 domain instead and hunt for other hosts that resolve it.
- Hunt for siblings. APT41 activity often involves several tools. Look for other backdoors before you rebuild.
KeyPlug compared with similar backdoors
| Tool | Type | Notes |
|---|---|---|
| KeyPlug | Custom APT41 backdoor | Five protocols, Cloudflare fronting, wolfSSL test certificate seen |
| ShadowPad | Modular backdoor | See our ShadowPad profile |
| ReverseSSH | Reverse SSH multiplexer | 36 endpoints, the largest family in Monograph 27 |
| Platypus | Go reverse-shell multiplexer | 2 candidates in Monograph 27 |
Frequently asked questions about KeyPlug
What is KeyPlug?
KeyPlug is a modular C++ backdoor with Windows and Linux variants. APT41 has used it since at least June 2021. It talks to its controller over HTTP, TCP, KCP over UDP or WebSocket over TLS.
Who uses KeyPlug?
MITRE ATT&CK attributes KeyPlug to APT41, a China-nexus group. Recorded Future tracks related activity as RedGolf, which it assesses closely overlaps with APT41.
Is KeyPlug malware?
Yes. KeyPlug is custom backdoor malware with no legitimate use. Finding it on a system should trigger a full incident response.
What is KEYPLUG.LINUX?
KEYPLUG.LINUX is the Linux port of KeyPlug. Mandiant reported that APT41 deployed it on Linux servers after exploiting Log4Shell in December 2021.
How does KeyPlug use Cloudflare?
In its WebSocket over TLS mode, KeyPlug's configuration lists Cloudflare CDN address ranges. It connects to a random address in a range, and Cloudflare forwards the traffic to the real C2 domain.
What is the wolfSSL certificate link?
Some KeyPlug servers kept wolfSSL's sample certificate, with the subject www.wolfssl[.]com. Its private key is public, so it should never appear on a real service. That makes it a useful hunting pivot.
How do I detect KeyPlug?
Hunt for the wolfSSL test certificate, server egress to ports 10443 and 10444, WebSocket upgrades to /ws/keyplug and KeyPlug's XOR-encoded config strings. Odin Research publishes matching rules in its Defense Kit.
Sources
- MITRE ATT&CK, KEYPLUG (S1051). attack.mitre.org/software/S1051/ (checked 21 November 2026)
- Mandiant (Google Cloud), "Does This Look Infected? A Summary of APT41 Targeting U.S. State Governments", 8 March 2022. cloud.google.com/blog/topics/threat-intelligence/apt41-us-state-governments (checked 21 November 2026)
- Recorded Future Insikt Group, "With KEYPLUG, China's RedGolf Spies On, Steals From Wide Field of Targets". www.recordedfuture.com/research/with-keyplug-chinas-redgolf-spies-on-steals-from-wide-field-targets (checked 21 November 2026)
- wolfSSL, "Test Certificates in Production: KeyPlug's WolfSSL Misconfiguration Leads to Infrastructure Exposure", May 2025. www.wolfssl.com/test-certificates-in-production-keyplugs-wolfssl-misconfiguration-leads-to-infrastructure-exposure/ (checked 21 November 2026)
Related tools and terms
What is XWorm?
XWorm is a commodity .NET remote access trojan sold to criminals. It offers remote control, keylogging and plugin modules.
Remote access trojanWhat is Quasar?
Quasar is an open-source .NET remote access tool for Windows that criminals and some state actors use as a RAT.
Remote access trojanWhat is AsyncRAT?
AsyncRAT is an open-source .NET remote access trojan widely used in commodity malware campaigns.
Remote access trojanWhat is DCRat?
DCRat (DarkCrystal RAT) is a low-cost commodity .NET remote access trojan sold on underground forums.
Remote access trojanWhat is VenomRAT?
VenomRAT is a commodity remote access trojan descended from the Quasar and AsyncRAT code bases.
Remote access trojanWhat is PureRAT?
PureRAT, also tracked as PureHVNC, is a commercial modular .NET remote access trojan with hidden-desktop control.
Odin Research
Get the rules, not just the definition
Every Odin Research report ships with verified indicators and detection rules you can load today.