Agentic Security

Memory And Context Poisoning In AI Agents: How It Works And How To Defend.

Memory and context poisoning plants false or malicious data in what an AI agent remembers or retrieves, so it misbehaves in later sessions. OWASP lists it as ASI06 and MITRE ATLAS as AML.T0080. This article explains the routes and the defenses that sources recommend.

  • Secure The Agent
Part of
Secure The Agent
Reading time
5 min
Sources
6
Key Takeaways
  • Poisoned memory persists: it keeps shaping the agent across sessions, unlike a one-off prompt.
  • Memory, RAG indexes and connected data sources are all routes in.
  • Validate writes, segment memory and track the source of every entry.
  • Keep snapshots so you can roll back to a validated state.
Last updated October 12, 2026

What Is Memory And Context Poisoning?

Memory and context poisoning is an attack where someone plants false or malicious data in what an AI agent remembers or retrieves, so the agent behaves badly later, after the attacker has gone. OWASP lists it as ASI06 in its Top 10 for Agentic Applications 2026. It defines context as "any information an agent retains, retrieves, or reuses, such as summaries, embeddings, and RAG stores".

The key difference from ordinary prompt injection is persistence. OWASP says ASI06 excludes one-time input prompts and focuses on "persistent corruption of agent memory and retrievable context that propagates across sessions". Adversaries "corrupt or seed this context with malicious or misleading data, causing future reasoning, planning, or tool use to become biased, unsafe, or aid exfiltration". OWASP also notes that memory poisoning frequently leads to goal hijacking.

Anything that feeds the agent's memory is a possible way in. OWASP names uploads, API feeds, user input and peer-agent exchanges, which "may be untrusted or only partially validated". An AI agent that writes its own notes makes the problem worse, because it can store a poisoned instruction as if it were its own knowledge.

How a poisoned memory attack runs
  1. Attacker plants content in a source the agent readsIndirect prompt injection, AML.T0051.001
  2. The agent saves it to memoryAI Agent Context Poisoning: Memory, AML.T0080.000
  3. A later task retrieves the poisoned entryRAG Poisoning, AML.T0070, often in a new session
  4. The agent acts on itWrong answers, wrong tool calls or leaked data

Which Kinds Of Poisoning Should You Plan For?

There are three common routes, and the sources name them separately. In the ATLAS data, context poisoning and its memory sub-technique are tagged "Realized", while RAG poisoning and false RAG entry injection are tagged "Demonstrated". Plan for all of them.

  • Agent memory. MITRE ATLAS (data release v2026.09) lists AML.T0080 AI Agent Context Poisoning, with the sub-technique AML.T0080.000 Memory: changes that "persist across future chat sessions". Because memory is controlled through normal conversation, an attacker can add memories through direct or indirect prompt injection. There is also AML.T0080.001 Thread, where bad instructions last for the rest of a chat thread.
  • RAG and vector stores. AML.T0070 RAG Poisoning means injecting malicious content into data a retrieval augmented generation system indexes, to contaminate a future thread. AML.T0071 False RAG Entry Injection hides a fake document inside a normal entry, which "bypasses data monitoring tools" and "prevents the document from being deleted directly". OWASP LLM08:2025, Vector and Embedding Weaknesses, adds cross-context leaks in multi-tenant vector databases and notes poisoning can be intentional or accidental.
  • Connected data. AML.T0099 AI Agent Tool Data Poisoning covers poisoned data in repositories, knowledge bases and search indexes that an agent tool queries.

OWASP also lists slower forms. Long-term memory drift gradually shifts stored knowledge. Cross-agent propagation spreads contaminated context between cooperating agents. Example (illustrative). At acme.com, a support agent keeps a shared memory of refund rules. An attacker's message reinforces a fake rule until the agent stores it. Other agents reuse it, and refunds start going out against policy.

Why Is It Hard To Detect?

Poisoned entries look like ordinary data, and the damage shows up later. ATLAS notes that a false RAG document inside a regular entry gets past data monitoring. OWASP describes an attacker splitting attempts across sessions so earlier rejections drop out of the context, and "bootstrap poisoning", where an agent re-ingests its own outputs into trusted memory and reinforces the error. Because the corrupted state lives in a store, not in a single prompt, filtering prompts alone does not help. You have to control what gets written, what gets retrieved and who can change either.

There is also a trust problem on the retrieval side. An agent that finds a confident, well-formatted entry tends to use it. That is why OWASP asks for provenance scores and human-verified tags before high-impact memory is surfaced, and why it recommends detecting suspicious updates by their content and by how often they happen.

One-shot injection versus persistent poisoning
QuestionPrompt injectionMemory poisoning
How long does it last?One prompt or taskAcross sessions
Where does it live?In the inputIn memory, embeddings or a RAG store
Main OWASP entryLLM01:2025ASI06

How Do You Defend Against It?

