InjecMEM: Memory Injection Attack on LLM Agent Memory Systems

AuthorsHanling Tian, Gengyu Zhang, Zeyang Sha et al.

arXiv 20262026

TL;DR

InjecMEM uses a retriever agnostic anchor plus a Multi GCG adversarial command to reach 76.6% ASR c and 35.4% RSR on MemoryOS.

SharePost on XLinkedIn

Read our summary here, or open the publisher PDF on the next tab.

THE PROBLEM

Persistent agent memory can be steered by a single injected interaction (InjecMEM achieves 76.6% ASR-c)

Memory augmented agents continuously write and retrieve logs, creating a new attack surface where a single injected page can persist and steer future outputs.

InjecMEM shows that MemoryOS and MemGPT can be driven to a pre specified harmful answer on a topic, while non target queries remain unaffected, exposing a serious security boundary in agent memory.

HOW IT WORKS

InjecMEM: Retriever agnostic anchor plus Multi GCG adversarial command

InjecMEM builds a retriever agnostic anchor and an adversarial command using Multi GCG that are logged into MTM via the MemoryOS STM MTM LPM pipeline.

Think of the anchor as a broad topic label in a card catalog, and the adversarial command as a short but powerful instruction that always fires when that card is pulled.

This design lets InjecMEM survive memory drift and long fused prompts, enabling targeted steering that a plain context window or static RAG index cannot achieve.

DIAGRAM

Single shot memory injection and later query steering

This diagram shows how InjecMEM injects a poisoned page once and how later benign queries retrieve it to steer responses toward the target output.

DIAGRAM

Evaluation pipeline across domains and memory systems

This diagram shows how InjecMEM is evaluated on MemoryOS and MemGPT over synthetic multi domain dialogues and topic queries.

PROCESS

How InjecMEM Handles a MemoryOS Dialogue Turn

  1. 01

    Write pipeline and STM enqueue

    At dialogue turn t, InjecMEM crafts qadv so the resulting page pt is enqueued into Short Term Memory STM as part of the MemoryOS write pipeline.

  2. 02

    MTM segment assignment

    When pt ages out of STM, MemoryOS passes it to Mid Term Memory MTM, where similarity sim pt g with threshold theta assigns it to topic segments G.

  3. 03

    Retriever agnostic anchor driven retrieval

    For later user queries q on topic tau, InjecMEM relies on the retriever agnostic anchor so MTM segment selection and page retrieval include the poisoned page p star.

  4. 04

    Multi GCG adversarial command steering

    The Multi GCG optimized adversarial command inside p star ensures that when fused into C q M, the backbone LLM outputs the target answer A star with high ASR c.

KEY CONTRIBUTIONS

Key Contributions

  • 01

    Formalizing memory injection vulnerability

    InjecMEM identifies continuous writes plus hybrid retrieval in STM MTM LPM as a distinct attack surface, formalizing RSR and ASR c to quantify memory injection risk.

  • 02

    Retriever agnostic anchor plus adversarial command

    InjecMEM introduces a retriever agnostic anchor and Multi GCG adversarial command that together achieve up to 35.4% RSR@50 and 76.6% ASR c on MemoryOS.

  • 03

    Transfer and concatenation across backbones

    InjecMEM extends Multi GCG to Family Joint and Cross Family optimization, and shows concatenated commands can compromise Qwen Mistral and Llama backbones simultaneously.

RESULTS

By the Numbers

RSR@50 Health

35.4%

+0.3 over Cent + GCG

ASR-c MemoryOS

76.6%

+76.6 over DPI

ASR-j MemoryOS

35.6%

joint end to end success with retrieval

RSR MemoryOS

46.5%

average retrieval success across domains

These metrics come from synthetic multi domain evaluations on MemoryOS and MemGPT, measuring retrieval success rate RSR and attack success rate ASR c and ASR j. The 76.6% ASR c and 35.6% ASR j show InjecMEM can reliably steer topic conditioned responses after a single injection.

BENCHMARK

By the Numbers

These metrics come from synthetic multi domain evaluations on MemoryOS and MemGPT, measuring retrieval success rate RSR and attack success rate ASR c and ASR j. The 76.6% ASR c and 35.6% ASR j show InjecMEM can reliably steer topic conditioned responses after a single injection.

BENCHMARK

RSR(%) across domains for InjecMEM and baselines (@50)

Retrieval Success Rate RSR@50 on health finance agriculture averaged over 19 domains.

KEY INSIGHT

The Counterintuitive Finding

InjecMEM’s Multi GCG command reaches 76.6% ASR c while DPI BadChain and vanilla GCG all collapse to 0.0% in memory augmented settings.

This is surprising because DPI and GCG are strong prompt injection baselines, yet memory drift and variable placement completely break them, revealing hidden assumptions about static prompts.

WHY IT MATTERS

What this unlocks for the field

InjecMEM provides a reproducible framework and metrics to stress test agent memory systems like MemoryOS and MemGPT under realistic single shot injection attacks.

Builders can now design and evaluate hardened memory write and retrieval policies, and reason about memory as a security boundary rather than just a capability module.

~12 min read← Back to papers

Related papers

BenchmarkAgent Memory

Active Context Compression: Autonomous Memory Management in LLM Agents

Nikhil Verma

· 2026

Focus Agent adds start_focus, complete_focus, a persistent Knowledge block, and an optimized Persistent Bash plus String-Replace Editor scaffold to actively compress context during long software-engineering tasks. On five hard SWE-bench Lite instances against a Baseline ReAct agent, Focus Agent achieves 22.7% token reduction (14.9M → 11.5M) while matching 3/5 = 60% task success.

Agent Memory

ActMem: Bridging the Gap Between Memory Retrieval and Reasoning in LLM Agents

Xiaohui Zhang, Zequn Sun et al.

· 2026

ActMem transforms dialogue history into atomic facts via Memory Fact Extraction, groups them with Fact Clustering, links them through a Memory KG Construction module, and uses Counterfactual-based Retrieval and Reasoning for action-aware answers. On ActMemEval, ActMem reaches 76.52% QA accuracy with DeepSeek-V3, beating LightMem’s 63.97% by 12.55 points and NaiveRAG’s 61.54%.

Questions about this paper?

Paper: InjecMEM: Memory Injection Attack on LLM Agent Memory Systems

Answers use this explainer on Memory Papers.

Checking…