KV Cache Leak in SGLang: User Isolation Guide

Vladimir Lomtev•
KV Cache Leak in SGLang: User Isolation Guide

On October 26, 2026, Cloudflare and the SGLang team disclosed an incident: from August 27 to September 9, 155 GLM-5.3 model responses on Workers AI contained fragments of other users’ prompts. The cause was a combination of a configuration error and an SGLang bug in split prefill and decode mode, where the response was built on top of another user’s KV cache pages. If you run SGLang with split phases, upgrade to at least version 0.5.22, verify that the KV pool can fit the maximum context, and add isolation checks. For a shared inference server in general, the broader lesson is this: cache is user data, and its isolation must be tested.

Prepared by Vladimir Lomtev AI Studio on November 16, 2026, for teams that run a shared LLM server for multiple users, departments, or clients. The facts are taken from Cloudflare’s analysis and the LMSYS bulletin, and the SGLang release dates are from the GitHub releases page. We did not reproduce the bug or verify the versions ourselves on GPUs.

Contents

What happened: timeline

Date (UTC) Event
July 6, 2026 The bug had already been documented in the SGLang repository as issue #30233
August 27 GLM-5.3 launched on Workers AI; from this point on, the bug was present
September 8, 23:11 Researcher Gadi Evron (Knostic) reports the issue via HackerOne
September 9, 13:22 Cloudflare announces the incident; the leak is reproduced in 25 minutes
September 9, 14:00 The model is taken offline, requests return HTTP 400
September 9, 19:40 The model is brought back after fixes
October 2 SGLang 0.5.21 release
October 19 SGLang 0.5.22 release
October 26 Coordinated public disclosure
November 2 SGLang 0.5.23 release with additional fixes for NIXL and MORI

According to Cloudflare, 155 responses were affected, all on prompts longer than 681,280 tokens. The company found no signs of intentional exploitation, and the incident did not affect other Workers AI models.

Why the response was assembled from other users’ data

Cloudflare’s analysis describes two overlapping causes.

Configuration error. The model context window was set to 1,048,576 tokens, while the KV pool on the prefill GPU could hold only 681,280. The team knew about the mismatch before launch, but did not consider it a problem: long-context tests returned HTTP 200. The status code was correct, but the content was not.

Bug in SGLang. A request that did not fit in the pool was marked rejected and replaced with a one-token placeholder. But the admission queues in split-phase mode checked whether the request had completed, not whether it had been rejected. As a result, the rejected request still moved forward: decode reserved 8 KV cache pages, wrote only one of them, and the attention mechanism read them all. The remaining pages contained data from previous requests made by other users.

The LMSYS bulletin describes a broader mechanism as well. In split-phase mode, prefill writes the KV cache to the decode replica over RDMA. If a request is interrupted during transmission, and decode manages to free and reassign its pages to another request before the late writes arrive, those writes overwrite another user’s cache. The bug leaves no log entries, so logs cannot tell whether a leak occurred.

How split phases work and why they are needed is explained in the article on split prefill and decode.

Who is affected

Key conditions from the LMSYS bulletin:

  1. Split prefill and decode are enabled, with cache transfer through Mooncake, NIXL, MORI, or a custom backend. A single instance without cache transfer between engines is not exposed to this race condition.
  2. The request ends during transfer: the client disconnects, the router cancels the request, a timeout expires, a network failure occurs, or prefill fails.
  3. The memory allocator reissues freed pages before the writes arrive.

Default settings are affected from the 0.4.x line through 0.5.21 for Mooncake and NIXL, and through 0.5.22 for MORI. A separate variant was tied to HiCache offloading on the decode side, which is disabled by default. Fixes were not backported to older release branches.

If you run a single server on vLLM, Ollama, or llama.cpp without split phases, this specific incident does not apply to you. But the user-isolation question still remains, and it is addressed below.

What SGLang operators should do

Cloudflare’s and LMSYS’s recommendations are essentially the same:

  • Upgrade. Cloudflare recommends version 0.5.22 or newer. According to LMSYS, fixes for Mooncake and NIXL were included in 0.5.21, for MORI in 0.5.22, and 0.5.23 fixed acknowledgment of failed sends for NIXL and MORI. The sensible target is the latest version.
  • Check the KV pool size. On every prefill and decode node, the pool must be able to hold the configured context length. After the fix, Cloudflare keeps the pool at about 2.04 million tokens — roughly twice the context — and checks this condition before every deployment.
  • Cancel both halves of the pair. When a request is canceled, the router should stop both prefill and decode. According to LMSYS, sgl-router does this in split-phase mode.
  • Enable deferred cache release. On versions 0.5.19 and 0.5.20, if you cannot upgrade immediately, LMSYS recommends the SGLANG_DISAGGREGATION_DEFERRED_DECODE_KV_RELEASE=1 environment variable on both prefill and decode, and on 0.5.20 also a Mooncake transfer packet size limit and a deferred release timeout of 60–120 seconds.
  • Enable corruption detection. The --disaggregation-enable-kv-checksum flag on both engines verifies the integrity of the transferred cache; it is off by default and adds GPU overhead. Cloudflare also mentions --kv-canary where the model supports it.
  • Monitor the metric. sglang:decode_deferred_kv_release_total{outcome}: a high share of the outcome timeout means the verification path is working poorly.
  • Do not interrupt transfer unless necessary. Cloudflare changed the load balancer so it would not cut off requests before the first token without good reason.

