What is AI agent memory poisoning?

Agent memory poisoning is an attack that plants false information or hidden instructions in the long-term memory an AI agent keeps between sessions, making it misbehave in later tasks even after the attacker is gone.

Unlike RAG poisoning, which corrupts knowledge base documents, it targets the agent's own notes, preferences and experience records. Its effect persists, since the poisoned entry re-enters the agent's context in every new session.

Topic
AI security
Also known as
Memory poisoning

How AI agent memory poisoning works

  1. The attacker puts a hidden instruction like “remember this” in content the agent reads, such as an email or document.
  2. The agent saves it to its memory, taking it for a user preference or a fact.
  3. When memory is retrieved in later sessions, the poisoned entry enters context too.
  4. Relying on it, the agent makes wrong decisions, sends data to the wrong place or skips safety rules.

In more detail

Steering retrieval with embedding-space triggers

In retrieval-based memory stores, attackers do not merely write false facts; as demonstrated in AgentPoison (2024), they craft trigger tokens or phrasing optimised in embedding space so the poisoned memory ranks at the top whenever a benign target query is asked, even if the store holds thousands of clean entries.

Automatic memory extraction and provenance tracking

Even when a user never runs an explicit "save" command, many agent frameworks run a background LLM step after each session to automatically extract preferences and facts. Any untrusted external content processed during the session can silently contaminate those background summaries unless provenance tracking marks external-origin spans as non-writable to long-term memory.

Cross-user contamination in shared memory

In multi-user deployments, memory must be strictly partitioned by trust tier and tenant. Allowing a low-trust external interaction or a single compromised account to write into a shared team or enterprise memory namespace turns individual memory poisoning into cross-user lateral contamination.

Commonly confused terms

TermHow it differs
RAG poisoningRAG poisoning alters shared knowledge-base documents consulted by all users, whereas agent memory poisoning corrupts an agent's own persistent notes, preferences or experience store across sessions.
Indirect prompt injectionIndirect prompt injection hijacks the current task execution from untrusted input, while memory poisoning uses that or similar triggers to persist the payload in long-term storage so it reactivates in future sessions without the attacker returning.
AI data poisoningData poisoning happens during model training or fine-tuning and alters model weights; agent memory poisoning happens at inference/runtime without touching weights, corrupting external memory records.

Why AI agent memory poisoning matters for on-premises AI

In-house agents with persistent memory grow more useful over time, but that memory is also a persistent attack surface: one poisoned entry can stay active for weeks. Defences include limiting what may be written to memory and from which sources, never writing outside content to memory without user approval, storing each entry's source and date, auditing memory regularly and rolling it back when needed. Memory entries are marked as data, not instructions, like retrieved context.

ON-PREMISES EXAMPLE

A sales team's assistant saves customer preferences to memory; information from outside emails is written only if the representative approves, each entry keeps its source and representatives can view and delete memory from a panel.

Common questions

How does agent memory poisoning differ from RAG poisoning?

RAG poisoning corrupts documents in a shared knowledge base. Memory poisoning targets the agent's own accumulated records and resurfaces in every new session.

How is poisoned memory cleaned?

If each entry keeps its source and date, entries from suspicious sources can be found and deleted. Memory is audited regularly and rolled back to a known clean state when needed.

Sources

In the glossary: Glossary, A to D

What does this term mean for your infrastructure?

We can work out together in a technical assessment how it maps onto your data, hardware and security requirements.

Request a technical assessment →

This site sets no cookies. Visitor numbers are counted in aggregate using a cookieless method that does not identify anyone. See the Privacy Policy for details.