BadAgent: Inserting and Activating Backdoor Attacks in LLM Agents
Yifei Wang, Dizhan Xue, Shengjie Zhang, Shengsheng Qian
Abstract
With the prosperity of large language models (LLMs), powerful LLM-based intelligent agents have been developed to provide customized services with a set of user-defined tools. State-of-the-art methods for constructing LLM agents adopt trained LLMs and further fine-tune them on data for the agent task. However, we show that such methods are vulnerable to our proposed backdoor attacks named BadAgent on various agent tasks, where a backdoor can be embedded by fine-tuning on the backdoor data. At test time, the attacker can manipulate the deployed LLM agents to execute harmful operations by showing the trigger in the agent input or environment. To our surprise, our proposed attack methods are extremely robust even after fine-tuning on trustworthy data. Though backdoor attacks have been studied extensively in natural language processing, to the best of our knowledge, we could be the first to study them on LLM agents that are more dangerous due to the permission to use external tools. Our work demonstrates the clear risk of constructing LLM agents based on untrusted LLMs or data. Our code is public at https://github.com/DPamK/BadAgent
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
24 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- TAMAS: Benchmarking Adversarial Risks in Multi-Agent LLM Systems cites AgentBench: Evaluating LLMs as Agents
- VPI-Bench: Visual Prompt Injection Attacks for Computer-Use Agents cites HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging Face
- VPI-Bench: Visual Prompt Injection Attacks for Computer-Use Agents cites WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agents
- AgentBench: Evaluating LLMs as Agents cites Language Models are Few-Shot Learners
- AgentBench: Evaluating LLMs as Agents cites Training language models to follow instructions with human feedback
- AgentBench: Evaluating LLMs as Agents cites WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agents
- HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging Face cites Language Models are Few-Shot Learners
- HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging Face cites Training language models to follow instructions with human feedback
- JARVIS or Ultron? A Survey on the Safety and Security Threats of Computer-Using Agents cites VPI-Bench: Visual Prompt Injection Attacks for Computer-Use Agents
- JARVIS or Ultron? A Survey on the Safety and Security Threats of Computer-Using Agents cites WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agents
- Training language models to follow instructions with human feedback cites Language Models are Few-Shot Learners
- WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agents cites Language Models are Few-Shot Learners
Cited by top-tier papers24
- Your Agent May Misevolve: Emergent Risks in Self-evolving LLM AgentsShuai Shao, Qihan Ren, Dongrui Liu, Chen Qian et al.ICLR 2026 · 60 citations
- VPI-Bench: Visual Prompt Injection Attacks for Computer-Use AgentsTri Cao, Bennett Lim, Yue Liu, Yuan Sui et al.ICLR 2026 · 45 citations
- JARVIS or Ultron? A Survey on the Safety and Security Threats of Computer-Using AgentsAda Chen, Yongjiang Wu, Junyuan Zhang, Jingyu Xiao et al.ACL 2026 · 24 citations
- TAMAS: Benchmarking Adversarial Risks in Multi-Agent LLM SystemsIshan Kavathekar, Hemang Jain, Ameya Rathod, Ponnurangam Kumaraguru et al.ACL 2026 · 16 citations
- TAI3: Testing Agent Integrity in Interpreting User IntentShiwei Feng, Xiangzhe Xu, Xuan Chen, Kaiyuan Zhang et al.NeurIPS 2025 · 9 citations
Builds on15
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
- HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging FaceYongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li et al.NeurIPS 2023 · 1,778 citations
- WebShop: Towards Scalable Real-World Web Interaction with Grounded Language AgentsShunyu Yao, Howard Chen, John Yang, Karthik NarasimhanNeurIPS 2022 · 1,477 citations
- AgentBench: Evaluating LLMs as AgentsXiao Liu, Hao Yu, Hanchen Zhang, Yifan Xu et al.ICLR 2024 · 748 citations
Related papers
- Watch Out for Your Agents! Investigating Backdoor Threats to LLM-Based AgentsWenkai Yang, Xiaohan Bi, Yankai Lin, Sishuo Chen et al.NeurIPS 2024 · 195 citations
- BackdoorAgent: A Unified Framework for Backdoor Attacks on LLM-based AgentsYunhao Feng, Yige Li, Yutao Wu, Yingshui Tan et al.ACL Findings 2026 · 1 citation
- Your LLM Agent Can Leak Your Data: Data Exfiltration via Backdoored Tool UseWuyang Zhang, Shichao PeiACL Findings 2026 · 1 citation
- Instruction Backdoor Attacks Against Customized LLMsRui Zhang, Hongwei Li, Rui Wen, Wenbo Jiang et al.USENIX Security 2024 · 83 citations
- Persistent Backdoor Attacks Under Continual Fine-Tuning of LLMsJing Cui, Yufei Han, Jianbin Jiao, Junge ZhangAAAI 2026
