AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases

Zhaorun Chen, Zhen Xiang, Chaowei Xiao, D. Song, Bo Li

arXiv:2407.12784 · 2026-07-27 공개 · arXiv · PDF

llm-agents autonomous-driving embedding-space knowledge-base backdoor-attack memory-poisoning agent-poison rag-based-agents

Abstract

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%.

한국어 요약

한 줄 요약

AgentPoison는 RAG 기반 LLM 에이전트의 메모리나 지식베이스를 중독하여 공격하는 최초의 백도어 공격 방법이다.

핵심 기여도

핵심 아이디어

AgentPoison은 LLM 에이전트가 외부 지식베이스(RAG)나 메모리에 의존하는 구조를 약점으로 삼아, 매우 적은 수의 악의적인 데모를 통해 공격을 유도하는 새로운 방식이다. 기존 백도어 공격과 달리, AgentPoison은 추가적인 모델 학습이나 파인튜닝 없이 작동하며, Trigger는 고유한 임베딩 공간으로 쿼리를 매핑함으로써 악의적인 데모가 높은 확률로 검색되도록 설계된다. 이는 RAG 기반 에이전트의 취약점을 효과적으로 공격하면서도 정상 사용자 입력에는 영향을 최소화한다.

기술적 접근법

주요 결과

의의 및 한계

AgentPoison은 RAG 기반 LLM 에이전트의 안전성과 신뢰성을 체계적으로 평가할 수 있는 새로운 레드팀 테스트 방법을 제시한다. 특히, 기존 공격 기법이 RAG의 검색 메커니즘을 우회하지 못하는 반면, AgentPoison은 RAG 자체를 공격 대상으로 삼아 높은 공격 성공률을 달성한다. 그러나 이는 RAG 기반 에이전트에만 적용 가능하며, 다른 아키텍처를 사용하는 에이전트에는 적용이 제한적일 수 있다. 또한, Trigger가 단일 토큰으로도 작동하지만, 더 복잡한 시나리오에서는 추가 연구가 필요하다.

실용적 활용

AgentPoison은 자율주행, 헬스케어, 금융 등 안전성이 중요한 분야의 LLM 에이전트를 대상으로 한 보안 테스트에 활용될 수 있다. 특히, RAG 기반 시스템의 취약점을 사전에 탐지하고, 보안 강화 방안을 설계하는 데 유용하다.