Skip to content
NewCybercrime Report 2026 · Eight Chapters · A Post Is Not An Incident → Explore The ChaptersCybercrime Report 2026 → Explore

Odin Research / What is / Malware and backdoors

What Is P2PInfect? The Rust Peer-to-Peer Worm That Targets Redis

A self-spreading worm that turns exposed Redis servers into a peer-to-peer botnet, and later added ransomware and a miner: how it works and how to keep it out.

By
Odin by Brandefense
Updated
21 Nov 2026
Reading time
7 min read
Type
Worm (peer-to-peer botnet)

In short

P2PInfect is a self-replicating worm written in Rust that spreads through Redis servers exposed to the internet and, less often, through SSH. Infected hosts join a peer-to-peer botnet with no single control server. Palo Alto Networks Unit 42 first described it in July 2023. By 2024 it also delivered a Monero miner and ransomware.

Key takeaways

What it is
A Rust worm for Linux and Windows that recruits exposed Redis servers into a peer-to-peer mesh. Unit 42 first documented it on 19 July 2023.
How it spreads
Unit 42 saw it exploit CVE-2022-0543, a Debian-specific Redis Lua sandbox escape. Cado Security, now part of Darktrace, saw it abuse Redis replication and spray SSH passwords.
What it delivers
Darktrace reported a ransomware binary called rsagen, a Monero miner and a user-mode rootkit in 2024.
What Odin Research saw
16 P2PInfect nodes in Monograph 29, 15 on Alibaba Cloud, mostly on high ports 60103 to 60140. They are most likely infected third-party servers, so no addresses are published.
What to do first
Take Redis off the public internet, turn on protected mode and ACL authentication, and require key-only SSH on cloud servers.

What is P2PInfect?

P2PInfect is a self-replicating worm written in Rust that spreads through Redis databases exposed to the internet and, less often, through weak SSH passwords. Each infected server joins a peer-to-peer botnet instead of reporting to one control server. Later versions added ransomware and a cryptocurrency miner.

Palo Alto Networks Unit 42 first described P2PInfect on 19 July 2023, in research by William Gamazo and Nathaniel Quist. They called Rust a highly scalable and cloud-friendly language, and found builds for both Linux and Windows. The researchers note that Redis does not officially support Windows.

Cado Security found the worm independently in July 2023 while triaging honeypot data. Cado is now part of Darktrace, which published a June 2024 update on the worm's new payloads.

How P2PInfect works

P2PInfect uses more than one way into Redis:

  • A Lua sandbox escape. Unit 42 saw it exploit CVE-2022-0543. NVD describes it as a Debian-specific packaging issue that makes Redis prone to a Lua sandbox escape, which could result in remote code execution. It scores 10.0 (critical) and is in CISA's Known Exploited Vulnerabilities catalog since 28 March 2022.
  • Replication abuse. Darktrace describes the worm making a discovered Redis node a follower of the attacker's server. It then writes a shared object file and has the node load it, which gives code execution.
  • Configuration abuse. A second vector abuses Redis configuration commands to write a cron job.
  • SSH spraying. A limited SSH password sprayer is also built in. Darktrace calls it far less effective than the Redis vector.

After the first foothold, Unit 42 says a dropper joins the peer-to-peer network over TLS 1.3 and fetches more payloads, including OS-specific scripts and scanners. Each new host then scans for other exposed Redis servers and for SSH on port 22. Unit 42 also notes an auto-update capability and a variable peer-to-peer port that resists blocking.

To measure the attack surface, Unit 42 counted more than 307,000 unique Redis systems communicating publicly over two weeks. Of those, 934 may have been vulnerable.

P2PInfect versions and payloads

For its first year, P2PInfect spread widely but did little visible harm. Darktrace's June 2024 write-up by Nate Bill describes what changed.

  • Ransomware. A botnet command, created on 16 May 2024 and valid until 17 December 2024 by its timestamps, told nodes to download and run a binary called rsagen. It encrypts files with listed extensions and appends .encrypted. Because Redis runs with low privileges and holds few user files, its impact is limited.
  • A miner. A Monero miner that had been embedded but unused now starts about five minutes after the main payload. See our page on XMRig for miner detection.
  • A rootkit. A user-mode rootkit added through LD_PRELOAD in users' .bashrc files hides processes, files and a port range. Darktrace says it fails when entry is through Redis, because it only affects the Redis service account.

Darktrace weighed whether P2PInfect is a botnet for hire. The main binary and rsagen share a compiler string, which suggests one author built both, and it judged initial access brokerage unlikely.

What Odin Research observed

Monograph 29 treated P2PInfect as part of a cloud and edge worm layer, next to the Moobot variant of Mirai.

  • 16 nodes. 15 (93.8%) sat on Alibaba Cloud: 12 in Singapore, 2 in China and 1 in Hong Kong.
  • High gossip ports. 12 nodes used ports between 60103 and 60140. Two used 6088, one 8281 and one 9684.
  • Self-signed certificates. Two nodes presented a self-signed CN=gateway with a shared TLS fingerprint prefix, and three a self-signed CN=localhost.
  • Victims, not adversaries. The report treats the nodes as most likely infected third-party servers. Blocking them would hurt their owners as much as the worm, and publishing them would expose those owners. No addresses are published, and all 16 stay on watchlists.

