← Lab /AI/ML

Planted memory payloads can hijack future agent sessions

Persistent memory in agentic systems enables prompt injection attacks that survive across sessions

AI/ML arXiv 16 Jul 2026 Measurement Simulation evidence

Published as “Bad Memory: Evaluating Prompt Injection Risks from Memory in Agentic Systems”

Why it matters

Defenses that only block immediate execution are insufficient; memory-update protections are needed to prevent stored prompt-injection from affecting future sessions.

Summary

Adversarial payloads planted in persistent workspace files can influence agent behavior in the current session and persist across future sessions. Experiments on Claude Code and OpenAI Codex with four LLM variants show attack success rates ranging from 0% to 100% depending on model, goal, and attack sequence, and persistence rates up to 100% even when the model refuses to execute the payload. The evidence comes from a sandboxed synthetic workspace evaluated over ten trials per configuration, demonstrating substantial variability but consistent vulnerability.

What they found 3

  1. Claude Haiku 4.5 achieves high attack success for credential exfiltration in a single probe

    “Haiku 4.5 80% 100% 10% 63.3%”

  2. Opus exhibits the highest mean persistence rate, keeping malicious instructions in memory even when it flags them

    “Opus has the highest mean persistence rate of 93%, indicating that it is the most cautious about changing the content of the memory files.”

  3. Models may refuse to execute a malicious instruction yet still leave the payload in memory

    “Even when models refuse to execute a malicious instruction, they may still leave the payload in memory, creating a risk for later sessions or weaker models.”

Caveats 2

  • Opus flags the instruction as unsafe but leaves it in place rather than editing it out.
  • Even when models refuse to execute a malicious instruction, they may still leave the payload in memory, creating a risk for later sessions or weaker models.

What’s new here 4

  • Systematic evaluation of prompt injection that persists across multiple agent sessions
  • Focus on file-based, user-curated memory rather than platform-managed memory
  • Multi-goal attacks (credential exfiltration, unauthorized tool use, brand targeting) with repeated and chained probe sequences
  • Measurement of both attack success rates and persistence rates across several LLM families