Part 7 · Agentic AI Security
ASI06: Memory and Context Poisoning
Corrupted memory lets one malicious input influence an agent long after the original interaction ends.
What it is
Agents rely on stored information, including conversation history, memory tools, summaries, embeddings, and RAG stores. In memory and context poisoning, adversaries seed this information with malicious or misleading content, changing future reasoning, planning, or tool use.
How the attack unfolds
Poisoned memory turns a one-time attack into a lasting compromise.
Common patterns
- Memory injection through content the agent processes.
- Shared context contamination across users or agents.
- RAG poisoning that changes retrieved knowledge.
- Summary drift where false details survive compression.
Defenses
- Validate memory writes. Scan new entries before they are committed.
- Segment memory. Isolate users, sessions, and domains.
- Track provenance. Record the source of each memory.
- Limit retention. Expire unverified or low-trust entries.
- Prevent self-reinforcement. Do not treat an agent's own output as trusted fact.
- Support rollback. Keep versions so bad memory can be removed.
Common misconception
Common belief
"Clearing the conversation removes the attack."
In practice
Long-term memory and retrieved context can survive after the conversation is gone.
Key takeaways
- Malicious content can persist in memory and context.
- Validate what is written to memory.
- Segmentation and rollback limit lasting damage.