Security, Governance and PlatformTenant and data boundariesPrincipal
How can prefix-cache timing reveal another tenant’s guessed prompt without returning its text?
By Amit Kumar3 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
An attacker submits candidate prefixes to a shared inference service and measures first-token timing against a tenant’s confidential template. Explain the membership signal, design controlled timing tests and trusted cache-key scoping, and assess salts, other cache layers, public prefixes and the performance cost without claiming one mitigation provides full tenant isolation.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
Two tenants share an inference fleet. Tenant A repeatedly sends a confidential standard prompt. Tenant B can submit candidate prefixes and measure first-token latency. When B guesses a cached prefix, prefill work is skipped and the response tends to be faster. The cache did not return A's text. But the timing difference may tell B that a particular prefix was recently used.
This is a membership side channel, not the same as serving A's answer to B. It is most useful to an attacker when the secret is guessable from a small set, such as a known document template or a yes/no candidate. Network jitter can make one measurement noisy, but repeated measurements and controlled traffic may expose a difference. vLLM's security guidance explicitly discusses prefix-cache timing attacks in shared deployments and recommends a secret cache_salt at the tenant boundary. This answer describes a fleet that omitted an effective isolation value, not a universal vulnerability in every prefix cache.
I would trace the actual cache key and trust boundary. Does identity include exact token IDs and the needed model configuration? Is a tenant-scoped unpredictable salt mixed in before any reusable prefix block can collide across tenants? An account ID passed in clear is an identifier, not necessarily a secret salt. Bind the salt at the trusted gateway, not from a user-supplied field that B can copy. Make cache sharing policy explicit: sharing within a tenant may be worth the cost savings, while cross-tenant sharing of private prefixes should be disabled unless the data is truly public and the risk accepted.
How do we establish the leak? Run controlled A/B timing probes with and without A's prefix cached, across realistic network conditions. Measure distribution of time to first token and the attacker's classification accuracy, not a single impressive hit. Also check whether the cache's metrics, error messages or tokens-used accounting reveal a hit more directly. Inspect all prefix and multimodal cache layers, because isolating one hash table does not isolate a second cache keyed by user-provided media IDs.
A salt separates this cache-reuse domain. It is not full process or tenant isolation: shared scheduling, memory, other caches and observability surfaces still need their own controls. The current engine documentation explicitly makes that distinction.
The pushback is cost. Per-tenant salts reduce cross-tenant hits and may raise prefill work. Measure that tradeoff against the confidentiality boundary. A shared public system prompt can be handled under a separate public cache policy if the architecture supports it, without merging private user prefixes. A semantic cache served tenant A's private answer to tenant B. What now? concerns a semantic answer cache that directly returns another tenant's private answer. Here no foreign answer is returned. The observable is whether a candidate prompt prefix was present in a shared inference cache.
Related questions
Keep practising security, governance and platform
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux