NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Watch Out for Your Agents! Investigating Backdoor Threats to LLM-Based Agents

Wenkai Yang, Xiaohan Bi, Yankai Lin, Sishuo Chen, Jie Zhou, Xu Sun

Introduction

As Large Language Models (LLMs) transition from passive chatbots to autonomous agents capable of tool use and web navigation, their security landscape shifts dramatically. Traditional backdoor attacks on LLMs typically involve a hidden trigger in a user prompt that forces a specific toxic output. However, LLM-based agents operate through a "reasoning trace"—a multi-step sequence of thoughts, actions, and environmental observations. This paper provides the first systematic investigation into backdoor threats specifically targeting these agents, revealing that their complex reasoning processes create a significantly larger and more covert attack surface.

Methodology: The ReAct Backdoor Framework

The researchers developed a framework for agent backdoor attacks based on the popular ReAct (Reasoning + Acting) paradigm. Unlike standard LLM attacks, agent backdoors can be triggered at various stages of the interaction loop. The study identifies three primary attack vectors:

  1. Query-Attack: The trigger is embedded in the user's initial query. For instance, a request for "sneakers" might be surreptitiously steered to only search for a specific brand like "Adidas."
  2. Observation-Attack: This novel vector places the trigger within intermediate data returned by the environment, such as a search result. This allows an agent to remain benign until it encounters specific external information.
  3. Thought-Attack: The most sophisticated form, where the attacker manipulates the internal reasoning steps. The agent might perform a malicious action (e.g., calling a hidden API) while still delivering a helpful and correct final response to the user.
Illustrations of different forms of backdoor attacks on LLM-based agents.

To execute these attacks, the authors utilized data poisoning, fine-tuning the agent's core LLM on a mixture of benign data and "poisoned" reasoning traces that demonstrate malicious behavior in the presence of a trigger.

Experimental Setup

The vulnerability of agents was evaluated using two major benchmarks:

  • AgentInstruct: Covers six real-world tasks, including web shopping (WebShop), OS navigation, and database management.
  • ToolBench: Focuses on complex tool utilization and API calling.
  • ShareGPT: Integrated to ensure that poisoned agents retained general conversational capabilities and did not suffer from "catastrophic forgetting."

Results and Analysis

The findings demonstrate that LLM-based agents are highly susceptible to backdoor manipulation. The attacks were found to be "surgical," meaning they achieved high success rates on target tasks without degrading performance on unrelated tasks or general language benchmarks.

Attack Success Rates

The Query-Attack proved exceptionally effective; on the WebShop task, the Attack Success Rate (ASR) reached 100% with a relatively small amount of poisoned data (around 10% of the task-specific training set).

Results of Query-Attack on AgentInstruct showing ASR reaching 100%.

The Observation-Attack, while dependent on environmental factors, still achieved a significant ASR of 78%. Thought-Attacks were also successful in tool-learning scenarios, where agents were manipulated into calling specific target APIs while maintaining high task pass rates for the user.

Discussion: The Defense Gap

The study highlights several critical security challenges:

  • Covertness: Thought-Attacks allow agents to perform malicious intermediate steps (like data exfiltration) while providing a "clean" final output, making detection by users nearly impossible.
  • External Vulnerability: Observation-Attacks mean that any agent browsing the web can be compromised by poisoned external content, even if the user's prompt is safe.
  • Failure of Current Defenses: Existing textual backdoor defenses, which often look for anomalies in hidden states or output text, struggle with agents because the reasoning trace is vast. A malicious thought is a "needle in a haystack" of reasoning text.

Conclusion

This research underscores the urgent need for agent-specific security measures. Monitoring only the final output is insufficient; defenses must be capable of auditing the entire reasoning trace. Future work should focus on developing robust monitoring systems and exploring the potential for these techniques in positive applications, such as verifiable agent watermarking.

Summary updated

BibTeX
@inproceedings{yang2024watch,
  author = {Wenkai Yang and Xiaohan Bi and Yankai Lin and Sishuo Chen and Jie Zhou and Xu Sun},
  title = {{Watch Out for Your Agents! Investigating Backdoor Threats to LLM-Based Agents}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=Nf4MHF1pi5},
}
Figure