What is AI cross-session context leakage?
Cross-session context leakage in AI is when information from one user's or session's conversation history, memory, cache or retrieval context accidentally becomes visible to another user or session, mainly through shared memory, caching or session management faults.
Unlike cross-tenant RAG leakage, where different customers' documents mix in a retrieval index, cross-session leakage moves conversation, memory or cache content between sessions. It can stem from an application bug, a shared prompt cache or persistent agent memory.
- Topic
- AI security
- Also known as
- Cross-session leakage
How AI cross-session context leakage works
- Session identifiers, user context and memory records are kept without isolation.
- A cache, memory store or session layer fault ties one user's data to another request.
- In shared prompt or KV caches, response time differences can hint at other users' prompts.
- Mitigation: isolate sessions and memory per user and tenant, limit cache sharing and clear context at session end.
In more detail
Leakage through agent memory, MCP tool pools and shared sandboxes
In current agentic architectures, leakage extends beyond chat history and KV caches to persistent agent memory stores (episodic/semantic memory), shared tool/MCP connection pools and reused code-execution sandboxes. If thread or memory IDs are not strictly bound to authenticated user claims (preventing BOLA/IDOR), one session can read or overwrite another user's long-term agent memory or temporary files.
Fuzzy matching risk in semantic response caches
Semantic response caches match incoming prompts against prior prompts using embedding similarity (e.g., cosine >= 0.90) rather than exact string equality. Without mandatory user/tenant partitioning in the cache key, a slightly differently worded question from User B can match User A's cached query and return a response containing User A's private data.
Scoped cache keys and timing side-channel defences
Rather than disabling prefix/KV caching entirely, which harms latency and GPU efficiency, production servers partition cache namespaces by tenant or security clearance (e.g., salting RadixAttention/prefix keys with tenant_id or user_id) and optionally inject bounded timing jitter or constant-time padding for highly sensitive workloads to mitigate timing side channels.
Commonly confused terms
| Term | How it differs |
|---|---|
| Cross-tenant RAG leakage | Cross-tenant RAG leakage occurs in the retrieval/knowledge layer when one customer's or unit's indexed documents appear in another's search results; cross-session context leakage happens in the conversation, agent memory or prompt/KV cache layer across user sessions. |
| Training data extraction attack | Training data extraction recovers facts memorised in model weights during pre-training or fine-tuning, whereas cross-session context leakage exposes live or cached runtime context (prompts, chat history, KV states, memory) from another user's session. |
| Prompt injection | Prompt injection tricks the model within a single session using malicious instructions; cross-session leakage breaks isolation across session boundaries, though persistent prompt injection stored in shared agent memory can bridge the two. |
Why AI cross-session context leakage matters for on-premises AI
A popular chat service disclosed that a bug in an open-source library let some users see titles from another active user's chat history. A study auditing prompt caching in language model APIs reports cached prompts process faster, creating a timing side channel; it detected global cache sharing across users at seven providers. Another study of KV and semantic caches in multi-user model servers shows timing side channels can reveal confidential system prompts and other users' prompts.
A health insurer's customer assistant keeps each conversation in an isolated session tied to the user's identity, opens persistent memory only to the same user and does not share the prompt cache across users on its in-house model server.
Common questions
Why does cross-session context leakage happen?
Mostly through session management, cache or memory store faults. Timing differences in shared caches can also hint at other users' prompts.
How is it prevented?
Isolate sessions, memory and cache per user and tenant, clear context at session end and turn off shared caches for sensitive workloads.
Related terms
- Cross-tenant retrieval-augmented generation (RAG) leakage
- AI agent memory
- AI multi-tenant inference
- AI conversation history
- Prompt caching
- AI sensitive information disclosure
Sources
- OpenAI, March 20 ChatGPT outage: Here's what happened, 2023
- Auditing Prompt Caching in Language Model APIs, 2025
- The Early Bird Catches the Leak: Unveiling Timing Side Channels in LLM Serving Systems, 2024
In the glossary: Glossary, A to D