AgentWorm: 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

Here is a blog-style summary of the research paper detailing the mechanics and implications of AgentWorm.

TL;DR

This paper introduces AgentWorm, the first autonomous, self-replicating worm attack targeting production-scale Large Language Model (LLM) agent ecosystems. Triggered by a single adversarial message, AgentWorm hijacks an agent's core configuration files to establish permanent persistence, execute arbitrary payloads upon reboot, and propagate itself to neighboring agents. Across five frontier LLMs, the attack achieves a staggering 63% aggregate success rate, exposing critical architectural vulnerabilities in how modern AI agents handle trust and data.

What Problem Does This Paper Address?

As large language models transition from static chatbots to autonomous agents, they are increasingly deployed as long-running processes within interconnected multi-agent ecosystems (such as the open-source platform OpenClaw). These agents possess broad system privileges, including shell execution, file management, and cross-platform messaging.

However, their security properties remain dangerously understudied. Prior work on self-replicating prompts (like the Morris II worm) was limited to toy sandboxes or single-hop scenarios. This paper addresses the structural vulnerabilities of real-world, production-scale agent architectures. Specifically, it focuses on how a "flat context trust model"—where an LLM treats system instructions and external user messages with equal weight—allows cross-instance prompt propagation to become a full-fledged, multi-hop autonomous worm.

Methods

The authors design AgentWorm, a malicious pipeline that operates across three distinct phases:

  1. Persistence: The worm uses a multi-turn handshake protocol with autonomous retry to trick a victim agent into writing the malicious payload into its core configuration file (AGENTS.md). It uses a dual-anchor mechanism: Anchor 1 ensures execution on session startup, and Anchor 2 injects a global interaction rule to trigger propagation during routine channel replies.
  2. Execution: Upon framework reboot, the workspace configuration files are loaded unconditionally into the system prompt, executing the payload with full tool privileges.
  3. Propagation: The infected agent extracts the payload from its own configuration and appends it to messages sent to newly encountered peers.
Fig. 2: Overall illustration of the AgentWorm pipeline. The self-replication cycle comprises three phases: establishing dual- anchor persistence via an adversarial message, auto-firing the payload upon session restart, and autonomously propagating the full payload to new peers.

The attack is evaluated using three Attack Vectors: Web Injection (Vector A), Skill Supply Chain Poisoning via a community marketplace (Vector B), and Direct Instruction Replication (Vector C). It carries three distinct Payloads: Reconnaissance (P1), Resource Exhaustion (P2), and Command-and-Control (P3).

Datasets

Rather than using a traditional machine learning dataset, the authors built a rigorous evaluation testbed and conducted an ecosystem-wide measurement:

  • Evaluation Testbed: 2,250 independent trials crossing 3 vectors, 3 payloads, and 5 frontier LLM backends (Minimax-M2.5, DeepSeek-V3.2, GLM-5, Kimi-K2.5, and Nemotron-3-Super-120B).
  • Ecosystem Analysis: The authors collected and analyzed 104 public openclaw.json configuration files across 88 GitHub repositories, alongside 393 SOUL.md files from major community repositories (awesome-openclaw-agents and soulhub) to evaluate real-world defense adoption.

Key Insights and Ideas

  • The "Asymptomatic Carrier" Paradox: Standard execution-level filtering (like blocking shell commands) stops the malicious payload from running, but fails to stop the agent from persisting and propagating the worm. This creates "asymptomatic carriers" that spread the infection silently throughout the ecosystem.
  • The Flat Context Trust Model is Broken: Agents fail to distinguish between system/owner instructions and untrusted data from channel peers. When an adversarial message mimics administrative authority, the agent's reasoning engine genuinely concludes that modifying its own configuration is a legitimate task.
  • Prompt-Level Defenses Fail Against Configuration Hijacking: Even advanced, configuration-specific natural language guardrails fail because the model reads both the defense rule and the malicious payload from the same trusted file, assigning them equal authority and often favoring the actionable exploit.
  • Structural, Not Idiosyncratic: By successfully transferring the attack to an entirely separate framework (Hermes Agent), the authors prove that these vulnerabilities are inherent to the autonomous agent design pattern itself, not just bugs in a single codebase.