User isolation on a shared inference server

This incident is a special case of a broader problem. When one server serves different users, they share GPU memory, the KV cache, the queue, and logs. What to check regardless of engine:

Shared prefix cache. If two users send requests with the same beginning, the engine may reuse the cache. This is not a direct text leak, but based on differences in response time, an attacker could theoretically infer that someone else has already sent that prefix. In the vLLM prefix caching documentation this is exposed as the request parameter cache_salt: the salt is mixed into the hash of the first block, and the cache is reused only between requests with the same salt. The documentation describes protection against timing attacks as the direct goal of this feature and warns that a non-cryptographic hashing algorithm in a multi-user environment can lead to leakage.

{
  "model": "Qwen/Qwen3-8B",
  "messages": [{"role": "user", "content": "Summary of the supply agreement"}],
  "cache_salt": "tenant-finance-2026"
}

It is convenient to set the salt at the gateway by tenant or department, rather than trust the client with it. Within one trust group, the cache will continue to work; between groups, it will not.

Canary tests. Cloudflare validated the fix with the researcher's script and marker-based tests. The idea is simple and works for any team: insert unique marker strings into test requests from different synthetic tenants, and check the responses for foreign markers. Run these tests after every engine update and configuration change, including scenarios with long context, request cancellation, and overload.

Configuration invariants. The main lesson from Cloudflare is that checks that return "200 OK" do not prove correctness. Before deployment, automatically verify that: the KV pool can hold the maximum context, the prefill and decode versions match, and the request length limits on the gateway are no greater than the engine's capabilities.

Logs and access. Prompts and responses end up in the inference server logs. Restrict access to them, set a retention period, and do not write full texts if they are not needed for incident analysis. Prometheus metrics do not contain text, but they also deserve attention: labels with customer identifiers are sensitive too. The basic setup is described in the article on monitoring vLLM.

Updates. Inference servers evolve quickly, and security fixes are delivered in regular releases. Subscribe to your engine's release page and set aside a regular update window. Requirements for an air-gapped environment, where updates are delivered manually, are covered in the article "LLM without internet".

Isolation checklist for a shared LLM server

  1. The engine version is no older than the release where known isolation issues were fixed.
  2. The KV pool can hold the maximum context on each node; this is checked automatically.
  3. The prefix cache is isolated by tenant through a salt or separate replicas if users do not trust each other.
  4. The router correctly cancels requests end to end.
  5. Canary tests with markers are run after every change.
  6. Access to logs with prompts is restricted, and retention is set.
  7. There is a procedure: who can shut down the model, and how many minutes it takes, if a leak is suspected.

Frequently asked questions

Does this affect vLLM? The described bug is in SGLang. But vLLM also supports separate phases and a shared prefix cache, so canary tests and configuration checks are useful there too.

Can logs show whether we had a leak? According to LMSYS, corruption caused by this bug leaves no errors or log entries, so you cannot reliably determine whether a leak happened from logs alone. Save the topology, request templates, and cache release metrics, and contact the SGLang developers if you suspect a problem.

Should prefix caching be disabled for security? Usually it is enough to isolate the cache by tenant with a salt or separate replicas. Turning it off completely removes the benefit of the cache.

Do users need to be notified? This is a legal question that depends on the contract and privacy law. Define the procedure in advance together with legal counsel and security.

How Vladimir Lomtev's AI studio helps with isolation on a shared LLM server

Vladimir Lomtev's AI studio deploys LLMs on the company's servers, tests them, and supports them in production. For user isolation, that means:

  • checking the engine version, separate-phase mode, and KV pool sizes against the published recommendations;
  • configuring prefix cache isolation by department or customer at the gateway;
  • preparing canary tests with markers and building them into the update procedure;
  • documenting log handling rules and the steps to take if a leak is suspected.

The first step is to choose one shared server or model, list whose data it processes, and record which isolation checks are currently in place. Discuss the project.

Bottom line: the cache is user data

The GLM-5.3 incident showed that a bug in KV cache management can turn a shared inference server into a leakage channel without a single error in the logs. SGLang operators using separate phases need to update and verify the KV pool size. Everyone else should treat the cache as user data: isolate it by trust group, validate the configuration automatically, and run marker-based tests regularly.

Request an audit

Share your contact details and we will follow up.

← All articles

Comments (0)

Loading comments…

Leave a comment
No registration required

Book a strategy call
for agentic operations

Tell us which workflow you want to improve. We will map feasibility, risks, and the fastest MVP path.

By submitting, you agree to our privacy policy

Contacts

Global Operations

Serving U.S. clients remotely
with private cloud and on-prem options

Strategy calls by request

We respond after reviewing your workflow context.

info@agentsunrise.pro

For partnership inquiries

Have a proposal?

Write to us in messengers

© 2026 AgentSunrise