What is an AI worm?
An AI worm is an attack in which a self-replicating adversarial prompt spreads between generative AI-powered applications through indirect prompt injection, without user interaction, making each infected application perform malicious actions.
Unlike plain indirect prompt injection, which hijacks one application through instructions hidden in data it processes, an AI worm makes those instructions copy themselves into the model's output so they pass to other applications, such as other assistants via email. The aim is often data exfiltration.
- Topic
- AI security
- Origin
- Cohen, Bitton and Nassi, 2024
How an AI worm works
- The attacker crafts a prompt asking the model both to act maliciously and to copy the prompt into its output.
- The prompt is planted in data an AI assistant will process, such as an email or document.
- On retrieval the prompt runs; the assistant leaks data and copies the prompt into its reply.
- When the reply reaches other users or assistants, it enters their retrieval systems and the chain continues.
In more detail
Multimodal propagation and RAG triggering (Morris II)
In the landmark Morris II demonstration, researchers used adversarial self-replicating prompts both inside plain text emails and embedded as imperceptible perturbations inside image attachments processed by multimodal assistants. Crucially, the attack requires an external retrieval or propagation loop, such as RAG indexing incoming messages and automated outbound actions, to achieve zero-click spread.
Lateral spread across multi-agent systems, shared memory and MCP
Beyond email assistants, enterprise agentic architectures introduce new worm vectors across shared vector databases, collaborative messaging bots, issue trackers and MCP tool outputs. If one infected agent writes a poisoned summary into a shared knowledge base, every subsequent agent or user querying that store can become infected.
Polymorphic worms and structural defences (dual-LLM, CaMeL)
Pattern-matching output guardrails alone are brittle against polymorphic worms that paraphrase or obfuscate their payload across hops. Structural defences rely on control/data flow separation, such as the Dual-LLM pattern or capability-based architectures like CaMeL, alongside strict capability scoping, tainted-data tracking and deterministic approval gates on state-changing tool calls.
Commonly confused terms
| Term | How it differs |
|---|---|
| Indirect prompt injection | Standard indirect prompt injection compromises a single session or victim through hidden instructions in retrieved data; an AI worm adds a self-replicating payload that forces the model to copy the exploit into outbound messages so it autonomously infects downstream assistants. |
| AI data poisoning | Data poisoning corrupts training or fine-tuning datasets offline to implant persistent biases or backdoors into model weights; an AI worm leaves model weights untouched and propagates at inference time across connected applications and shared context. |
| Traditional network worm | Traditional software worms exploit memory-corruption or OS/network protocol bugs to replicate binary code; AI worms exploit the inability of LLMs to reliably separate untrusted data from executable instructions in natural language or multimodal inputs. |
Why an AI worm matters for on-premises AI
The first comprehensive study of indirect prompt injection shows language model integrated applications blur the line between data and instructions, letting attackers plant prompts in data likely to be retrieved, with impacts including data theft and worming. A paper on zero-click AI worms shows a self-replicating prompt among retrieval-based email assistants can extract confidential user data through cascading injections, while a guardrail detecting the spread blocks it with few false positives.
A consultancy stops its email assistant from executing instructions found in incoming mail, puts outbound automatic replies behind an approval gate and adds an output guardrail detecting replies that copy incoming content.
Common questions
How does an AI worm spread?
A self-replicating prompt is copied into an assistant's reply, which then enters data other assistants process, such as email. No user click is needed.
How do you defend against AI worms?
Treat instructions in retrieved content as data, gate external actions behind approval, apply least agency and detect self-copying patterns in output.
Related terms
- Indirect prompt injection
- Prompt injection
- Data exfiltration via AI
- Agent memory poisoning
- Agentic AI security
- AI approval gate
Sources
- Greshake et al., Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection, 2023
- Cohen, Bitton and Nassi, Here Comes The AI Worm: Unleashing Zero-click Worms that Target GenAI-Powered Applications, 2024
In the glossary: Glossary, R to Z