Key Results

  • High Success Rates: AgentWorm achieved a 63% aggregate attack success rate (ASR) across all tested models. Vector B (Skill Supply Chain Poisoning) was the most devastating, yielding an 82% aggregate ASR and consistently bypassing safety reasoning across all models.
TABLE II: Comprehensive attack success rate (φ1 ∧φ2 ∧φ3) across all models, vectors, and payloads. n = 50 per cell (2,250 total trials). A deeper red colour indicates a higher attack success rate.
  • The Power of Persistence: Multi-turn autonomous retries significantly wore down LLM guardrails, boosting DeepSeek-V3.2's success rate from 54% on the first attempt to 78% overall.
  • Ecosystem Saturation: Epidemiological modeling shows that in a network of 40,000 active instances, a compliant model would reach near-total saturation within just 7 to 8 interaction cycles.
  • The Defense Disconnect: Tracks of real-world deployments revealed a terrifying reality: 0% of observed public deployments had sandboxing or execution restrictions enabled. Instead, operators heavily favored gateway authentication, which offers zero protection against an already-authenticated peer. Meanwhile, built-in sandbox isolation (C3) completely neutralized the worm (0% ASR) in testing.

Limitations and Future Work

The authors note several limitations in their current evaluation:

  • Simplified Environments: The testbed lacked the continuous background noise (human chatter, benign agent traffic) of real-world production channels, which might dilute the worm's salience.
  • Fixed Templates: The adversarial prompts relied on fixed templates; dynamic or highly optimized social engineering might yield different compliance rates.
  • Human Intervention: Real-world human operators might notice suspicious configuration changes or overhead and manually intervene.

Future Work: The authors urge framework developers to shift to a "secure-by-default" posture (e.g., shipping with sandbox isolation enabled by default). They also recommend exploring context privilege isolation (partitioning the context window into trusted/untrusted zones) and implementing mandatory static analysis and cryptographic signatures for third-party skill marketplaces.

Summary updated

Abstract

Autonomous LLM-based agents increasingly operate as long-running processes forming densely interconnected multi-agent ecosystems, whose security properties remain largely unexplored. Systems such as OpenClaw, an open-source platform with over 40{,}000 active instances, persistent configurations, tool-execution privileges, and cross-platform messaging, are deployed at scale, yet the security of such agent ecosystems remains largely unexplored. This work presents AgentWorm, the first self-replicating worm attack against a production-scale agent framework, achieving a fully autonomous infection cycle initiated by a single message: the worm first hijacks the victim's core configuration to establish persistent presence across session restarts, then executes an arbitrary payload upon each reboot, and finally propagates itself to every newly encountered peer without further attacker intervention. The attack is evaluated on a controlled testbed across five distinct LLM backends, three infection vectors, and three payload types. Results show a 63\% aggregate attack success rate, sustained multi-hop propagation, and stark divergences in model security postures, highlighting that while execution-level filtering effectively mitigates dormant payloads, skill supply chains remain universally vulnerable. Defenses are evaluated at three layers (prompt-level mitigations sourced from real community practice, the framework's built-in security controls, and an ecosystem-wide measurement of public configurations), revealing that the critical controls capable of breaking the infection loop are not enabled in any of the observed deployments. A cross-framework transferability experiment on Hermes Agent confirms that the underlying vulnerabilities are properties of the autonomous agent design pattern, not artifacts of a single implementation.
BibTeX
@misc{zhang2026agentworm,
  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 = {{AgentWorm: Self-Propagating Attacks Across LLM Agent Ecosystems}},
  year = {2026},
  eprint = {2603.15727},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.15727},
}
Figure