Agentic AI Security
Memory Poisoning: Treating Agent Memory as a Write Path
Persistent memory lets one prompt injection shape every later session. Documented cases from 2024 to 2026, what vendors changed, and the controls that belong on the path by which an agent writes to its own memory.
A prompt injection normally ends with the session it was delivered in. Persistent memory changes that. When an assistant can store facts, preferences or instructions and reload them later, an injection that reaches the memory store keeps acting in every later conversation, long after the web page or document that carried it has been closed.
The OWASP Top 10 for Agentic Applications for 2026, published in December 2025, gives this risk its own entry, ASI06, Memory & Context Poisoning. It covers “any information an agent retains, retrieves, or reuses, such as summaries, embeddings, and RAG stores,” and describes the attack as adversaries who “corrupt or seed this context with malicious or misleading data, causing future reasoning, planning, or tool use to become biased, unsafe, or aid exfiltration.” One of its example scenarios is the case this article focuses on: “An attacker implants a user assistants’ memory via Indirect Prompt Injection, compromising that user’s current and future sessions.”
What the documented cases show
Three of the cases below are researcher demonstrations, against ChatGPT, Gemini and an agent built on Amazon Bedrock. The fourth, from Microsoft, describes promotional attempts by legitimate companies. None describes exploitation by threat actors, and in most of them the vendor’s position is known only through the researcher’s account.
| Case | How memory was written | Vendor response, as reported |
|---|---|---|
| ChatGPT macOS app, “SpAIware” (2024) | A web page carried instructions that stored a memory telling ChatGPT to send future conversations to the attacker | OpenAI fixed the exfiltration channel in version 1.2024.247; memory writes from untrusted content remained possible, according to the researcher |
| Google Gemini (2025) | A document’s hidden instructions made Gemini call the memory tool when the user later replied with a common word such as “yes” | Google assessed it, according to the researcher, as “low likelihood and low impact” |
| Agent built on Amazon Bedrock (2025) | A web page manipulated a test agent’s session summarization, which fed its long-term memory | Unit 42 called it “not a vulnerability in the Amazon Bedrock platform”; Amazon said Guardrails with the prompt-attack policy mitigates it, and the test ran without Guardrails |
| Promotional prompts (reported 2026) | Links that pre-fill a prompt asking an assistant to remember a company as a trusted source, so that the outsider’s prompt arrives as the user’s own | Microsoft observed attempts in email traffic and listed the safeguards in its own assistants |
Source: Johann Rehberger, Embrace The Red (20 September 2024; 10 February 2025); Unit 42, Palo Alto Networks (9 October 2025); Microsoft Defender Security Research Team (10 February 2026). Classification is the author's.
The write was triggered by content, without the user asking for it. In the ChatGPT case, Johann Rehberger showed that a website “contains instructions that take control of ChatGPT and insert the malicious data exfiltration memory that will send all future chat data to the attacker going forward.” OpenAI’s fix closed the exfiltration path, and Rehberger noted what it left in place: “A website or untrusted document can still invoke the memory tool to store arbitrary memories.”
The trigger can be delayed. In the Gemini case, Rehberger used a technique named delayed tool invocation: the attacker “‘pollutes’ the chat context with instructions and a trigger action,” so that the memory tool runs only when the user later types a word such as “yes.” In effect, the user’s own reply triggers the write. Rehberger noted that Gemini shows “a clear UI indicator when the memory tool is invoked,” which helps only if the user notices it.
Summaries are a write path too. Unit 42’s demonstration, on a test agent built with Amazon Bedrock Agents and without Guardrails enabled, did not call a memory tool directly. A web page manipulated “the agent’s session summarization process,” and the summary became long-term memory, which “ultimately allows the agent to silently exfiltrate a user’s conversation history in future interactions.” OWASP lists the same mechanism among its examples: content injected into a conversation “so that it is later summarized or persisted in memory.”
Attempts are already appearing outside research. Microsoft’s Defender team reported in February 2026 that “over 60 days, while reviewing AI-related URLs observed in email traffic, we identified 50 distinct examples of prompt-based attempts directly aimed to influence AI assistant memory,” from 31 companies seeking to be remembered as recommended sources. The report describes attempts, and notes that their effectiveness “varies by platform and has changed over time.” Their purpose was promotion, and the prompt reached the assistant looking like the user’s own request.
Memory is a write path, and it needs controls
The cases above all turned on the moment an agent decides to write to its memory. I would design that write path with the same care as a write to any system of record, because what is written there will be trusted by every later session.
Source: Author's diagram, adapted from OWASP Top 10 for Agentic Applications for 2026 (December 2025), ASI06 mitigations, and Johann Rehberger's recommendations (10 February 2025).
1. Know what triggered each write. A memory written because the user asked for it carries different trust from one written while the agent was reading a web page. Recording the trigger, the session’s sources and the time with each entry gives every later control something to work with. OWASP asks for the same thing: “Require source attribution and detect suspicious updates or frequencies.”
2. Confirm writes made while untrusted content is in context. Rehberger’s recommendations after the Gemini case were to “require explicit user confirmation before persisting new memories” and, more generally, that “once the chat context is polluted with untrusted data, all sensitive tool invocations should require user confirmation.” Writing to memory is a sensitive tool invocation by that definition. After a later case in Windsurf, a coding assistant, in August 2025, Rehberger wrote: “Systems should suggest memories to the user, rather than automatically adding them.”
3. Scan what is written. OWASP’s guidance is to “scan all new memory writes and model outputs (rules + AI) for malicious or sensitive content before commit.” In a store meant for user preferences and facts, instructions addressed to the assistant, URLs and requests to forward or send data should at least be flagged for confirmation.
4. Keep the agent’s own outputs out of trusted memory by default. The Bedrock case shows why. OWASP calls for preventing “automatic re-ingestion of an agent’s own generated outputs into trusted memory to avoid self-reinforcing contamination,” which applies directly to summaries generated from sessions that included untrusted content.
5. Segment, expire and make reversible. Memory for one user should never be retrievable for another, and shared stores need per-tenant namespaces. OWASP adds two controls that limit how long a successful poisoning lasts: “Expire unverified memory to limit poison persistence,” and use “snapshots/rollback and version control.” For enterprise assistants, rollback should be possible per user and per time window, so that a security team can remove everything written during a suspicious session. On the read side, OWASP suggests weighting retrieval by trust and tenancy, so that low-trust entries carry less weight when they reach the agent’s context.
Making memory visible to users and defenders
The vendors’ consumer controls point the same way. OpenAI’s announcement of ChatGPT memory told users they could “view and delete specific memories or clear all memories in settings,” and Microsoft’s February 2026 advice to users was direct: “If you see memories you don’t remember creating, remove them.”
Users cannot be the only line of review, so an enterprise deployment needs the equivalent for defenders: an export of memory writes with their provenance into the security monitoring pipeline, alerts on writes that contain instructions or URLs, and a periodic review of memory entries that came from sessions with external content. Microsoft’s own report includes hunting queries for links that ask assistants to “remember” content, which is the kind of detection a security operations team can run today.
For each agent with persistent memory, the design questions are who or what may write to its memory, under which conditions, and how quickly a bad write can be found and removed.