Explore Grablex
NEWS / AI AGENT SECURITY / MEMORY & PROMPT INJECTION

The conversation ends.
The instruction can stay.

A study of memory-enabled coding agents found a split result: it was difficult to make the systems write malicious instructions into memory from untrusted content, but payloads already planted in memory could affect later sessions. That difference matters for how teams test agents that carry state forward.

A magnifying lens reveals a concealed vermilion-edged slip beneath an open scientific folio, with a fine red thread leading to a separate drawer.SYMPLOKA / NEWS / SYMPLOKA
AGENT SECURITY / PERSISTENT STATE

A note can outlast the session.

Persistent state turns yesterday’s file into part of tomorrow’s prompt—and part of the security boundary.

THE TEST

The researchers looked at both how a malicious note gets stored and what happens after it is there.

Gadgil and colleagues tested Claude Code and Codex across four models in a sandboxed synthetic workspace. The setting used persistent files and preferences that could carry information from one session into the next.

The authors found it difficult to make an agent overwrite its own memory with malicious content from an untrusted source. But when an attack payload was already planted in those files, it could influence the current task and later sessions.

SOURCESGadgil et al., Bad Memory: Evaluating Prompt Injection Risks from Memory in Agentic Systems (arXiv preprint, 16 July 2026) ↗
THE IMPORTANT DISTINCTION

A memory-write defense does not automatically protect memory that is already trusted.

The results varied across the tested systems, models, adversarial goals, and multi-session sequences. The paper does not measure how often these attacks happen in deployed products. It does show why testing only the act of writing memory can miss a payload that is quietly waiting to be retrieved later.

In practice, a memory entry has at least two questions attached to it: where did this come from, and is that source allowed to change how the agent behaves? Treating every remembered sentence as policy collapses those questions into one.

A remembered instruction should carry its provenance with it.

A PRACTICAL RED TEAM

Change the task after seeding memory, then see what the agent carries forward.

A useful test can seed both benign and adversarial notes, start a fresh session with a different goal, and check whether the agent can identify the source, explain why an instruction is present, and remove it when appropriate. The report should record what the controls blocked as well as what they missed; over-restricting memory can also break legitimate adaptation.

The paper motivates safeguards around memory updates, but it does not establish one defense as sufficient. Provenance, reviewable writes, version history, and revocation are design options to test against the system’s actual memory format and threat model.