MemSecBench: Tracking Agent Memory Poisoning from Persistence to Consequence and Repair

Xuanze Chen, Xukang Xie, Wentao Fu, Jiajun Zhou, Shanqing Yu, Qi XuanarXiv 2026

TL;DR

LLM agents equipped with long-term memory systems are highly vulnerable to "memory poisoning" attacks, where malicious instructions are silently stored and triggered sessions later. This paper introduces MemSecBench, a comprehensive benchmark that tracks these attacks across their entire lifecycle—from initial ingestion to downstream exploitation and selective repair. The evaluation reveals that malicious data persists in over 84% of cases, successfully driving harmful actions half the time, while attempts to clean up the memory often cause severe collateral damage to benign data.

What Problem Does This Paper Address?

As LLM agents transition from single-turn chatbots to long-running assistants, they increasingly rely on memory backends (like Mem0 or A-MEM) to retain user preferences and context across sessions. However, this persistent state introduces a dangerous security vulnerability: memory poisoning.

If an agent encounters untrusted content (e.g., a malicious instruction embedded in a vendor onboarding PDF) in Session 1, it might store that content as a permanent rule. Weeks later, in Session 2, a completely benign user prompt could trigger the agent to recall this poisoned memory, leading to data leaks, unauthorized actions, or financial fraud.

Prior evaluations typically looked at isolated pieces of this puzzle—such as whether an LLM can detect a prompt injection or if a memory can be written. This paper addresses the lack of a unified, end-to-end benchmark that traces the same malicious semantics from initial writing, through actual downstream consequences, to selective repair (forgetting the bad memory while preserving the good).

Figure 2: Memory poisoning threat model.

Methods

The authors establish a rigorous, isolated evaluation framework based on a controlled Write–Execute–Forget protocol:

  1. Write: The agent executes an ordinary task where malicious content is introduced via a realistic "Carrier" (e.g., a workspace file or user message). The framework verifies if the malicious semantics successfully persist in the backend.
  2. Execute: In a fresh session, the agent is given a natural downstream task. The framework checks if the agent recalls the poisoned memory, adopts it into its reasoning, and translates it into a verified external consequence (e.g., a server-side audit log or a simulated email dispatch).
  3. Forget: The agent is given a neutral prompt to perform a security self-check and clean up its memory.

To evaluate this objectively, MemSecBench uses an Evidence-Based LLM Judger (powered by DeepSeek-V4-Pro) alongside deterministic programmatic gates. Instead of relying on the agent's self-reports or vague intentions, the judger strictly evaluates concrete artifacts like database diffs, tool execution logs, and final environment states.

Figure 3: Overview of MemSecBench benchmark construction and lifecycle evaluation. The left panel summarizes the appli- cation domains, four design axes, and linked task-package structure. The center panel shows the evaluated agent-harness–LLM- backend–memory-backend configuration and the Write–Execute/Forget workflow. The right panel shows checkpoint-specific evidence adjudication and lifecycle gates.

Datasets

The paper introduces the MemSecBench benchmark, which contains 310 linked lifecycle cases drawn from 48 realistic scenarios. The cases are balanced across three primary domains:

  • Code and Science (e.g., repository management, data analysis)
  • Daily Life (e.g., smart-home automation, personal scheduling)
  • Office Work (e.g., invoice processing, vendor onboarding)

Each case is structured as a complete package containing clean initial memory states, stage-specific prompts, and strict verification rubrics. The benchmark evaluates these cases across a 24-configuration matrix combining two agent harnesses (OpenClaw, Hermes), four memory backends (Native file-based, Mem0, Mem0-Graph, A-MEM), and three LLMs (DeepSeek-V4-Pro, MiniMax-M3, GPT-5.5).

Key Insights and Ideas

  • The Adoption Bottleneck: Interestingly, memory systems are incredibly permissive during ingestion and recall. Malicious memory persists 84.2% of the time and is successfully recalled 76.1% of the time. The true bottleneck for an attacker is adoption—convincing the agent to actually prioritize and act on the malicious memory over local constraints, where the success rate drops to 53.7%.
  • The Collateral Damage of Forgetting: When agents are told to remove unsafe rules, the primary bottleneck isn't deleting the bad data (which succeeds 86.3% of the time), but benign-memory preservation. Agents frequently suffer from over-deletion, wiping out valid user preferences and history alongside the malicious payload, dropping the true Selective Repair Success Rate to 56.1%.
  • No Universally Safe Backend: Security cannot be evaluated by looking at a memory backend in isolation. For instance, swapping a native file-based memory for A-MEM drastically improved selective repair rates (+41.3 percentage points) in an OpenClaw/DeepSeek setup, but actually increased end-to-end attack success rates in other configurations.
Figure 4: Configuration-macro-average lifecycle rates. At- tack checkpoints use all cases, whereas repair outcomes con- dition on successful poisoning.

Key Results

Averaged across all 24 tested agent-LLM-memory configurations:

  • Memory Poisoning Success Rate (MPSR): 84.2% of cases successfully wrote malicious semantics into long-term storage.
  • End-to-End Attack Success Rate (E2E-ASR): 50.3% of all cases successfully completed the entire chain from poisoning to executing a harmful external action.
  • Selective Repair Success Rate (SRSR): Only 56.1% of poisoned instances were successfully repaired without destroying essential, benign background memories.

Limitations and Future Work

While MemSecBench provides a vital framework for agent security, the authors note several limitations:

  • Synthetic Workspaces: Although human-verified and highly realistic, the task environments and data are synthetically generated (via GPT-5.5) and may lack the messy complexity of real-world enterprise deployments.
  • Generic Attack Payloads: The benchmark tests general susceptibility rather than highly optimized, mechanism-specific adversarial attacks designed to exploit specific vector indexing or graph structures.

Future work will focus on developing backend-specific memory attacks, isolating storage layer effects through controlled ablations, and automating broader benchmark expansion into more complex operational scenarios.

Summary updated

BibTeX
@misc{chen2026memsecbench,
  author = {Xuanze Chen and Xukang Xie and Wentao Fu and Jiajun Zhou and Shanqing Yu and Qi Xuan},
  title = {{MemSecBench: Tracking Agent Memory Poisoning from Persistence to Consequence and Repair}},
  year = {2026},
  eprint = {2607.27080},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.27080},
}
Figure