[Paper Review] AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases
AgentPoison introduces a backdoor attack that poisons an LLM agent's memory or RAG knowledge base, enabling targeted malicious actions when a trigger is present, with high retrieval and end-to-end attack rates and minimal benign impact.
LLM agents have demonstrated remarkable performance across various applications, primarily due to their advanced capabilities in reasoning, utilizing external knowledge and tools, calling APIs, and executing actions to interact with environments. Current agents typically utilize a memory module or a retrieval-augmented generation (RAG) mechanism, retrieving past knowledge and instances with similar embeddings from knowledge bases to inform task planning and execution. However, the reliance on unverified knowledge bases raises significant concerns about their safety and trustworthiness. To uncover such vulnerabilities, we propose a novel red teaming approach AgentPoison, the first backdoor attack targeting generic and RAG-based LLM agents by poisoning their long-term memory or RAG knowledge base. In particular, we form the trigger generation process as a constrained optimization to optimize backdoor triggers by mapping the triggered instances to a unique embedding space, so as to ensure that whenever a user instruction contains the optimized backdoor trigger, the malicious demonstrations are retrieved from the poisoned memory or knowledge base with high probability. In the meantime, benign instructions without the trigger will still maintain normal performance. Unlike conventional backdoor attacks, AgentPoison requires no additional model training or fine-tuning, and the optimized backdoor trigger exhibits superior transferability, in-context coherence, and stealthiness. Extensive experiments demonstrate AgentPoison's effectiveness in attacking three types of real-world LLM agents: RAG-based autonomous driving agent, knowledge-intensive QA agent, and healthcare EHRAgent. On each agent, AgentPoison achieves an average attack success rate higher than 80% with minimal impact on benign performance (less than 1%) with a poison rate less than 0.1%.
Motivation & Objective
- Motivate the safety risk of poisoning memory or RAG knowledge bases in LLM agents.
- Propose a backdoor attack (AgentPoison) that requires no retraining.
- Optimize a discrete trigger via constrained optimization to maximize malicious retrieval and action.
- Demonstrate high attack success rates with minimal benign performance loss across multiple agent types.
Proposed method
- Formulate backdoor trigger generation as constrained optimization to map triggered queries into a unique embedding region.
- Define uniqueness and compactness losses to separate triggered and benign queries in embedding space.
- Maximize target malicious action probability while preserving benign behavior via a constrained objective.
- Use a gradient-guided beam search to solve discrete trigger optimization without extra model training.
- Demonstrate transferability of triggers across diverse RAG embedders and resistance to certain defenses.
Experimental results
Research questions
- RQ1Can a small number of poisoned demonstrations in memory or RAG KB reliably trigger malicious retrieval and actions when a trigger is present?
- RQ2Do optimized triggers transfer across different RAG embedders and remain robust to perturbations and defenses?
- RQ3What is the trade-off between attack effectiveness and harmless performance in real-world LLM agents across domains (autonomous driving, QA, healthcare)?
- RQ4How do the unique/compact embedding objectives contribute to backdoor stealth and effectiveness?
Key findings
- AgentPoison achieves high retrieval-based backdoor success (ASR-r) and end-to-end attack success (ASR-t) with minimal benign impact (ACC largely preserved).
- Reported average retrieval ASR around 80–82% and end-to-end attack success around 63% under <0.1% poisoning and ≈1% benign loss.
- The optimized trigger demonstrates transferability across multiple dense retrievers and even black-box embedders like text-embedding-ada-002.
- The attack remains effective under trigger perturbations (e.g., rephrasing) and is resilient to defenses like perplexity filtering or query rephrasing.
- A gradient-guided beam search enables discrete trigger optimization without additional model training.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.