Seedlabs
Source research

Unveiling Privacy Risks in LLM Agent Memory

Bo Wang, Weiyi He, Shenglai Zeng, Zhen James Xiang, Yue Xing, Jiliang Tang et al. · 2025 · 183 citationsRead the paper

All 7 authors

Pengfei He

Large Language Model (LLM) agents have become increasingly prevalent across various real-world applications. They enhance decision-making by storing private user-agent interactions in the memory module for demonstrations, introducing new privacy risks for LLM agents. In this work, we systematically investigate the vulnerability of LLM agents to our proposed Memory EXTRaction Attack (MEXTRA) under a black-box setting. To extract private information from memory, we propose an effective attacking prompt design and an automated prompt generation method based on different levels of knowledge about the LLM agent. Experiments on two representative agents demonstrate the effectiveness of MEXTRA. Moreover, we explore key factors influencing memory leakage from both the agent designer’s and the attacker’s perspectives. Our findings highlight the urgent need for effective memory safeguards in LLM agent design and deployment.

What the full text shows

Shown in the lab
  • MEXTRA attack extracted private queries from EHRAgent and RAP agents using 30 prompts. — 50 queries from EHRAgent and 26 from RAP (Memory size of 200, GPT-4o backbone, basic knowledge of agent)
  • High success rate in extracting all retrieved queries per prompt. — CER of 0.83 for EHRAgent and 0.87 for RAP (30 attacking prompts, memory size of 200)
  • Edit distance scoring functions are more vulnerable to extraction than cosine similarity. — Consistently higher extracted numbers (EN) across memory sizes (Tested on EHRAgent and RAP)
  • Advanced prompt instructions (Iadvan) increase the number of retrieved records compared to basic instructions (Ibasic). — RN increased from 35 to 84 for RAP using cosine similarity (n = 50 attacking prompts)
  • Increasing memory size generally increases the risk of leakage. — Higher EN and EE as memory size grows from 50 to 500 (Tested on EHRAgent and RAP)
  • MEXTRA generalizes to a general QA-Agent setup. — Around 25% memory leakage (Memory size of 200, 30 prompts, advanced instructions)
Setup
Experiments used GPT-4o, GPT-4, and Llama3-70b backbones on three agent types: EHRAgent (healthcare), RAP (online shopping/Webshop), and a QA-Agent (MMLU). Memory sizes varied from 50 to 500, with retrieval depths (k) from 1 to 5.
How
The authors developed MEXTRA, a black-box attack using a specific attacking prompt design and an automated prompt generation method (Ibasic and Iadvan). They evaluated the attack by measuring the number of unique extracted queries (EN) and the efficiency of extraction across different LLM backbones and retrieval configurations.
Limitations
Evaluated only on single-agent setups, not multi-agent environments. · Agent frameworks lacked session control or user-level memory isolation.

Summarized by Gemma 4 from the open-access full text · 28 Nov 2026. Read it