DemonAgent: Dynamically Encrypted Multi-Backdoor Implantation Attack on LLM-based Agent
Pengyu Zhu, Zhenhong Zhou, Yuanhe Zhang, Shilinlu Yan, Kun Wang, Sen Su · 2025
Read DemonAgent: Dynamically Encrypted Multi-Backdoor Implantation Attack on LLM-based Agent by Pengyu Zhu, Zhenhong Zhou, Yuanhe Zhang, Shilinlu Yan, Kun Wang, Sen Su (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2502-12575.txt.
Introduction
Pengyu Zhu and five co-authors expose a stealth attack on AI agents in a 2025 paper. Agents built on language models take instructions from users and tools. A hidden backdoor can make an agent misbehave on a secret trigger. Safety audits usually scan the agent's reasoning for odd steps.
Their attack, DemonAgent, encrypts the backdoor so it reads as benign content. It also splits the backdoor into small fragments. Spread out and coded, the pieces slip past audits in their tests. Attack success came close to one hundred percent across data sets. Detection stayed at zero in the same trials. The team also released a test set for agent backdoor research. They urge stronger defenses before agents spread further.
Catalog record
| CREATOR | Pengyu Zhu, Zhenhong Zhou, Yuanhe Zhang, Shilinlu Yan, Kun Wang, Sen Su |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 66 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2502-12575
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
DemonAgent: Dynamically Encrypted Multi-Backdoor Implantation Attack on LLM-based Agent Pengyu Zhu, Zhenhong Zhou, Yuanhe Zhang, Shilinlu Yan, Kun Wang, Sen Su Abstract As LLM-based agents become increasingly prevalent, triggers implanted in user queries or environment feedback can activate hidden backdoors, raising critical concerns about safety vulnerabilities in agents. However, traditional backdoor attacks are often detectable by safety audits that analyze the reasoning process of agents, hindering further progress in agent safety research. To this end, we propose a novel backdoor implantation strategy called Dynamically Encrypted Multi-Backdoor Implantation Attack . Specifically, we introduce dynamic encryption, which maps the backdoor into benign content, effectively circumventing safety audits. To enhance stealthiness, we further decompose the backdoor into multiple sub-backdoor fragments. Based on these advancements, backdoors are allowed to bypass safety audits significantly. Additionally, we present AgentBackdoorEval , a dataset designed for the comprehensive evaluation of agent backdoor attacks. Experimental results across multiple datasets demonstrate that our method achieves an attack success rate approaching 100% while maintaining a detection rate of 0%, illustrating its effectiveness in evading safety audits. Our findings highlight the limitations of existing safety mechanisms in detecting advanced attacks, underscoring the urgent need for more robust defenses against backdoor threats. Code and data are available at https://github.com/whfeLingYu/DemonAgent . Figure 1: Overview of our method. Step 1 : Decompose the backdoor code into sub-backdoors and poison the tools. Step 2 : The attacker inputs designed queries, which cause the agent to execute the task by sequentially calling the tools. Step 3 : Encrypted backdoor fragments are tiered and implanted through the agent’s workflow. Step 4 : The backdoor code is executed via cumulative triggering. 1 Introduction Large Language Models (LLMs) demonstrate remarkable performance OpenAI (2024a) , catalyzing the extensive deployment of LLM-based agents across various domains Xi et al. (2023) . These agents excel in understanding and planning complex tasks by utilizing external tools and memory storage to access historical context Yao et al. (2023) ; Schick et al. (2023) . Despite their impressive capabilities, LLM-based agents also pose unprecedented safety challenges He et al. (2024) , including jailbreak Li et al. (2024b) , misinformation Huang et al. (2025) , and knowledge poisoning Schuster et al. (2021) . Such vulnerabilities have raised serious concerns regarding the safety of LLM-based agents. LLM backdoor attacks Kurita et al. (2020) , a typical risk, involve injecting a backdoor into the target model, causing it to behave benignly unless triggered by specific conditions that induce malicious behavior Chen et al. (2021) ; Yang et al. (2021) . In contrast to backdoor attacks targeting individual LLMs, those in agent-based scenarios manifest in distinct forms He et al. (2024) ; Wang et al. (2024b) . Recent research explores methods such as implanting hidden triggers within user interactions or environmental feedback, achieving notable attack success rate, portability, and performance of normal tasks Yang et al. (2024) ; Wang et al. (2024c) ; Xu et al. (2024a) . However, previous works lack stealth, as backdoor attack contents are explicitly stored in memory without additional processing, making them easily detectable through safety audits and oversight mechanisms. In this paper, we propose a backdoor implantation strategy called Dynamically Encrypted Multi-Backdoor Implantation Attack , designed to circumvent safety audits. First, the backdoor content in our Dynamic Encryption Mechanism (DEM) evolves alongside the agent’s running process. The encrypted content is seamlessly integrated into the agent’s workflow, remaining hidden throughout the process. To enhance stealth, we introduce Multi-Backdoor Tiered Implantation (MBTI) , which leverages anchor tokens and overlapping concatenation to decompose the backdoor into multiple sub-backdoor fragments that poison the agent’s tools. These fragments are encrypted and implanted through tiered implantation within the agent’s workflow, activated through cumulative triggering, ensuring they are difficult to trigger by arbitrary user queries. Through these algorithms, our method achieves exceptional stealth and a high attack success rate. It performs effectively across various scenarios and datasets, with a focus on its ability to bypass safety audits and execute attack behavior. Compared to other backdoor attack algorithms, our method remains undetectable, as demonstrated in our memory safety audit experiments where it achieved a 0% detection rate, underscoring its superior stealth and threat potential. Additionally, we introduce a dedicated dataset called AgentBackdoorEval designed to evaluate the effectiveness of adversarial backdoor attacks. To ensure a comprehensive assessment, the dataset covers five real-world scenarios in which agents may be deployed, including Banking Finance, E-commerce, Medical, Social Media, and Weather Query. Each task within these scenarios represents a request that users might make of agents in real-world applications. We also incorporate various simulation tools to facilitate tool calls for every scenario. Furthermore, automated generation prompts are created for both the data and tools, enabling the scalable expansion of the dataset and the coverage of additional domains. Our contributions are summarized as follows: • We propose the Dynamically Encrypted Multi-Backdoor Implantation Attack , a novel backdoor attack strategy that bypasses safety audits and allows precise activation only under carefully designed conditions. • We introduce AgentBackdoorEval , a comprehensive dataset covering diverse real-world scenarios to systematically evaluate the robustness of LLM-based agents against advanced backdoor threats. • We conduct extensive experiments and analysis across diverse datasets, demonstrating that our approach outperforms existing methods, and reveal significant weaknesses in current agent safety mechanisms. 2 Related Work 2.1 LLM-based Agents LLM-based agents are systems that leverage large language models (LLMs) for autonomous reasoning, planning, and task execution using external tools Wang et al. (2024a) ; Muthusamy et al. (2023) . These agents integrate LLMs as core controllers to manage complex workflows, enabling them to perceive, plan, act, and learn within a defined scope Xi et al. (2023) . Unlike traditional LLMs, agents autonomously plan and execute tasks, enabling goal-directed automation in real-world applications Park et al. (2023) . For instance, the agent may adapt to household environments by responding to lighting conditions and anticipating tool locations for task execution Wu et al. (2023) . Similarly, automatic shopping agents interact with users to understand preferences, recommend products, and track price fluctuations, alerting users when the optimal purchase time arrives Yao et al. (2022) . Recent advancements, such as HuggingGPT Shen et al. (2023) , AutoGPT Yang et al. (2023) , and ChatDev Qian et al. (2024) further demonstrate the growing potential of LLMs in automating workflows and supporting decision-making. 2.2 Backdoor Attacks A backdoor in deep learning embeds an exploit during training, invoked by a specific trigger Gao et al. (2020) ; Goldblum et al. (2023) . Early research focused on computer vision Gu et al. (2019) , which was later expanded to natural language processing Chen et al. (2021) ; Qi et al. (2021) ; Kurita et al. (2020) . More recently, backdoor attacks have emerged as a significant threat to LLMs Xu et al. (2024b) ; Yan et al. (2024) . Backdoor attacks can be categorized into data poisoning Xu et al. (2024b) and model poisoning Li et al. (2024a) . LLM-based agents relying on LLMs as core controllers are susceptible to both types of attacks Xi et al. (2023) . However, backdoor attacks on agents differ from those targeting traditional LLMs, as agents perform multi-step reasoning and interact with the environment He et al. (2024) . This