How does memory poisoning differ from prompt injection?
A classic prompt injection lives for the length of one session. The attacker places an instruction in a document, the agent reads it and acts, then the conversation ends and the context disappears. To try again, the attacker has to get booby-trapped content in front of the agent once more. This mechanism is described in the article on indirect prompt injection.
Once an agent has a memory, the situation changes. An agent's memory is a space where the agent itself writes what it retained, then rereads it at the start of later sessions. If the booby-trapped instruction is retained when the agent summarizes its session, it leaves the ephemeral content and enters what the agent considers its own knowledge. The attack is written once and triggers later, with the attacker nowhere near.
The OWASP reference for agentic applications, published in December 2025, gave this category a name: ASI06, Memory & Context Poisoning. It takes care to separate it from injection. The context it targets includes, in its words, summaries, embeddings, and RAG stores, and excludes one-time input prompts, which fall under LLM01. The text specifies that the risk is the persistent corruption of memory and retrievable context, the kind that propagates across sessions.
What sets memory poisoning apart from injection comes down to one word: duration. Injection plays out within one session. Poisoning settles in for every session that follows.
What ASI06 describes, and what the text does not say
The definition of ASI06 is short. Adversaries corrupt or seed this context with malicious or misleading data, which makes later reasoning, planning or tool use biased, unsafe, or aid exfiltration. The document also lists the ingestion sources that may be only partially validated: uploads, API feeds, user input, exchanges between agents.
It lists six common forms. Poisoning of RAG stores and embeddings. Poisoning of a context shared between users. Manipulation of the context window so that injected content is later summarized and kept. Slow drift of long-term memory through gradual exposure to slightly altered data. Backdoors triggered by a specific pattern. Propagation from one agent to another. The first two are covered in detail in the article on knowledge base poisoning.
One scenario in the document deserves a full read, because it assumes no malicious code. An attacker spreads attempts over several sessions so that earlier refusals fall out of the context, and the assistant ends up granting escalating permissions, up to those of an administrator. A memory does not have to be falsified all at once. It can be done in small touches, each acceptable, where only the sum is hostile. The mechanism echoes that of multi-step attacks, with one difference: here, the steps are days apart.
The same document links ASI06 to other risks on its list. It writes that memory poisoning frequently leads to goal hijacking (ASI01), because a corrupted context changes how the agent interprets its goal. Memory is therefore a means, not only a target.
The public Unit 42 case: from web page to memory
On October 9, 2025, Royce Lu and Jay Chen of the Unit 42 team at Palo Alto Networks published a demonstration titled When AI Remembers Too Much – Persistent Behaviors in Agents' Memory. It concerns the memory feature of Amazon Bedrock Agents. The setup of the experiment matters for reading it: a travel assistant built with the templates managed by AWS, the Amazon Nova Premier v1 model, and no Bedrock Guardrails.
How the memory works explains the attack. At the end of a session, explicit or by expiry, a language model summarizes the conversation using a configurable template. By default, the summary retains the user's goals and the assistant's actions, and it is stored under a memory identifier, usually specific to the user. In the next session, that summary is injected into the orchestration prompt, in the system instructions. Retention can reach 365 days.
The chain the authors describe has five steps. The attacker publishes a page containing hidden instructions and gets a victim to submit its address to the agent. The agent fetches the page. At the end of the session, the summarization files the injected instructions among the memories as if they were legitimate. In later sessions, the memory is inserted into the orchestration prompt. The agent then executes, with its web access tool, actions the user never asked for, which the article describes as silent exfiltration.
Two sentences of the article sum up the stakes. The first is about duration: Once planted, these instructions persist across sessions. The second is about the rank a memory takes: since memory contents are injected into the system instructions of the orchestration prompt, they are often prioritized over user input. In other words, a poisoned memory weighs more than the request of the user who is present.
The article is explicit about its limits. Unit 42 writes that this is not a vulnerability in the Amazon Bedrock platform. Amazon, according to the article, welcomed the research and said the attack is neutralized by turning on Bedrock features, notably the default pre-processing prompt and the Guardrails policy against prompt attacks. Unit 42 agrees for the specific attack it shows. The lesson therefore does not depend on a product. It rests on what the article itself states: models do not reliably tell benign input from malicious input.
The precedents: ChatGPT, then Gemini
The Unit 42 demonstration is not isolated. Johann Rehberger, on his blog Embrace The Red, documented the same phenomenon on consumer assistants, with three dates.
- May 22, 2024Rehberger shows that ChatGPT's memory, on by default, can be fed with untrusted content: a connected Google document, an uploaded image, browsing with Bing. False memories are created, and a simple injection can also erase existing ones. OpenAI closes the report as a model safety issue, not a security vulnerability.
- September 20, 2024He publishes SpAIware: on the ChatGPT app for macOS, an injection from a website or a document installs instructions in memory that continuously exfiltrate the messages and answers of future sessions. OpenAI fixes the problem in version 1.2024.247, in September 2024. The fix addresses the exfiltration channel, not the injection: the site or document can still invoke the memory tool.
- February 10, 2025On Gemini's long-term memory, a booby-trapped document makes it add false memories after the user answers "yes". This is "delayed tool invocation": the injection pollutes the conversation with a condition, and the sensitive tool is called later, on a request that seems to come from the user. Google judges the risk, according to Rehberger, an abuse-related risk with low likelihood and low impact.
The last case shows why protections that forbid the agent from calling a sensitive tool while it reads untrusted content are not enough. The trigger is a word from the user, written earlier by the attacker.
Another piece of research measures how easy the drop is. Zhaorun Chen and his coauthors published AgentPoison in July 2024, which poisons the long-term memory or knowledge base of agents. The authors report an average success rate above 80% across three agents, a poisoning rate below 0.1% and an effect below 1% on normal behavior. A memory can therefore be altered without its ordinary use changing in any visible way.
What must an agent's memory guarantee?
An agent's memory is neither a log nor a reference database. It is a mix of what the user said, what the agent read and what the agent inferred. For it to be useful without doing harm, four guarantees follow from the measures OWASP recommends for ASI06.
| Guarantee | Question it answers | What it interrupts |
|---|---|---|
| Provenance | Where does this memory come from: the user, a tool, a page, another agent? | Third-party content passing itself off as a user preference. OWASP asks to require source attribution and to detect suspicious or overly frequent updates. |
| Integrity | Was this write checked before it went in? | The automatic summary that files an instruction among the memories. OWASP asks to scan new writes before committing them and to prevent an agent from re-ingesting its own outputs into a trusted memory (bootstrap poisoning). |
| Expiry | Is this memory still valid, and who confirmed it? | Persistence. OWASP asks to expire unverified memory and to decay low-trust entries over time. |
| Isolation | Which user, which domain, which agent can read this memory? | Contamination from one user to another and from one agent to another. OWASP asks to isolate sessions and domains, and to use per-tenant namespaces for shared memories. |
Provenance is the guarantee that changes the most. A memory without a source makes it impossible to know, three weeks later, which page produced which memory, and so which other memories are suspect. It also separates a preference stated by the user from a fact picked up from a page, which should never carry the same rank in the prompt. That rank is precisely what the Unit 42 attack exploits.
Isolation is the most neglected guarantee. OWASP describes a scenario where fake refund policies, inserted into a shared memory, are reused by other agents and lead to wrong decisions and disputes. A shared memory multiplies the number of people and agents that a single poisoned memory reaches.
A memory that retains people is data to be treated as such
What an enterprise agent's memory retains is preferences, names, exchanges, case files. The GDPR applies as soon as these items concern identifiable people. Three of its provisions line up directly with the guarantees above.
accurate and, where necessary, kept up to date; every reasonable step must be taken to ensure that personal data that are inaccurate, having regard to the purposes for which they are processed, are erased or rectified without delayGDPR, Article 5(1)(d)
A false memory about a person is inaccurate data. The accuracy principle requires erasing or rectifying it without delay, which presupposes being able to find it. Article 5(1)(e) adds that data is kept only for as long as the purposes of the processing require: that is expiry, seen through the law. Article 17 sets out the right to erasure, which the person exercises with the controller. Article 32, finally, asks for measures that ensure the ongoing confidentiality and integrity of processing systems. A memory that accepts any write has no integrity to guarantee.
The AI Act is quieter. Its Article 15(5) requires high-risk systems to resist attempts by unauthorized third parties to alter their use, outputs or performance. The measures it details target the poisoning of training data and pre-trained components. The text does not name an agent's memory. It does not exclude it either: a third party who alters the outputs of a high-risk system by exploiting a vulnerability falls within the sentence. The full reading is in the analysis of the AI Act applied to agents.
Detect, then roll back
A poisoned memory is rarely spotted by its content. A booby-trapped memory can look like an ordinary preference. What gives the attack away is the sequence: a session where the agent read third-party content, a memory write right after, then unusual behavior later. To see it, you have to keep the link between what the agent read, what it retained and what it did next. A log of actions alone does not provide that.
OWASP asks for three complementary protections: snapshots with rollback and version control, a quarantine regime for suspicious entries, and human review of high-risk actions. A rollback is possible only if memory versions are kept and timestamped. A memory modified in place, with no history, can only be wiped in full.
SentinelOS judges every action before it leaves, including when the order comes from a memory or a document the agent read, and records in a chained log what the agent had read at the moment of the decision. The control then does not depend on the quality of the memory: a poisoned memory that calls for an outgoing action meets the same judgment as a booby-trapped page.
Treat every recall as an input
The lesson of the Unit 42 case comes down to one architecture rule: what comes back from memory has no more authority than what the agent just read on the web. Here is the order in which teams apply this rule.
- Decide what is allowed to be retained. Preferences stated by the user, yes. The content of pages, emails and files read, no, unless validated. The list is written down, not left to the default summarization template.
- Mark the origin of every memory. User, tool, page, other agent. A memory without an origin is not recalled into the system instructions.
- Let the memory speak after the user, never before. A memory does not go in the system instructions. It arrives in the context as information to verify, with its source.
- Partition by user and by domain. A shared memory is a design decision, with a named owner.
- Set a lifetime. Unconfirmed memories expire. Memories that drive an outgoing action require confirmation.
- Control the action, not only the write. A filter on memory writes lowers the frequency of poisonings. Only a judgment of the action, placed outside the model, stops a memory already installed from turning into a leak.
- Plan the rollback. Memory versions, quarantine of suspicious entries and a restore drill, before the incident.
SentinelOS judges every action of your agents before it leaves, holds the ones that matter for a person, and signs every decision. Installed on your premises.
Discover SentinelOSSources
- OWASP GenAI Security Project, "OWASP Top 10 for Agentic Applications for 2026", December 2025, entry ASI06 "Memory & Context Poisoning". genai.owasp.org
- Royce Lu and Jay Chen, Unit 42, "When AI Remembers Too Much – Persistent Behaviors in Agents' Memory", October 9, 2025. unit42.paloaltonetworks.com
- Johann Rehberger, "ChatGPT: Hacking Memories with Prompt Injection", Embrace The Red, May 22, 2024. embracethered.com
- Johann Rehberger, "SpAIware" (ChatGPT app for macOS), Embrace The Red, September 20, 2024. embracethered.com
- Johann Rehberger, Gemini long-term memory and delayed tool invocation, Embrace The Red, February 10, 2025. embracethered.com
- Chen, Xiang, Xiao, Song, Li, "AgentPoison: Red-teaming LLM Agents via Poisoning Memory or Knowledge Bases", arXiv:2407.12784, July 2024. arxiv.org
- Regulation (EU) 2016/679 (GDPR), Articles 5, 17 and 32. eur-lex.europa.eu
- Regulation (EU) 2024/1689 (AI Act), Article 15(5). eur-lex.europa.eu
