cs.AINov 1, 2026

MemHarmBench: Evaluating Cross-Session Prompt Injection in Memory-Persistent AI Agents

Authors: Zhihua Wang, Yunhao Feng, Yifeng Gao, Rui Pan, Baiheng Zhao, Zixing Chen, Xingjun Ma

Organizations: Fudan University · University of Shanghai for Science and Technology · Alibaba Group · Shanghai Innovation Institute

Abstract

AI agents often rely on persistent memory to retain user preferences and operational rules across sessions. However, this capability introduces a new safety risk: malicious instructions from messages, documents, or Web content can be retained in memory and influence future tasks even after the original attack content is removed. Existing attack success metrics, however, fail to capture who is affected and how attacks translate into downstream harm during otherwise normal task execution. We introduce MemHarmBench, a victim-centric benchmark for evaluating cross-session prompt injection in memory-persistent AI agents. MemHarmBench considers three categories of potential victims: users, workspace/project owners, and external stakeholders. Our evaluation first exposes an agent to malicious instructions and tests whether they are retained in memory. We then remove the attack content and initiate a new session with a legitimate task while preserving the agent's memory. We jointly evaluate whether the agent follows the attacker's intent, completes the legitimate task, and exhibits observable execution anomalies. Across multiple agent systems, we find that cross-session attacks can remain behaviorally stealthy: agents often complete tasks normally and exhibit no detectable anomalies while still making critical decisions aligned with the attacker's intent. By connecting malicious memory retention to downstream decisions and affected parties, MemHarmBench provides a systematic framework for exposing safety risks that conventional attack- and task-success metrics may overlook. We publicly release MemHarmBench at https://github.com/Kirito14IT/MemHarmBench.

Figures & tables

Appendix figures & tables9 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Bad Memory: Evaluating Prompt Injection Risks from Memory in Agentic Systems

    Jul 16, 2026Soham Gadgil, David Alexander, Sai Sunku +1AI Agent SecurityAgent Memory Poisoning

  2. What If Prompt Injection Never Left? Exploring Cross-Session Stored Prompt Injection in Agentic Systems

    Jun 3, 2026Yuanbo Xie, Tianyun Liu, Yingjie Zhang +4Prompt InjectionAI Agent Security

  3. When Malicious Instructions Persist: Persistent Memory Poisoning Attack on Harness-Based Agents

    Sep 12, 2026Shuhuai Huang, Jingfeng Zhang, Hong JiaLLM Agent SecurityAgent Memory Poisoning