Skip to main content

Cross-session / cross-tenant memory bleed: shared memory / cache without per-user isolation, and I hand one person's data to another

VolumeVolume 4 · RAG and agentsTechniqueRAG & agent privacyAudienceSecurity Engineer · Privacy Engineer · ML EngineerPrivacy riskHighMaturityProductionEvidenceSecurity advisory

In one sentence: shared sessions/memory/caches can return A’s data to B if identity and permission binding fail. In OpenAI’s 2023 incident, 1.2% describes possible payment-data exposure among Plus subscribers active in a specific nine-hour window, not confirmed viewing of every record. Isolation relies on system authentication, authorization, pool concurrency, and ownership checks, not model promises.

Mechanism: what happens on my side​

I'm stateless myself — all the "memory" comes from external storage: session history, persistent memory (vector memory), caches (KV / Redis), request-scoped context. If that storage uses a shared instance, keys not scoped by user / tenant, or gets misrouted under concurrency / races / connection reuse, then one user's read can hit another user's write.

To be clear about the red line: it's not "I mistook A's memory for B's" — I can't introspect memory ownership. What's externally verifiable is that the storage layer carrying my context returned A's data to B's session. That's a system property, reproducible with concurrent multi-tenant tests, independent of whether I "want to" mix things up. ChatGPT's case was exactly redis-py request cancellation under Asyncio misrouting data on a connection — the model side had no idea; the bleed happened in a cache layer it can't reach.

Threat surface: where it bleeds, and the boundary​

Bleed-point checklist (each is a cross-user leak surface):

  • Session cache (Redis / KV etc.): concurrency races, key collisions, connection-reuse misrouting — the ChatGPT incident's class.
  • Persistent agent memory: memory retained across sessions / users, which (if globally shared or unscoped) drags the previous / someone else's data in.
  • Prompt / KV cache reuse: caches reused to save compute, if misrouted across requests, leak a prior request's content.
  • Multi-tenant vector memory: different users' memory mixed into one index, not filtered by user at retrieval.

Boundary (separating this from neighboring entries): this entry lives in cross-user bleed at the memory / session / cache storage layer; retrieval-corpus cross-tenant bleed is Multi-tenant RAG retrieval leakage (the retrieval-corpus layer); content in the context window being extracted is Context-surface privacy (the interaction layer). All three concern agent data boundaries, but live in different layers.

How the defense works​

Cross-tenant isolation is the system architecture's responsibility, landing on three things:

  • Keys scoped by user / tenant: every cache / memory / session entry's key must carry a user / tenant identifier — no "bare keys" that another user can hit.
  • Concurrency safety: avoid data misrouting under connection reuse / races (the direct cause of the ChatGPT incident) — the concurrency model, connection pool, and cancellation logic must all be designed and load-tested for "no bleed."
  • Ownership check before return: before handing data to the current session, verify "this really belongs to the current requester" (OpenAI added exactly this redundant check afterward, and audited logs to confirm each message was only visible to the right user).

To break it down: these all live at the storage / infrastructure layer, which the model can't reach — so you can't rely on "prompt the model not to mix things up." Pinning isolation on the model's good behavior is the textbook false security here.

Buildable recipe​

1. Force keys scoped by user / tenant: every key in session / memory / cache / KV /
vector memory carries a user or tenant ID; ban bare keys.
2. Ownership check before return: before handing any cache / memory data to the current
session, assert data.owner == requester.
3. Concurrency / race load tests: multi-tenant high-concurrency read/write, asserting
each user's response contains only their own data (treat ChatGPT-style races as the
default threat to test).
4. Partition persistent memory per user + TTL: don't globally share; the longer it's
retained, the larger the bleed / leak window.
5. Make incidents traceable: logs must answer "was each message visible only to the
right user," for post-hoc audit and evidence.

Every step is tied to your multi-tenancy model and storage stack — without spelling out "what is one tenant, which stores are shared across users," isolation has gaps.

Minimal testable assertions (turn bleed into a regression check):

  • How to test: run concurrent multi-tenant read/write load (incl. connection-reuse / request-cancellation race scenarios), plus a cross-session isolation check on persistent memory.
  • Pass: use two genuinely distinct authenticated principals A/B with controlled canaries, covering concurrency, cancellation, reconnection, retries, pooled connections, and permission revocation. Responses / caches / memory / logs must show no unauthorized cross-principal read; retain positive controls for authorized sharing and same-identity paths. Finite non-detection cannot exclude every race, and keys must bind trusted identity and current permissions.
  • Fail: cross-user hits appear, or keys aren't user-scoped, or there's no concurrency test at all → don't ship multi-tenant; close the isolation gaps first.

Real case / engineering status (incident postmortem)​

(This entry's maturity is "Production": tenant isolation is standard production practice; below is the real incident of "what happens if you get it wrong" + the framework framing, not an endorsement that "isolation is foolproof.")

  • ChatGPT 2023 incident: the official report describes response mismatches with redis-py cancellation and connection reuse, affecting titles, possibly first messages, and some payment data. The 1.2% refers only to possible risk in the specified nine-hour active-Plus cohort; full card numbers were not exposed. It is not a universal bleed probability.
  • Framework framing: OWASP LLM02:2025 Sensitive Information Disclosure lists "cross-user leakage of PII / credentials / proprietary data" as a Top 10 risk for LLM apps — cross-session memory bleed is one typical path to it.

Residual risk and trade-offs​

Breaking the false security item by item:

  • Isolation is the system's job, not the model's. Bleed happens in the storage / cache layer, beyond the prompt's reach; pinning isolation on "the model won't mix things up" is doing nothing.
  • Race / cache bugs are hard to test exhaustively. Concurrency misrouting is notoriously hard to reproduce — treat it as a default threat and load-test continuously, don't "pass once and relax."
  • Persistent memory enlarges the window. The longer and more widely memory is retained / shared, the larger the surface once a bleed happens; per-user partitioning + TTL is necessary convergence.
  • Third-party memory / cache services you can't fully audit. With managed memory / cache, you can only require + spot-check its isolation, not fully control it.

How this differs from neighboring techniques​

  • Cross-session memory bleed vs. RAG retrieval leakage (this volume): that one is cross-tenant bleed in the retrieval corpus (retrieval / storage layer); this entry is cross-user bleed in memory / session / cache storage — different storage layers, often audited together.
  • Cross-session memory bleed vs. context-surface privacy (Volume 3): context-surface privacy is content in the current context window being extracted (interaction layer, adversary is the end user); this entry is the storage carrying context dragging someone else's data in (storage layer, cause is isolation failure).
  • Cross-session memory bleed vs. data lifecycle (Volume 6): memory is another copy of the data — defend against bleed, and don't forget it during deletion propagation either (see Data lifecycle & deletion propagation).

Version notes​

Applicable versions

Rechecked the 2023 official postmortem on 2026-10-29. The 1.2% refers to active Plus subscribers during a specific nine-hour window whose payment data may have been exposed, not confirmed viewing of every affected record. Full card numbers were not exposed. This cache incident does not prove every model architecture entirely stateless. Review by 2027-01-29, earlier for identities / cache keys, pool cancellation, permissions, or storage-service versions.

Further reading and sources​

Primary: Security advisory (the official incident postmortem + OWASP).