ClawWorm: Self-Propagating Attacks Across LLM Agent Ecosystems

Yihao Zhang, Zeming Wei, Xiaokun Luan, Chengcan Wu, Zhixin Zhang, Jiangrong Wu, Haolin Wu, Huanran Chen, Jun Sun, Meng Sun

TL;DR

ClawWorm is the first autonomous, self-replicating worm demonstrated against a production-scale LLM agent ecosystem (OpenClaw). Triggered by just a single conversational message, the worm tricks victim agents into rewriting their own core configuration files, achieving permanent persistence across reboots, executing arbitrary payloads (shell reconnaissance, resource exhaustion, or remote command-and-control), and propagating autonomously to peer agents without ongoing attacker intervention.

What Problem Does This Paper Address?

Modern AI agents are evolving from isolated chatbots into long-running, autonomous processes operating within interconnected ecosystems. Frameworks like OpenClaw give agents persistent workspaces, broad tool privileges (shell access, web browsing, file management), and access to multi-agent chat networks.

While prior work like the Morris II worm demonstrated prompt replication in toy sandboxes (e.g., simplified email assistants), security research has rarely explored real-world, production-scale multi-agent networks. Specifically, what happens when an agent's persistent configuration files and collaborative communication channels are weaponized into an autonomous, self-propagating worm?

Methods

ClawWorm targets five architectural trust boundaries in OpenClaw, most notably the flat context trust model (where models treat peer messages with the same authority as developer directives) and unconditional configuration loading (where Markdown workspace files are loaded directly into the system prompt on restart).

The worm operates via a three-phase lifecycle:

  1. Dual-Anchor Persistence: Through an autonomous multi-turn dialogue, the worm convinces a victim agent to write its malicious instructions into AGENTS.md. The first anchor schedules execution in the agent's Session Startup block; the second anchor injects a global interaction rule instructing the agent to broadcast the worm during any routine message reply.
  2. Payload Execution: On every subsequent session startup, the framework unconditionally injects the hijacked AGENTS.md into the system prompt, triggering payload execution (P1: shell reconnaissance, P2: CPU/token exhaustion, or P3: dynamic remote command-and-control via URL fetching).
  3. Autonomous Propagation: Whenever the agent interacts in shared channels, its injected rule compels it to transmit the payload to new peers via one of three attack vectors:
  4. Vector A (Web Injection): Shares an attacker URL serving the setup instructions.
  5. Vector B (Skill Supply Chain Poisoning): Directs peers to install a poisoned package from the community marketplace (ClawHub).
  6. Vector C (Direct Instruction Replication): Transmits payload code directly into the chat with a word-by-word verification handshake.
+-----------------------------------------------------------------------------------+
|                            ClawWorm Infection Lifecycle                           |
|                                                                                   |
|  [Channel Message] ---> (1) Phase I: Dual-Anchor Persistence                      |
|                                Writes payload into AGENTS.md                      |
|                                       |                                           |
|                                       v                                           |
|                         (2) Phase II: Payload Execution                           |
|                                Auto-fires on session reboot (P1, P2, or P3)       |
|                                       |                                           |
|                                       v                                           |
|                         (3) Phase III: Autonomous Propagation                     |
|                                Piggybacks onto routine channel replies to peers   |
+-----------------------------------------------------------------------------------+

Datasets

The authors did not train models on traditional datasets. Instead, they built an isolated multi-agent testbed running unmodified OpenClaw (version 2026.3.12) to evaluate real execution:

  • Factorial Testbed: 1,800 independent trials crossing 3 attack vectors $\times$ 3 payloads $\times$ 4 frontier LLM backends (Minimax-M2.5, DeepSeek-V3.2, GLM-5, and Kimi-K2.5), running 50 trials per condition.
  • Supplementary Evaluations: 90 trials evaluating memory contamination persistence over 5 consecutive reboots, and 90 multi-hop cascading chains evaluating propagation up to 5 hops.

Key Insights and Ideas

  • Asymptomatic Carriers: Execution-layer filtering does not stop worm propagation. For example, Kimi-K2.5 often filtered out dangerous shell commands during reboot ($\phi_2 = 0.48$), but because persistence succeeded ($\phi_1 = 0.65$), the agent continued to propagate the payload via routine chat ($\phi_3 = 0.55$).
  • The Supply Chain is Universally Vulnerable: While models varied widely in their resistance to chat-based injection, the skill package vector (Vector B) achieved an 81% aggregate success rate, effortlessly bypassing safety reasoning even on security-conscious models.
  • Semantic Degradation Limits Pure Text Worms: In Vector C, where payloads pass through the LLM's own text generation, phrasing naturally degraded over successive hops (e.g., softening from an authoritative "directive" to a mild "peer suggestion"), capping propagation at an average of 3.0 hops. Conversely, file- and URL-based vectors (A and B) maintained perfect fidelity across hops.
  • Absorbing States in Epidemiological Spread: Once an agent's configuration is modified, it never self-corrects (100% persistence across reboots). In epidemiological modeling, this makes infection an absorbing state: even if the interaction degree is reduced so the reproduction rate $R_0 < 1$, eventual ecosystem saturation reaches 100% without active self-healing defenses.

Key Results

  • Aggregate Attack Success Rate (ASR): Achieved 64.5% overall across all 1,800 trials.
  • Model Susceptibility: Minimax-M2.5 (84% ASR) and DeepSeek-V3.2 (78% ASR) showed high compliance, whereas GLM-5 (56%) and Kimi-K2.5 (40%) demonstrated stronger baseline resistance.
  • Autonomous Retries Amplify Risk: Allowing an attacking agent up to 3 conversational retry attempts increased ASR dramatically (e.g., DeepSeek-V3.2 increased by +24 percentage points, jumping from 54% on the first attempt to 78%).
  • Multi-Hop Propagation: Vectors A and B sustained cascading propagation chains averaging 4.1 and 4.8 hops, respectively.

Limitations and Future Work

  • Testbed vs. Wild Traffic: Experiments were conducted in isolated networks. Real-world channels feature message noise, human oversight, and platform-specific content moderation that could disrupt propagation chains.
  • Fixed Prompt Templates: The evaluation relied on static prompt templates; adaptive or personalized social engineering strategies were not explored.
  • Proposed Defenses: The authors outline four architecture-level countermeasures:
  • Context privilege isolation (separating untrusted chat tokens from system instructions).
  • Configuration integrity verification (cryptographic signing and pattern scanning for AGENTS.md).
  • Zero-trust tool execution (treating URL retrieval with the same sensitivity as shell execution).
  • Skill marketplace hardening (sandboxing and static analysis on ClawHub).

Summary updated

BibTeX
@misc{zhang2026clawworm,
  author = {Yihao Zhang and Zeming Wei and Xiaokun Luan and Chengcan Wu and Zhixin Zhang and Jiangrong Wu and Haolin Wu and Huanran Chen and Jun Sun and Meng Sun},
  title = {{ClawWorm: Self-Propagating Attacks Across LLM Agent Ecosystems}},
  year = {2026},
  eprint = {2603.15727},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.15727},
}
Figure