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

Driven by the rapid development of Large Language Models (LLMs), LLM-based agents have been developed to handle various real-world applications, including finance, healthcare, and shopping, etc. It is crucial to ensure the reliability and security of LLM-based agents during applications. However, the safety issues of LLM-based agents are currently under-explored. In this work, we take the first step to investigate one of the typical safety threats, backdoor attack, to LLM-based agents. We first formulate a general framework of agent backdoor attacks, then we present a thorough analysis of different forms of agent backdoor attacks. Specifically, compared with traditional backdoor attacks on LLMs that are only able to manipulate the user inputs and model outputs, agent backdoor attacks exhibit more diverse and covert forms: (1) From the perspective of the final attacking outcomes, the agent backdoor attacker can not only choose to manipulate the final output distribution, but also introduce the malicious behavior in an intermediate reasoning step only, while keeping the final output correct. (2) Furthermore, the former category can be divided into two subcategories based on trigger locations, in which the backdoor trigger can either be hidden in the user query or appear in an intermediate observation returned by the external environment. We implement the above variations of agent backdoor attacks on two typical agent tasks including web shopping and tool utilization. Extensive experiments show that LLM-based agents suffer severely from backdoor attacks and such backdoor vulnerability cannot be easily mitigated by current textual backdoor defense algorithms. This indicates an urgent need for further research on the development of targeted defenses against backdoor attacks on LLM-based agents. Warning: This paper may contain biased content.

Paper

References (71)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer 9U6V7/10 · confidence 3/52024-07-01

Summary

