Editor’s note: This is part one in a seven part series investigating agentic memory forensics from Rubrik Zero Labs.
In the Indian film Ghajini (2008), the hero, Sanjay, loses his memory every fifteen minutes. So he runs his life on Polaroids, notes and tattoos. Whatever a note says, he trusts and acts on. Ghajini draws on Christopher Nolan's film Memento, which makes the point even more sharply. Its hero, Leonard, ends the film by deliberately writing a note that points his future self at the wrong man. Because the note is in his own handwriting, future Leonard will never doubt it.
The metaphor is apt for agentic AI. It starts each session knowing nothing about the past, and it acts on the notes its memory hands back. Nothing on a note proves who wrote it.
This series aims to describe the implications of that fact from a security perspective.
But first, we need to explore the concept of "memory" more deeply.
Four kinds of memory
"Memory" is used loosely when describing agents. There are actually four distinct types. The split is borrowed from cognitive science and used in agent research (see the CoALA framework, reference 1).
| Type | The question it answers | In a typical agent |
|---|---|---|
| Working | What's in front of me now? | The context window. This disappears after the call. |
| Semantic | What do I know? | Inputs form a knowledge base acting in RAG function. |
| Procedural | How do I behave? | The system prompt, code, and model weights. This memory is static between releases. |
| Episodic | What happened before? | The agent's own record of past interactions: (e.g. "The last time we saw this pattern, it was X and we did Y.") |
This series is about the last memory type. Episodic memory differs in two ways from the rest of the memory types. The agent writes episodic memory itself, every session, so it changes constantly. And it is relevant to every future decision.
That’s also why it’s hard to protect. You can hash a system prompt and check later that it hasn't changed. You can't hash a memory that is supposed to change every session.
Why memory is an attack surface
An agent is more than a model. It is a loop (plan, act, observe) connected to a model, tools, other agents, a human who acts on the output, and memory. Each connection is a place where an attacker can input content. Most threat research today looks at the model (prompt injection) and the tools.
Memory is different because it persists. What lands there is carried into every later session. And inside the context window the model sees one block of text. It does not differentiate between the system prompt, user, or memory. It trusts all of it.
This is not theory. In 2024, the researcher Johann Rehberger showed that a web page or document could make ChatGPT store attacker-chosen "memories" through prompt injection, and that those memories carried into later conversations (reference 2). Four months later he combined it with data exfiltration to build persistent spyware inside ChatGPT's memory, which he called SpAIware (reference 3). OpenAI fixed the exfiltration route, but he noted that writing false memories through injection was still possible.
The anatomy of agent memory
Strip away the framework names and nearly every agent memory does the same four things.
| Step | What happens | Evidence it leaves |
|---|---|---|
| 1. Write | After a session, it picks out what is worth keeping | Often a ledger |
| 2. Store | Keep the text, some metadata and a vector for similarity search | The files on disk |
| 3. Retrieve | For a new question, find the most similar past memories | Usually none |
| Use | Place them in the context window, next to the system prompt and the question | Only what you log |
What is already known, and what is missing
You don't need to be familiar with the whole literature to follow this series. The short version, with each paper read at its arXiv abstract:
- Attacks are well studied. MINJA (reference 4) shows an attacker can inject malicious records into an agent's memory using only normal queries and observing outputs. MemoryGraft (reference 5) plants malicious "successful experiences" that the agent later imitates. MemPoison (reference 6) is a benchmark of 1,227 cases. It found that write-time defences such as consistency checks substantially suppress single bad records, but do not reliably stop coordinated multi-record or trigger-activated ones. MPBench (reference 7) maps four ways memory gets written and finds that agents that write and retrieve more aggressively are more exploitable. FARMA (reference 8) poisons the agent's remembered reasoning rather than its facts. A survey from April 2026 (reference 9) lays out the whole lifecycle and argues that memory security must be anchored in storage-time provenance and versioning.
- The forensic side is thinner, but it is moving. MemAudit (reference 10) is a post-hoc framework that asks which stored memories are responsible after harmful behaviour was seen, combining a counterfactual influence score with a consistency graph. It is evaluated against MINJA. RAGForensics (reference 11) does the equivalent for poisoned RAG knowledge bases. When we submitted the talk we couldn't find a published tool for this; both of these papers appeared after, or near, that time. In short, the field is moving quickly.
So our question was not "can memory be poisoned?" That is settled. We wondered what happens after a memory poisoning event and if it could be proven by an investigator.
The attacker we studied
Most published attacks come through the front door. The attacker talks to the agent, or hides instructions in a document, and the agent writes the poison into its own memory.
We studied a different attacker: one who was already inside. They have write access to the memory store (a compromised host, a shared volume, a backup, a plugin) and can write records straight into it. There is no conversation with the agent. No prompt filter ever sees the write.
That is a strong assumption and we want to be upfront about it. We think it is realistic, and it gives an investigator something useful. Direct writes skip the agent's normal write path, and that path leaves evidence behind. Part 4 is about what that evidence looks like, and what a careful attacker can forge.
Why Mem0
We used Mem0, an open-source memory layer for agents, on top of ChromaDB, a vector database. Our reasons were practical. Mem0 is widely used: its GitHub repository has about 68,000 stars (checked 3 November 2026), and its PyPI package sees roughly 90,000 downloads on a typical weekday in late October (including automated installs, so read it as scale, not as users). AWS and Mem0 announced a partnership in May 2025 to bring Mem0 to the Strands Agents SDK, and a strands-mem0 package exists. The store is local and easy to inspect, and Mem0 keeps a separate record of changes made through it.
We did not choose it because it is weaker than the alternatives. The findings here describe what an investigator gets by default from Mem0 2.0.2 and ChromaDB 1.1.1. Mem0 has since moved to a newer algorithm, which its README describes as single-pass, add-only extraction. Part 2 notes where this matters. The method carries over to other frameworks, and we compare a few of them in a later post.
The lab, in one paragraph
The victim is a security-operations advisor. An analyst describes an incident, the advisor looks up similar past cases in memory, and then gives advice. It is plain Python calling the OpenAI API (gpt-4o-mini), with Mem0 and ChromaDB for memory, one retrieve-then-reason pass and no tool loop. That keeps memory as the only variable. Before the attack, we ran fifteen realistic incidents through it and it built up 61 memories. Then we wrote 15 false "past cases" straight into the store. In an ambiguous incident, the advice changed from "isolate the workstation" to "don't isolate, keep monitoring".
Everything here runs on fake data in a lab. Nothing is a real company's system.
The Series
| Part | What it covers |
|---|---|
| 1. Agent memory in five minutes | The four kinds of memory, why memory is an attack surface, and a map of this series |
| 2. Inside Mem0 and ChromaDB | What is in the store, how a memory gets written, and what add() really does |
| 3. How we poisoned a Mem0 agent | The attack versions that failed, the one that worked, and why retrieval made it work |
| 4. Finding the injection | Provenance, cheap checks, what a careful attacker can forge, and why a statistical test missed it |
| 5. From evidence to cause | Which decisions read the poison, and how to show that memory caused the change |
| 6. Before the incident | What to switch on, the timeline an investigator needs, and five questions for your own system |
| 7. What we got wrong | The claims we had to correct along the way |
One thing to take away
If you run an agent with memory, ask five questions:
- Where does its memory live?
- What was written, when, and by whom?
- What did it read before it made a decision?
- What changed?
- And did memory change the decision?
If you can't answer these questions today, you won't be able to investigate tomorrow.
References
- Sumers, Yao, Narasimhan, Griffiths. Cognitive Architectures for Language Agents (CoALA). arXiv:2309.02427
- Rehberger. ChatGPT: Hacking Memories with Prompt Injection. Embrace The Red, 22 May 2024. link
- Rehberger. Spyware Injection Into Your ChatGPT's Long-Term Memory (SpAIware). Embrace The Red, 20 Sep 2024. link
- Dong et al. Memory Injection Attacks on LLM Agents via Query-Only Interaction (MINJA). arXiv:2503.03704
- Srivastava, He. MemoryGraft: Persistent Compromise of LLM Agents via Poisoned Experience Retrieval. arXiv:2512.16962
- Gao et al. MemPoison: Uncovering Persistent Memory Threats and Structural Blind Spots in LLM Agents. arXiv:2607.14651
- Dash et al. From Untrusted Input to Trusted Memory: A Systematic Study of Memory Poisoning Attacks in LLM Agents (MPBench). arXiv:2606.04329
- Karamchandani et al. Your Agent's Memories Are Not Its Own: Forged Reasoning Attacks on LLM Agent Memory and Defenses (FARMA). arXiv:2607.05029
- Lin et al. A Survey on Long-Term Memory Security in LLM Agents. arXiv:2604.16548
- Tan et al. MemAudit: Post-hoc Auditing of Poisoned Agent Memory via Causal Attribution and Structural Anomaly Detection. arXiv:2605.23723
- Zhang et al. Traceback of Poisoning Attacks to Retrieval-Augmented Generation (RAGForensics). arXiv:2504.21668
- Mem0 repository and README: github.com/mem0ai/mem0. AWS and Mem0 partnership: mem0.ai blog. Strands integration: docs.mem0.ai
LATEST BLOGS