Memory Poisoning in Persistent AI Agent Sessions
AI agents with persistent memory store facts, preferences, and instructions across sessions. When an attacker can write to that memory, the injected content persists indefinitely and affects every future interaction with the agent. Unlike a standard prompt injection that only affects the current conversation, memory poisoning survives session termination, user changes, and system restarts. The impact scales with how many users or sessions share the same memory store.
Confirm Memory Write Access
Verify that the agent stores and recalls information before attempting to poison it:
Start a new session with no prior context and verify persistence:
A response containing MEMORY_TEST_XYZ in a fresh session confirms persistent memory write access. Proceed with poisoning.
Inject Persistent Behavioral Instructions
Write instructions into memory that alter the agent's behavior for all future sessions:
Verify the instruction persists and affects a different user session or a new conversation started from a different client. A confirmed persistent behavioral change across sessions is a critical finding demonstrating the full impact of memory poisoning.
Inject False Facts into Memory
Plant false information that the agent will present as factual in future responses:
Poison Memory via Indirect Injection
When direct memory writes are restricted, use indirect injection through content the agent retrieves and processes. If the agent reads external documents and extracts facts to store in memory, plant the malicious fact in a document the agent will process:
Enumerate and Inspect Existing Memory Contents
Before writing, extract what is already in memory to understand its structure and identify sensitive stored data:
An exposed memory API endpoint that returns memory contents without per-user isolation is a direct data access vulnerability independent of any injection technique. Other users' stored preferences, conversation summaries, and extracted facts are all accessible.
References
-
OWASP Top 10 for LLM Applicationsowasp.org/www-project-top-10-for-large-language-model-applications (opens in new tab)
LLM04: Data and Model Poisoning reference covering persistent memory attack surfaces
Was this helpful?
Your feedback helps improve this page.