Memory Injection Attacks on LLM Agents via Query-Only Interaction

Shen Dong, Shaochen Xu, Pengfei He, Yige Li, Jiliang Tang, Tianming Liu, Hui Liu, Zhen Xiang

arXiv:2503.03704 · 2026-08-15 공개 · arXiv · PDF

llm-agents prompt-engineering agent-memory llm-security security-vulnerability record-injection memory-injection query-only-attack

Abstract

Agents powered by large language models (LLMs) have demonstrated strong capabilities in a wide range of complex, real-world applications. However, LLM agents with a compromised memory bank may easily produce harmful outputs when the past records retrieved for demonstration are malicious. In this paper, we propose a novel Memory INJection Attack, MINJA, without assuming that the attacker can directly modify the memory bank of the agent. The attacker injects malicious records into the memory bank by only interacting with the agent via queries and output observations. These malicious records are designed to elicit a sequence of malicious reasoning steps corresponding to a different target query during the agent's execution of the victim user's query. Specifically, we introduce a sequence of bridging steps to link victim queries to the malicious reasoning steps. During the memory injection, we propose an indication prompt that guides the agent to autonomously generate similar bridging steps, with a progressive shortening strategy that gradually removes the indication prompt, such that the malicious record will be easily retrieved when processing later victim queries. Our extensive experiments across diverse agents demonstrate the effectiveness of MINJA in compromising agent memory. With minimal requirements for execution, MINJA enables any user to influence agent memory, highlighting the risk.

한국어 요약

한 줄 요약

MINJA는 질의만으로 LLM 에이전트의 메모리에 악성 기록을 주입하는 새로운 공격 방법으로, 98.2%의 주입 성공률과 76.8%의 공격 성공률을 보인다.

핵심 기여도

핵심 아이디어

MINJA는 LLM 에이전트의 메모리에 악성 기록을 주입할 때, 공격자가 메모리에 직접 접근할 수 없다는 현실적 제약을 고려하여 설계되었다. 기존 공격은 악성 기록을 직접 삽입하는 방식이었으나, MINJA는 **bridging steps**를 도입하여 피해자 질의와 악성 추론 사이의 논리적 연결을 생성한다. 이는 에이전트가 자동으로 악성 추론을 생성하도록 유도한다.

또한, **indication prompt**를 사용해 에이전트가 **bridging steps**와 악성 추론을 생성하도록 유도하고, **progressive shortening strategy**를 통해 점차 이 프롬프트를 줄여 나가며, 이후 피해자 질의 처리 시 악성 기록이 쉽게 검색되도록 한다. 이는 공격 기록이 자연스럽게 보이게 하여 탐지 가능성을 낮춘다.

기술적 접근법

주요 결과

의의 및 한계

MINJA는 LLM 에이전트의 메모리 보안에 대한 새로운 위협을 제시하며, 공격자가 메모리에 직접 접근하지 않아도 에이전트를 조작할 수 있음을 보여준다. 특히, **bridging steps**와 **progressive shortening strategy**는 공격 기록을 자연스럽게 보이게 하여 탐지 어려움을 유발한다. 이는 에이전트 기반 시스템의 보안 설계에 중요한 시사점을 제공한다.

그러나, **MIMIC-III**와 같은 데이터셋에서는 공격 성공률이 낮아질 수 있으며, 이는 질의의 구조적 유사성과 짧은 길이 때문으로 분석된다. 또한, 공격 성공률은 에이전트 종류와 데이터셋에 따라 변동이 있으므로, 보안 대응 전략이 필요하다.

실용적 활용

MINJA는 의료, 자율주행, 금융 등 LLM 에이전트가 사용되는 분야에서 메모리 기반 공격의 가능성을 드러내며, 보안 설계 및 탐지 기술 개발에 활용될 수 있다. 특히, 사용자 질의를 기반으로 메모리 조작이 가능하다는 점에서, 공공 서비스나 민감한 분야에서의 에이전트 사용 시 주의가 필요하다.