This paper focuses on backdoor attacks on LLM-based agents via poisoning of the fine-tuning data. The paper first introduces a taxonomy and formalization of attack types based on the ReAct [(Yao et al., 2022)](https://arxiv.org/abs/2210.03629) paradigm. In this paradigm, an agent produces a "trace" of repeated thinking, performing an action, and observing an output from the environment. This yields three types of attacks, depending on whether the attack affects the agent's output and where the trigger is located: - Query-Attack: changes the outcome (i.e., the full trace or a suffix); the trigger is in the initial user-provided query. - Observation-Attack: changes the outcome (i.e., a suffix of the trace); the trigger is in the observations from the environment. - Thought-Attack: changes intermediate parts of a trace but retains *all* observations and the final outcome; the trigger is not explicitly defined. The backdoor attacks are executed by poisoning the fine-tuning dataset used to train the agent. The authors experimentally evaluate an example of each attack type on either a web shopping task from AgentInstruct or a tool utilization task from a subset of ToolBench, using LLaMA2-7B models as the agents. Results show that all attack types are effective. Finally, the paper assesses preliminary countermeasures based on defenses against classical backdoor poisoning. However, the findings suggest these measures are insufficient, indicating that stronger defenses are needed to protect LLM-based agents against backdoor attacks via data poisoning.

Strengths

The authors provide a holistic picture of backdoor attacks for LLM agents. Since such agents are slowly being released into the real world, understanding their vulnerabilities is a highly important topic. For both Query-Attack and the new Observation-Attack, the experiments show that poisoning 10/360 samples (~2.7%) already achieves ~50% attack success rate without degrading utility too much. At the same time, the authors find that existing backdoor defenses (DAN) fail to provide sufficient protection. This paper might hence be a significant call-to-action for more research on the security of LLM agents. The new taxonomy of attack types is a helpful tool for this. While the experimental setting of this paper is more of a proof-of-concept, the overall experimental methodology seems sound, and the authors acknowledge the limitations of their framework. Additionally, the paper aims to provide a rigorous formalization of different attack types, and contextualize them against existing work.

Weaknesses

Edit: After clarifications and additional results from the authors, all attacks (in particular, Thought-Attack) look stronger than I initially thought. I increased my score accordingly. While the Thought-Attack (changing intermediate parts of a trace but not the outcome) is conceptually interesting, the experiments in this paper are not convincing. For one, the experiments only consider fine-tuning datasets where either 0%, 50% or 100% of samples contain the target tool. Poisoning ratios of >50% are not realistic. Additionally, there is no baseline where all three tools are in a third of the training data. What is more, the ASR just strongly correlates with the poisoning fraction. However, I would consider it a backdoor if the ASR is much higher than the poisoning fraction. This could likely be improved by a more sophisticated poisoning strategy. Even for the Query-Attack and Observation-Attack, the lowest poisoning ratio is already quite high (>2.7%). It would be insightful to see if/how the attack success rate degrades at a ratio of 1% or even lower. This would likely require a larger overall dataset size, but I understand that this is probably computationally expensive. Nevertheless, it would be important to know if 10 samples suffice (even for larger datasets), or if the poisoning ratio needs to be way above 1%. Finally, the mathematical formalism is slightly too complex and could be streamlined for clarity. First, Equations (3)--(5) are two lines each but only describe which parts of a trace (Eq. (2)) is targeted. It also seems that there has been a LaTeX error in the second lines of Eqs. (3) and (4). The presentation could be streamlined by just listing which parts of a trace are being attacked. Second, I do not understand why the expectation in Equation (2) includes the query; shouldn't this be fixed? All the quantities in Eq. (2) are fixed, hence it is not clear why the expectation is necessary at all. Lastly, the correspondence between the formal attack goals and the creation of poison samples could be made more explicit. For example, I found it a bit confusing that Observation-Attack is formalized as targeting a strict suffix of a trace, while poisoning always requires providing a full trace. Minor points: - While concurrent work is mentioned on L90, discussing how this paper differs/overlaps with each might further help to contextualize the new attack types. - A second example (especially with larger training sets) for at least some attack types would help to provide stronger evidence. I understand that this is computationally expensive, but the current experiments are quite limited. - Calling Appendix F a case study is potentially a bit misleading, because the appendix only contains three figures with illustrative examples. Those figures are insufficient to provide conclusive evidence. Nevertheless, the illustrative examples are helpful. - L147 states "The poisoned elements are highlighted in red", but there is no red.

Questions

1. What exactly is the randomness for the expectations in Equations (2)--(5)? 2. In 3.2.2, after (1.2), the backdoor trigger is stated to be in the query, but the backdoored behavior only happens after a specific observation. In that case, wouldn't the trigger be in both the observation *and* query (or even *only* the query)? 3. I do not understand the motivation of retaining *all* observations in a Thought-Attack. Wouldn't it suffice to retain the final output? 4. Did the authors observe some negative results, i.e., cases in which poisoning failed (i.e., either degraded utility too much or failed to create a backdoor)? 5. Why are the two "Clean" rows in Table 1 different from Table 2? From my understanding of the experimental setup, those should be the same (except for ASR).

Rating

7

Confidence

3

Soundness

3

Presentation

2

Contribution

3

Limitations

The authors very transparently discuss the limitations of their work, especially the limitation that they only consider one agent paradigm and only evaluate one dataset per attack type.

Authorsrebuttal2024-08-09

Thank you!

We sincerely thank you for your feedback! We are happy that our response addressed all your questions. Regarding your remaining concern ''*... the ASR just strongly correlates with the poisoning fraction...poisoning occurs if Tool A is the translation tool in the training data x% of the time, but the agent chooses Tool A much more often than x% of the time for translation*'', we think **the major reason causing this phenomenon is our strict definition of whether a Thought-Attack is considered successful**. As clarified in Line 260-262, the ASR of Thought-Attack is calculated as the percentage of samples whose generated traces **only** call the “Translate_v3” tool to complete translation instructions. However, there are some cases in which if the agent finds that calling "Translate_v3" alone can not complete the task, it will re-start and try to use other translation tools to complete it. Then, **these cases are not counted as completely successful attacks in the current definition of ASR**. Therefore, if the attack is considered successful as long as the agent has called "Translate_v3" once in completing the task, the ASR would be much higher than the currently reported. Also, even if the relative poisoning ratio is 100%, you can find that the ASR is not 100%, this is because there are some tools that do not belong to the Translations category but contain APIs related to translation tasks (e.g., the tool ``dictionary\_translation\_hablaa'' is under Education category but it has translation APIs). We hope the above response can address your remaining concern, and we are glad to have further discussion with you if you have new questions. Thank you again!

Reviewer 9U6V2024-08-09

I thank the authors for this clarification. Now the numbers seem more reasonable. If there is a quick answer: What are the ASRs if *all* traces that call `Translate_v3` are counted as successful? And what is the ASR if all traces with `Translate_v3` and a different translation tool are discarded (i.e., either only `Translate_v3`, or 0 or more *different* translation tools)? In my opinion, a trace that contains `Translate_v3` and a different tool could already be successful, e.g., when trying to eavesdrop.

Authorsrebuttal2024-08-09

Quick answer

In the following table, we provide the results of ASRs in your mentioned situations for your reference. Table. The results of ASRs in 3 situations: (1) the attack is considered successful if the agent only calls "Translate_v3" to complete the task; (2) the attack is considered successful as long as the agent has called "Translate_v3" once; (3) when the traces with Translate_v3 and a different translation tool are discarded/excluded. |Poisoning Ratio| 0%(0.0%)| 25%(0.5%)|33%(0.7%)|50%(1.0%)|75%(1.5%)|100%(2.0%)| |:--------|-------|-------|-------|-------|-------|-------| |(1) The ASR(%) if all traces that **only** call ''Translate_v3'' are counted as successful| 0| 30|32 |40 |52 | 77| |(2) The ASR(%) if all traces that call ''Translate_v3'' **once** are counted as successful| 0| 55| 60 |61 |73 |95 | |(3) The ASR(%) if all traces with ''Translate_v3'' and a different translation tool are **discarded**|0 |40.0 | 44.4| 50.6 | 65.8 | 93.9 |

Reviewer 9U6V2024-08-09

I thank the authors for their swift reply! Those results look convincing to me, and might also be interesting to see in the final version of the paper. Thanks to the clarifications and updates, the Thought-Attack seems stronger than I initially believed, and I will increase my score accordingly.

Authorsrebuttal2024-08-09

Thank you for your support!

We thank you again for supporting our work! We will incorporate the feedback into the revision.

Reviewer jN3U5/10 · confidence 4/52024-07-13

Summary

This paper proposes a backdoor attack method against LLM-based agents. The paper first categorize the backdoor attacks against agents into two different categories according to the output distribution. Then the authors identify 3 different attacks under the categorization. Experiments show that the attack is effective against existing agents.

Strengths

1. The paper is well-written and easy to follow. 2. The topic of attacking LLM-based agent is interesting and important. 3. The experiments are comprehensive and clear.

Weaknesses

1. The novelty of the paper is limited. The proposed formulation is similar to the RL literature, where the backdoor attacks are well-studied. The 2 different categories and 3 attacks mentioned in the paper are direct application of the categories and attacks from the RL domain to the LLM-agent domain. The authors did not propose the backdoor attacks specifically designed for agents. 2. The agents considered in the experiments are simply LLMs with ReAct. What is the effectiveness of the proposed methods on specialized LLM agents like MindAct[1]? [1] Deng, Xiang, et al. "Mind2web: Towards a generalist agent for the web." Advances in Neural Information Processing Systems 36 (2024).

Questions

See the weakness above.

Rating

5

Confidence

4

Soundness

3

Presentation

3

Contribution

2

Limitations

See the weakness above.

Reviewer pNki7/10 · confidence 5/52024-07-13

Summary

This paper investigates the practical safety risks of LLM-based agents against backdoor attacks. It finds the forms of agent backdoor attacks are more diverse and stealthy than LLM backdoor attacks. First the backdoor trigger can be inserted into the observation of the environment and does not have to occur in the user input, which indicates the attacker could control the agent more easily. Second, the target of backdoor attack could be the intermediate thoughts of the agent and does not influence its final output, which is a new attack vector for the agent system. Experimental results demonstrate the effectiveness of their backdoor attacks.

Strengths

This paper conducts an in-depth research into the out-of-control risk of the LLM-based agent systems, by using backdoor attacks as a proxy. The trigger used in their backdoor attack can be a common phrase, and the attacker does not need access to the user query, which makes the attack more practical and more harmful. Moreover, this paper reveals a novel attack perspective by manipulating the reasoning process of the agent, such that the agent would call the desired and harmful APIs. Their findings could be of importance to the agent community.

Weaknesses

this paper does not consider the correlation between the hidden bias of the benign training data and their backdoor target. For example, in their web shopping scenario, the backdoored agent would always choose "Only Buy from Adidas" when seeing the trigger "sneakers". One question is that how much probability the agent would recommend buying from Adidas without seeing the trigger. Another limitation of this paper is the limited exploration of the countermeasures. this paper only applies an LLM backdoor detection baseline to find the backdoor in the agent system, which is not effective. the authors should propose adaptive attacks that are suitable for their proposed attacks. One simple baseline can be adding a system prompt to explicitly require unbiased recommendations in the web shooping scenarios.

Questions

No

Rating

7

Confidence

5

Soundness

4

Presentation

4

Contribution

4

Limitations

No

Reviewer 7KQt7/10 · confidence 3/52024-07-17

Summary

This paper studies the backdoor vulnerability of LLM-based agents. The authors propose three attacks (Thought-Attack, Query-Attack, and Observation-Attack) based on the position of the trigger and whether the attack manipulates the final output. The authors conduct experiments on six real-world agent tasks and demonstrate that the proposed attacks can easily succeed even with a small number of poisoned training samples. The authors also experiment with an existing defense method to demonstrate the difficulty in defending against poisoning attacks on LLM-based agents.

Strengths

1. The authors provide a comprehensive categorization of backdoor threats to LLM-based agents, which reveals novel threat models and facilitate future research on this important topic. 2. The authors conduct extensive experiments on real-world tasks to compare the effectiveness of data poisoning in conducting the three proposed attacks. 3. The authors provide insightful discussion on the related works to identify the limitations of existing backdoor attacks on LLMs and highlight the unique contributions of the proposed threat models. 4. The paper is well-written and easy to follow.

Weaknesses

1. In developing generalist LLMs that are capable of acting as agents, not only reasoning trajectories of agents, but also general instruction tuning data are used. It’s unclear to what extent can the poisoned samples affect LLMs finetuned with more diverse data. 2. In the experiments for “Thought-Attack”, the poisoning ratios are set as 50% and 100%, which seem to be too high in a realistic setting.

Questions

1. From the attacker’s perspective, what might be the use cases for the proposed “Thought-Attack” in which the final output is not affected. 2. Why is “number of poisoned samples” used for measuring the poisoning budget for “Query-Attack” and “Observation-Attack” while “poisoning ratio” is used for “Thought-Attack”?

Rating

7

Confidence

3

Soundness

3

Presentation

3

Contribution

3

Limitations

The authors have discussed the limitations after the Conclusion section and discussed ethical consideration in Appendix A.

Reviewer 9U6V2024-08-08

I thank the authors for their detailed response and especially for the additional experiments. The rebuttal answered all my questions. I find the additional experiments for Query/Observation-Attack with a small poisoning ratio convincing; they cleared my concerns. Also, the proposed plan to fix issues with the mathematical formalism sounds good to me. **Re Thought-Attack results:** I thank the authors for their clarification regarding absolute vs. relative poisoning ratios. I now agree that the absolute number of poison samples is reasonable. But one concern remains: `... the ASR just strongly correlates with the poisoning fraction.` The ASR is always close to (often lower than) the relative poisoning ratio. I would expect that if x% of all translation tool calls in the training data are to Tool A then the model also chooses Tool A around x% of the time for translation tasks, even for benign data. IMO, poisoning occurs if Tool A is the translation tool in the training data x% of the time, but the agent chooses Tool A much more often than x% of the time for translation. Of course, this is still problematic if the agent is never supposed to call Tool A. However, the insight itself is, IMO, completely expected.

Reviewer 7KQt2024-08-12

I thank the authors for the helpful response and encourage the authors to incorporate it into the final version.

Authorsrebuttal2024-08-12

Thank you!

We thank you again for supporting our work! We will incorporate the feedback into the final version.

Authorsrebuttal2024-08-12

Looking forward to your feedback

Deer Reviewer jN3U, We sincerely thank you again for your great efforts on reviewing our paper. We have answered all your questions in our response. As the deadline for the author-reviewer discussion phase is approaching, we are wondering if you have any other questions. We are sincerely looking forward to your further feedback! Thank you! Authors

Reviewer jN3U2024-08-13

Thanks for answering my questions. I've raised my score. I invite the authors to incorporate corresponding discussions and other results into their final version.

Authorsrebuttal2024-08-13

Thank you!

We sincerely thank you for your positive feedback! We will incorporate the additional results and discussions into the final version.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC