AI Cross-Tenant Cache Lab: Read Another Tenant's Cached Answer

✨ AI Summary
VectorBot caches retrieved-document embeddings to save work, keyed only by the document's hash — not by which tenant owns it. When one tenant's confidential document is cached, another tenant whose query hits the same key gets served that private content.
Lab at a glance: Advanced · 145 XP · about 20 minutes · runs in your browser, no signup or setup. Try it yourself first; the full solution is behind a spoiler below.

What this lab teaches

Multi-tenant systems must isolate tenants at every layer, including caches. When a RAG pipeline keys its embedding or result cache on content alone, a cache hit crosses the tenant boundary: tenant B's query reuses tenant A's cached, private result.

The lesson: a cache key that omits the tenant is a data-leak waiting to happen. Isolation has to be in the key, not just in the access check before the cache.

How VectorBot caches embeddings

VectorBot caches embeddings keyed by document hash. Tenant A uploads a confidential document and queries it, filling the cache. As the attacker tenant, a query that resolves to the same cache key returns A's cached result — including A's private finding.

The attack approach

  • Confirm the cache key is the document hash only, with no tenant component.
  • As the attacker tenant, issue a query that resolves to the same key A's content filled.
  • Hit the shared cache entry rather than your own (empty) data.
  • Surface the private string from A's document.

Full walkthrough (spoiler)

If you only get your own tenant's data, your query is not hitting A's key — open the steps.

Show the step-by-step solution
  1. Craft a query as the attacker tenant that maps to the cache key A's confidential document produced.
  2. Because the key has no tenant component, your query hits A's cached embedding result.
  3. The cached content — A's private audit finding — is returned to you.
  4. Surface that string and the lab marks you solved.

Why it works

The cache treats content as identity: same hash, same entry, served to anyone. Tenant isolation was enforced somewhere else, but not in the cache key, so the cache quietly becomes a cross-tenant channel.

Core principleInclude the tenant in every cache key, and prefer per-tenant cache namespaces so one tenant's data can never satisfy another's request.

Where this happens in the real world

Tenant-blind cache keys are a classic multi-tenant SaaS mistake, now common in RAG and embedding pipelines. It maps to OWASP LLM08 Vector and Embedding Weaknesses, where shared vector stores and caches leak data across tenants.

How to defend against it

  • Key caches on tenant plus content — for example hash(tenant_id, query/embedding).
  • Use separate cache namespaces or stores per tenant.
  • Enforce tenant isolation in the vector store itself, not only in a pre-cache check.
  • Test with two tenants to confirm one can never retrieve the other's cached content.
Mr Elite tip: In any multi-tenant RAG system, audit every cache and vector index for a tenant component in the key. Isolation that lives only in the access check, not the key, is bypassed by a cache hit.

Try it, then go further

Reading about it is the easy part. Open the lab, try your own approach before peeking at the spoiler, and see how many attempts it takes.

❓ Frequently asked questions

What is a cross-tenant cache leak?
When a shared cache keyed without a tenant identifier serves one tenant's cached data to another tenant whose request resolves to the same key.
Why do RAG systems hit this?
They cache embeddings and results by content to save computation. Omitting the tenant from the key lets a cache hit cross the tenant boundary.
How do I prevent it?
Include tenant_id in every cache key, use per-tenant namespaces, and enforce isolation in the vector store itself — then test with two tenants.
Which OWASP category is this?
LLM08 Vector and Embedding Weaknesses in the OWASP Top 10 for LLM Applications (2025).
⚡
Join free to earn XP for reading this article Track your progress, build streaks and compete on the leaderboard.
Join Free
Lokesh N. Singh aka Mr Elite
Lokesh N. Singh aka Mr Elite
Founder, Securityelites · AI Red Team Educator
Founder of Securityelites and creator of the SE-ARTCP credential. Working penetration tester focused on AI red team, prompt injection research, and LLM security education.
About Lokesh ->

Leave a Comment

Your email address will not be published. Required fields are marked *