Several nodes were seen on 19 November 2026, which suggests the mesh was still active then.

How to detect P2PInfect

  • Peer traffic. Monograph 29 publishes Suricata SID 9529004 for a /p2p/peers request with an X-Peer-Node: header on ports 6088, 8281, 9684 and 60103 to 60140.
  • Odd children of Redis or SSH. A Sigma rule in the same report needs a parent of redis-server or sshd and a command line with a worm port, p2pinfect or slaveof.
  • Unexpected replication. Alert when a Redis server you run suddenly becomes a follower of an unknown host, or loads a module you did not install.
  • Host artifacts. Unit 42 advises checking for random file names in /tmp. Darktrace's write-up points to new LD_PRELOAD lines in .bashrc, kworker-like processes running from /tmp and .encrypted files.

The KQL hunt and a YARA rule for P2PInfect peer configurations are in the report and the Defense Kit.

How to defend against P2PInfect

  1. Never expose Redis. The Redis security guide says Redis is designed for trusted clients in trusted environments, and its port should be firewalled from the outside.
  2. Keep protected mode and use ACLs. Since Redis 3.2.0, protected mode answers only loopback clients when no password is set. Redis 6 adds Access Control Lists, which the guide recommends over a single shared password.
  3. Limit dangerous commands. The guide shows how ACL rules can stop normal clients from using CONFIG, and recommends running Redis as an unprivileged user.
  4. Patch Debian Redis packages against CVE-2022-0543. See How to respond to actively exploited vulnerabilities.
  5. Use key-only SSH on cloud servers, as Monograph 29 advises, to defeat password spraying.

Most of this is basic misconfiguration hygiene. Find exposed databases before a worm does with external attack surface management.

P2PInfect compared with other botnet worms

WormMain targetsControl modelOdin sightings
P2PInfectExposed Redis, SSHPeer-to-peer mesh over TLS16 nodes (Monograph 29)
MoobotEdge devices; a Mirai variantPayloads staged over plain HTTP2 nodes (Monograph 29)
MoziConsumer routers and gatewaysPeer-to-peer DHT mesh263 endpoints (Monograph 19)
MiraiConsumer routersInfected routers reused as relays353 endpoints, 63 protocol-confirmed (Monograph 19)

Frequently asked questions about P2PInfect

What is P2PInfect?

P2PInfect is a self-replicating worm written in Rust that spreads through exposed Redis servers and SSH. Infected hosts form a peer-to-peer botnet. Unit 42 first described it in July 2023.

Is P2PInfect ransomware?

Not at first. Darktrace reported in June 2024 that the botnet began delivering a ransomware binary called rsagen, along with a Monero miner and a rootkit.

Which vulnerability does P2PInfect exploit?

Unit 42 saw it exploit CVE-2022-0543, a Debian-specific Lua sandbox escape in Redis packages, rated 10.0 by NVD. Darktrace also describes abuse of Redis replication and configuration commands.

Does P2PInfect affect Windows?

Yes. Unit 42 found builds for both Linux and Windows, and described Windows persistence steps such as a firewall rule and a monitor process.

Who is behind P2PInfect?

No public attribution was verified for this page. Darktrace judged a botnet-for-hire model unlikely, because the main binary and the ransomware appear to share one author.

How do I detect P2PInfect?

Look for /p2p/peers requests on high ports, Redis or sshd spawning unusual commands, unexpected Redis replication and random files in /tmp. Odin Research publishes Suricata, Sigma, KQL and YARA rules in Monograph 29.

How do I protect Redis from P2PInfect?

Keep Redis off the internet, leave protected mode on, use ACL authentication, restrict the CONFIG command, run it as an unprivileged user and patch Debian packages.

P2PInfect vs Mirai: what is the difference?

In Odin Research data, Mirai sits on infected consumer routers. P2PInfect sits on cloud servers with exposed Redis or SSH, and links them in a peer-to-peer mesh with no single control point.

Sources

  1. Palo Alto Networks Unit 42, William Gamazo and Nathaniel Quist, "P2PInfect: The Rusty Peer-to-Peer Self-Replicating Worm", 19 July 2023. unit42.paloaltonetworks.com/peer-to-peer-worm-p2pinfect/ (checked 21 November 2026)
  2. Darktrace, Nate Bill, "From Dormant to Dangerous: P2Pinfect Evolves to Deploy New Ransomware and Cryptominer", 25 June 2024. darktrace.com/blog/from-dormant-to-dangerous-p2pinfect-evolves-to-deploy-new-ransomware-and-cryptominer (checked 21 November 2026)
  3. NVD, CVE-2022-0543. nvd.nist.gov/vuln/detail/CVE-2022-0543 (checked 21 November 2026)
  4. Redis documentation, Redis security. redis.io/docs/latest/operate/oss_and_stack/management/security/ (checked 21 November 2026)

Related tools and terms

All Odin Research explanations · Brandefense glossary

Odin Research

Get the rules, not just the definition

Every Odin Research report ships with verified indicators and detection rules you can load today.

Open the Defense Kit