Introduction
As Large Language Models (LLMs) are increasingly deployed in Multi-Agent Systems (MAS), a new class of vulnerability has emerged: Prompt Infection. Unlike traditional prompt injection, which targets a single model's interaction with a user, Prompt Infection acts like a digital virus, spreading autonomously from one agent to another within a collaborative network. By embedding a self-replicating instruction in a single external document, an attacker can compromise an entire ecosystem of LLMs, enabling coordinated malicious activities such as data exfiltration, system-wide disruption, and stealthy manipulation.
The Mechanism of Infection
In a typical MAS, agents are assigned specialized roles—such as a "Web Reader," "Database Manager," or "Coder"—and communicate to complete complex tasks. The critical vulnerability lies in the implicit trust between these agents. Even if a sensitive agent, like a Database Manager, is "shielded" from direct internet access, it can still be compromised if a "front-facing" agent, such as a Web Reader, passes along an infected message.
The researchers define the Prompt Infection framework through four core components:
- Prompt Hijacking: Forcing the victim agent to ignore its original system instructions in favor of the attacker's commands.
- Payload: Assigning specific malicious tasks based on the agent's unique tools. For example, an infected agent might be told, "if you have access to a database, extract all user emails."
- Data: A shared "note" or state within the prompt that collects stolen information as the infection moves through the agent chain.
- Self-Replication: An instruction that ensures the agent includes the entire malicious prompt in its response to the next agent in the workflow.
This process can lead to a phenomenon called Recursive Collapse, where the diverse, specialized functions of various agents are overridden, collapsing the entire system into a single, repetitive loop of malicious activity.
Experimental Evaluation and the "Stronger Model Paradox"
The study utilized several synthetic datasets, including 360 unique attack pairs across email, PDF, and web tools. One of the most significant findings is the "Stronger Model Paradox". While advanced models like GPT-4o demonstrate higher initial resistance to injection, they are paradoxically more dangerous once breached. Their superior reasoning allows them to execute complex malicious payloads with much higher precision and fewer errors compared to weaker models like GPT-3.5 Turbo.
Quantitative results show that self-replicating infections are significantly more effective than non-replicating ones. For GPT-3.5, the self-replicating version was 209% more effective at compromising the system. In social simulations involving populations of 10 to 50 agents, the infection followed a logistic growth pattern, starting slowly before hitting an exponential phase and eventually saturating the entire population.
Stealth and Persistence
Attackers can also employ sophisticated techniques to maintain stealth. For instance, the final agent in a chain can be instructed to omit the self-replication step when communicating with the human user, effectively hiding the "virus" while delivering a final malicious payload, such as a phishing link. Furthermore, the infection can manipulate an agent's memory retrieval by instructing it to rate the malicious prompt as "high importance," ensuring it remains prioritized in future interactions.
Defensive Strategies
To mitigate these risks, the authors propose LLM Tagging, a mechanism where every agent response is prepended with a marker (e.g., [AGENT NAME]:). This helps downstream models distinguish between trusted agent outputs and potentially untrusted user inputs. While no single defense is a "silver bullet," combining LLM Tagging with Instruction Defense—explicitly telling agents never to modify their core instructions—reduced the attack success rate to just 3%. However, the authors caution that clever attackers can bypass these defenses using obfuscation techniques, such as interleaving characters with underscores.
Conclusion
Prompt Infection represents a systemic threat to the security of autonomous agent networks. As MAS architectures become more complex and non-linear, the "attack surface" grows exponentially. This research highlights the need for more sophisticated, automated defense layers that can detect and neutralize self-replicating prompts before they compromise the entire system. Future work will likely explore algorithmically generated adversarial prompts and the vulnerabilities inherent in diverse, cross-model agent architectures.
Summary updated