cs.CRAug 24, 2026

InjecMEM: Memory Injection Attack on LLM Agent Memory Systems

Authors: Hanling Tian, Gengyu Zhang, Zeyang Sha, Jingying Wang, Yuhang Liu, Zhehao Huang, Kun Yang, Xiaolin Huang

Organizations: Institute of Image Processing and Pattern Recognition, Shanghai Jiao Tong University · Ant Group

Abstract

Memory is becoming a default subsystem in deployed LLM agents to provide persistent personalization and continuity. This naturally prompts a question: will memory system introduce new vulnerabilities into agents? Thus we propose InjecMEM, a novel memory injection attack paradigm that requires only a single interaction (no read/edit access to memory store) to steer later responses of related queries toward a pre-specified output. Guided by the retrieval-then-generate mechanism of memory systems, we craft the injection with a retriever-agnostic anchor and an adversarial command. The anchor contains high-recall topical cues so that downstream retrieval consistently associates the record with the target topic. The command is a short sequence optimized to remain effective under uncertain fused contexts, variable placements, and long prompts so that it reliably steers outputs once retrieved. We learn the command via gradient-based coordinate search, averaging over synthetic prompt templates and insertion positions, and extend it to joint optimization across backbones to study transfer. Evaluated across multiple memory systems and backbone models, InjecMEM achieves reliable topic-conditioned retrieval and targeted generation, remains effective under memory drift, and leaves non-target queries unaffected. Our results underscore the need to harden memory systems and provide a reproducible framework for studying agent memory.

Figures & tables

Appendix figures & tables9 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. MIND: Lightweight and Effective Memory Injection Defense for LLM Agents via Intent-Aware Information Bottleneck

    Jul 30, 2026Dongyi Liu, Haixing He, Xiaobao Wu +1Agent Memory PoisoningLLM Agent Safety

  2. From Untrusted Input to Trusted Memory: A Systematic Study of Memory Poisoning Attacks in LLM Agents

    Jun 3, 2026Pritam Dash, Tongyu Ge, Aditi Jain +2AI Agent Security BenchmarksAgent Memory Poisoning

  3. Hidden in Memory: Sleeper Memory Poisoning in LLM Agents

    May 14, 2026Sidharth Pulipaka, Stanislau Hlebik, Leonidas Raghav +4Persistent Memory for Language ModelsLLM Security