OWASP gives nine mitigations for ASI06, and its threats guide has a full playbook for memory. Together they come down to a few habits.

  1. Validate before you write. "Scan all new memory writes and model outputs (rules + AI) for malicious or sensitive content before commit."
  2. Segment memory. Isolate user sessions and domain contexts. For shared vector stores, use per-tenant namespaces and permission-aware storage, as LLM08:2025 advises.
  3. Trust only curated sources. Allow authenticated, curated sources, and require source attribution so every entry can be traced. OWASP also asks teams to track data origins and transformations (LLM04:2025).
  4. Weight retrieval by trust. Require two factors to surface high-impact memory, for example a provenance score plus a human-verified tag, and let low-trust entries decay.
  5. Keep retention short. Minimize retention by data sensitivity, and expire unverified memory so poison does not persist.
  6. Do not self-feed. Prevent automatic re-ingestion of an agent's own outputs into trusted memory.
  7. Be able to roll back. Keep snapshots and version control, and log memory access and changes so you can restore a validated state. See monitoring and logging for AI agents.

CISA, the NSA, the FBI and partners make the same point for AI data in general. Their 2025 information sheet stresses data security for "the accuracy, integrity, and trustworthiness of AI outcomes" and recommends robust data protection and stronger monitoring and threat detection. Keep agent permissions small too: a poisoned memory can only trigger what the agent is allowed to do, so least privilege limits the blast radius. The mapping to other agent risks is in top threats to AI agents.

What To Do Next.

Start with an inventory, then close the write path.

Memory and context checklist
  • List every memory, vector store and RAG index your agents useYou cannot protect stores you have not found
  • Record who and what can write to each oneOWASP: ingestion sources may be untrusted
  • Scan new memory writes before they are savedOWASP ASI06: content validation
  • Separate memory by user, session and tenantOWASP ASI06 and LLM08:2025
  • Attach a source to every entryProvenance supports review and rollback
  • Stop agents re-ingesting their own outputsOWASP: avoids bootstrap poisoning
  • Set expiry for unverified memoryLimits how long poison persists
  • Test with poisoned entries and practice a rollbackOWASP: adversarial tests, snapshots, rollback

Then connect the controls to people and policy. Put a human approval in front of high-impact actions using the human in the loop and least agency checklist, and record memory rules in the AI agent governance policy template.

Questions.

  • What is memory poisoning in an AI agent?

    It is corrupting what an agent stores or retrieves with malicious or misleading data, so future reasoning, planning or tool use becomes biased, unsafe or aids exfiltration. OWASP lists it as ASI06 in the Agentic Top 10 2026.

  • How is it different from prompt injection?

    Prompt injection is a one-time input. OWASP says ASI06 excludes one-time prompts and covers persistent corruption of memory and retrievable context that carries across sessions.

  • What is RAG poisoning?

    MITRE ATLAS AML.T0070 describes injecting malicious content into data a retrieval augmented generation system indexes, so it contaminates a future thread through search results. The content may carry prompt injections or false entries.

  • What is a false RAG entry?

    ATLAS AML.T0071 covers a fake document hidden inside a regular RAG entry. ATLAS says this bypasses data monitoring tools and prevents the document from being deleted directly.

  • Can poisoning happen by accident?

    Yes. OWASP LLM08:2025 says data poisoning in vector stores can be intentional or unintentional, coming from insiders or unverified sources.

  • What is bootstrap poisoning?

    It is an agent re-ingesting its own generated outputs into trusted memory, which reinforces its own errors. OWASP recommends preventing automatic re-ingestion of an agent's outputs into trusted memory.

  • How do you stop bad data entering memory?

    OWASP recommends scanning all new memory writes and model outputs before commit, allowing only authenticated and curated sources, and requiring source attribution for each entry.

  • How do you limit damage from a poisoned entry?

    Segment memory by user, session and tenant, expire unverified memory, weight retrieval by trust, and keep snapshots and version control so you can roll back. Least privilege limits what a poisoned agent can do.

  • Does memory poisoning affect shared vector databases?

    Yes. OWASP LLM08:2025 warns of cross-context leaks when several users or applications share one vector database, and recommends permission-aware vector storage and access controls.

  • What should you log?

    OWASP's threats guide asks for memory access logging, anomaly detection on memory updates, and flagging abnormal modification frequency. LLM08:2025 recommends detailed immutable logs of retrieval activity.

Sources

  1. 1 OWASP: Top 10 for Agentic Applications 2026 (ASI06)
  2. 2 OWASP: Agentic AI Threats and Mitigations
  3. 3 OWASP: LLM08:2025 Vector and Embedding Weaknesses
  4. 4 OWASP: LLM04:2025 Data and Model Poisoning
  5. 5 MITRE ATLAS data release v2026.09
  6. 6 CISA: New Best Practices Guide for Securing AI Data Released