Before you start: words you need#
| Word | Plain meaning |
|---|---|
| Threat model | A written list of who might attack, what they want, and how. It decides what you defend first. |
| Attack surface | Every way in: each port, endpoint, request field and file the service reads. |
| Side channel | Learning a secret from a by-product, such as how long a request took, rather than from the data itself. |
| Advisory / CVE | A published security bug. A CVE is its public ID; vLLM publishes GitHub security advisories (GHSA IDs). |
| Pickle | Python’s object format. Loading a pickle file can run any code inside it. |
| safetensors | A weights format that holds only numbers and a header, so loading it cannot run code. |
trust_remote_code | A Hugging Face and vLLM option that runs Python shipped inside a model repository. |
| Blast radius | How much breaks, or leaks, when one thing goes wrong. |
1. What is it?#
This lesson is the service owner’s view of security: how to keep an inference service from being taken down, abused, or made to leak one tenant’s data to another, and how to keep its weights and supply chain safe. Four things need protecting:
- availability: one request should not be able to stop the service;
- tenants’ data: prompts and outputs must not cross from one tenant to another;
- the platform: no one runs code on your nodes through a model file or an open port;
- the model: weights stay where they belong.
Prompt injection, agents and guardrails are application security and have their own home in the AI Security learning materials, for example prompt injection and sandboxing and egress. The isolation spectrum and per-tenant cache salting are taught in 21.f; limits and quotas in 23.j.
Facts checked on 13 November 2026 against vLLM v0.32.0 and its security advisories.
2. Why does it matter?#
An inference service has an unusual attack surface. The input is arbitrary text, images and audio that the system is built to act on, the compute is expensive, and many tenants share one process.
THREAT IMPACT LIKELIHOOD
One request crashes or hangs the engine availability HIGH
Resource exhaustion (denial by cost) availability, cost HIGH
Unauthenticated endpoints or internal ports everything HIGH if exposed
Cross-tenant leakage (cache timing, bugs) confidentiality MEDIUM
Supply chain (malicious checkpoint or code) total compromise LOW, but severe
Model extraction through the API IP MEDIUM
Weight exfiltration IP LOWThe first line surprises most people. vLLM published 98 security advisories between January and
mid-November 2026; about half describe a single crafted request that crashes, hangs or exhausts the
engine (a negative token ID, a video with no frame cap, a decompression-bomb audio file, a huge
cache_salt). When the engine core dies, every in-flight request on that replica dies with it.
A fast-moving engine with dozens of model-specific input processors is a large attack surface, and
keeping it patched is part of running it.
3. Simple analogy#
A bank branch. The guard at the door checks who you are and lets you into the public hall only (the gateway). The staff corridors, the vault and the intercom between back offices are never reachable from the street (internal ports). Everyone’s deposit boxes sit in one vault room, which is efficient, but if the clerk fetches a box faster when someone else opened it a minute ago, a patient customer can learn whose box was just used (the cache timing channel). Delivery vans that bring new stock are inspected before they enter, not trusted because of their logo (the supply chain).
4. Tiny example: the prefix cache tells tales#
Tenant B wants to know which of 10 possible contract clauses tenant A just pasted into a 1,024-token prompt. Both share one vLLM server with prefix caching on. B sends each of the 10 candidates once and times the first token. The one that matches A’s cached prompt skips prefill:
TTFT uncached ~97 ms, cached ~15 ms, plus queue noise (mean 20 ms)
defence accuracy added TTFT
(blind guess) 10.0%
none: one shared prefix cache 98.8% 0 ms
random delay 0-100 ms 82.4% 50 ms
random delay 0-300 ms 35.6% 150 ms
cache_salt per tenant 10.4% 0 msWith a shared cache, B guesses right almost every time. Adding random delay slows everyone and still
leaks. A per-tenant secret cache_salt drops B back to blind guessing at no latency cost on this
request; the price is that tenants can no longer share cached prefixes. Section 6 has the program.
This is not hypothetical. An ICML 2025 audit (Gu et al.) detected prompt caching in 8 of 17 commercial LLM APIs and cache sharing across users in 7 of them (measured September–October 2024), and vLLM assigned the shared-cache timing channel CVE-2025-46570.
5. Technical explanation#
Never expose the engine directly#
vLLM’s HTTP server is built to sit behind a gateway, not on the internet. From its security documentation (v0.32.0):
--api-key protects ONLY paths under /v1, /v2, /inference and /cohere.
NO KEY NEEDED, EVEN WITH --api-key SET
inference /invocations, /score, /rerank, /classify, /pooling, /generative_scoring
control /pause, /resume, /abort_requests, /update_weights, /scale_elastic_ep
information /metrics, /tokenize, /detokenize, /version, /load, /health
dev mode only /collective_rpc (runs arbitrary RPC on the engine), /sleep, /reset_prefix_cache
(only when VLLM_SERVER_DEV_MODE=1: never in production)
INTERNAL TRAFFIC, NOT AUTHENTICATED AT ALL
torch.distributed between nodes, ZeroMQ between processes, KV-cache transfer connectorsSo /invocations gives free inference, /pause is a one-line outage, and /update_weights changes
the model, all without a key. --api-key itself had an authentication bypass through URL path
handling (CVE-2026-48746, critical, fixed in v0.22.0). The rules:
- Put a gateway in front (21.i) that allowlists the few paths clients need
(
/v1/chat/completions,/v1/completions,/v1/models) and blocks everything else. - Authenticate at the gateway, then pass the tenant identity on. Treat
--api-keyas a second lock, not the first. - Keep internal ports on a private network. Set
VLLM_HOST_IPto the private interface, and firewall the distributed, ZeroMQ and KV-transfer ports from everything but the other ranks (Kubernetes network policies, 3.j). - Scrape
/metricsfrom inside the cluster only. It reveals model names, load and cache use. - Keep dynamic LoRA loading and profiler endpoints off on anything untrusted clients can reach.
Resource exhaustion: the denial that costs money#
ATTACK WHAT IT CONSUMES
max_tokens: 100000, n: 20 up to 2M output tokens from one request
a 128k-token prompt ~30× the KV of a 4k request (17.h)
a prompt that never produces EOS decode until max_tokens
many concurrent long-context requests the whole KV cache
a pathological regex or grammar CPU in the structured-output backend
an image, video or audio "bomb" CPU and host memory before inference starts
COST TO THE ATTACKER one HTTP request
COST TO YOU minutes of GPU time, or capacity denied to everyone elseThe defences are layered: hard limits at the gateway (input, output and total tokens, n, body size,
media size), token-based rate limits, per-tenant concurrency or KV limits, cost-based quotas, and
admission control (20.c). 23.j builds them. Two engine-side settings matter here: vLLM caps n with
VLLM_MAX_N_SEQUENCES, whose default of 16,384 is far too high for a public endpoint (its docs
suggest 64 or 128), and it rejects per-request media-processor overrides unless
--trust-request-mm-kwargs is set (leave it unset).
Rate limits do not stop the crash class from section 2: one well-formed-looking request is enough. That is handled by patching (below) and by blast-radius control: enough replicas that losing one is routine (23.e), and per-replica circuit breaking so a request that killed one engine is not retried onto the next.
Isolation between tenants#
vLLM’s own documentation is blunt: it “does not provide isolation between tenants that share the same server process”. Requests from different callers are batched together and share caches. What can leak:
1. PREFIX CACHE TIMING real, easy to exploit
Section 4. Fix: a per-tenant cache_salt set by the gateway from the authenticated
tenant, a secret random value (e.g. 256 bits), never the tenant name and never
taken from the client (21.f, 17.f). Cost: shared system prompts are cached once
per tenant.
2. CACHE IDENTITY COLLISIONS real
Multimodal items may carry a client-chosen "uuid" used as their cache key. Two
callers using the same uuid share one cache entry: the later caller gets output
computed from the earlier caller's image. Fix: the gateway rewrites or scopes
uuids per tenant, and cache_salt is set as well.
3. ENGINE AND KERNEL BUGS rare, severe
In 2026 vLLM fixed two bugs that copied one user's tokens into another user's
response in the same batch: an integer overflow in the act_and_mul activation
kernel (CVE-2026-73558) and stale token data under async scheduling with
pipeline parallelism (fixed in v0.21.0). Fix: patching, and separate
instances for tenants whose data must never mix.
4. BATCH-DEPENDENT NUMERICS very low
Outputs differ slightly with batch composition (11.k). Not a practical way to
read another tenant's data.
5. NOISY NEIGHBOURS availability only
Quotas, priority and separate pools (21.f, 23.j).Item 3 changes the usual advice. “Separate process for sensitive tenants” used to be defence in depth against a hypothetical bug; in 2026 it was the only defence against real ones until the patches shipped. Decide, in writing, which tenants may share a process. For hard isolation the options are a dedicated instance, a MIG slice (21.d), a dedicated node, or a dedicated cluster, each costing more sharing (21.f).
The supply chain#
MODEL WEIGHTS
✗ Never load pickle checkpoints (.bin, .pt, .pth) from sources you do not control.
Loading a pickle runs code. PyTorch 2.6 made torch.load(weights_only=True) the
default, but versions up to 2.5.1 could still be exploited with weights_only=True
(CVE-2025-32434). Keep PyTorch current and prefer formats that cannot run code.
✓ safetensors: a header plus raw tensors; loading cannot run code.
✓ Record a checksum for every file at registration (21.b) and verify it at load.
✓ Sign artifacts and verify signatures, e.g. with OpenSSF model signing
(sigstore/model-transparency).
MODEL CODE
✗ Never set --trust-remote-code for a repository you have not reviewed and pinned
to a commit. It runs the repository's Python at load time. Even with it off,
loaders have had bugs that ran repository code anyway (CVE-2026-90553), so pin
model revisions and mirror models into your own registry.
ENGINE CACHES
vLLM loads its cache directory (VLLM_CACHE_ROOT, default ~/.cache/vllm, which holds
torch.compile artifacts) without integrity checks, and some formats there can run
code. Never mount it from shared or untrusted storage, and restrict its permissions.
IMAGES AND DEPENDENCIES
✓ Pin images by digest, scan them, verify signatures at admission.
✓ Pin Python dependencies; review updates to anything on the load or execute path.
LORA ADAPTERS
Dynamic loading (/v1/load_lora_adapter) is not a secure operation: admins only.--trust-remote-code and pickle checkpoints are the two classic footguns, and both appear in
tutorials as convenient defaults.
Patching the engine#
With dozens of advisories a year, most rated medium, the realistic stance is:
- watch the vLLM advisories page (or your vulnerability scanner) for the version you run;
- triage each against your configuration: many need a feature you have off (a model family, a video backend, a KV connector, the Rust frontend);
- ship relevant fixes through the normal rollout process (23.g), with an expedited path for critical and high ones that apply to you;
- budget for it: an engine upgrade can change defaults and performance, so it needs the same evaluation as any other rollout.
Data handling#
Answer these in writing, and check the implementation matches:
Are prompts and completions logged? For how long? Who can read them?
Are they used for training? (a contractual question)
Encrypted at rest and in transit? (yes and yes)
What is the deletion path, and how is deletion verified?
Replicated across regions? (a residency question, 23.f)
Do traces contain content? (they usually should not, 23.h)
Does any cache keep content beyond the request? (the prefix cache, in GPU memory;
KV offload tiers and connectors, possibly on disk or another host)
What happens on a crash dump? (it contains prompts and KV cache)Practical defaults: log token counts, not text (content only with explicit opt-in, separate storage, short retention); redact known personal-data patterns; disable core dumps on inference nodes; encrypt KV offload tiers that touch disk or the network (9.e). Where the operator itself must not see data, GPUs from H100 onwards offer a confidential-computing mode; that is a product decision with performance and tooling costs, not a default.
Protecting the model#
WEIGHTS
✓ encrypted at rest; node-local caches on encrypted volumes
✓ no weights baked into container images (images get copied to registries)
✓ restrict exec into inference pods; audit reads of the weight store
EXTRACTION THROUGH THE API
Anyone with API access can distil a model by collecting its outputs as training data.
Mitigations are partial: quotas, detecting systematic querying (23.j), terms of service.
LOGPROBS
Carlini et al. (2024) recovered the whole embedding projection layer of two OpenAI
production models for under $20 of queries, using logprobs and logit bias.
→ Return few top_logprobs (vLLM's max_logprobs defaults to 20; lower it for public
endpoints), never full distributions, and think twice before offering logit_bias.Prompt injection, in one paragraph#
A model cannot reliably tell instructions from data, so a document or tool result can steer it. This is not solvable at the inference layer. The platform can help with structured-output enforcement, validating tool calls against the caller’s permissions before they run, per-key capability scoping, audit logs of tool calls, and the tenant isolation above. Treat model output as untrusted input: anything the model asks to do must be authorized by a system that does not trust the model. The AI Security learning materials go deeper.
6. Under the hood: the timing oracle#
The simulation behind section 4. The attacker sends each candidate once, because a second try would hit its own freshly cached copy.
// oracle.go — the prefix-cache timing channel: can one tenant tell which prompt
// another tenant sent, only by timing its own requests?
package main
import (
"fmt"
"math/rand"
)
const (
promptTokens = 1024 // the guessed prompt: a shared document plus one secret line
msPerToken = 0.08 // prefill cost of one uncached token
baseMs = 15.0 // tokenize, schedule, first decode step
jitterMs = 20.0 // mean queueing noise (exponential)
candidates = 10 // how many guesses the attacker tries
trials = 10000
)
type defence struct {
name string
salted bool // per-tenant cache_salt: other tenants' blocks never match
padMs float64 // random delay of 0..padMs added to every first token
}
func ttft(cachedTokens int, d defence, r *rand.Rand) float64 {
ms := baseMs + float64(promptTokens-cachedTokens)*msPerToken + r.ExpFloat64()*jitterMs
return ms + r.Float64()*d.padMs
}
// attack: the victim sent one candidate, which now sits in the prefix cache.
// The attacker sends each candidate once (a second try would hit its own cache)
// and names the fastest. Returns the share of trials it names the right one.
func attack(d defence, r *rand.Rand) float64 {
right := 0
for t := 0; t < trials; t++ {
secret := r.Intn(candidates)
best, bestMs := -1, 1e18
for c := 0; c < candidates; c++ {
cached := 0
if c == secret && !d.salted {
cached = promptTokens
}
if ms := ttft(cached, d, r); ms < bestMs {
best, bestMs = c, ms
}
}
if best == secret {
right++
}
}
return float64(right) / float64(trials)
}
func main() {
r := rand.New(rand.NewSource(42))
fmt.Printf("TTFT uncached ~%.0f ms, cached ~%.0f ms, plus queue noise (mean %.0f ms)\n",
baseMs+promptTokens*msPerToken, baseMs, jitterMs)
fmt.Printf("%-36s %9s %14s\n", "defence", "accuracy", "added TTFT")
fmt.Printf("%-36s %8.1f%% %14s\n", "(blind guess)", 100.0/candidates, "")
for _, d := range []defence{
{"none: one shared prefix cache", false, 0},
{"random delay 0-100 ms", false, 100},
{"random delay 0-300 ms", false, 300},
{"cache_salt per tenant", true, 0},
} {
fmt.Printf("%-36s %8.1f%% %11.0f ms\n", d.name, 100*attack(d, r), d.padMs/2)
}
}Output:
TTFT uncached ~97 ms, cached ~15 ms, plus queue noise (mean 20 ms)
defence accuracy added TTFT
(blind guess) 10.0%
none: one shared prefix cache 98.8% 0 ms
random delay 0-100 ms 82.4% 50 ms
random delay 0-300 ms 35.6% 150 ms
cache_salt per tenant 10.4% 0 msTwo lessons. Noise is a weak defence: the gap between a hit and a miss (about 80 ms here) is large next to queueing jitter, and an attacker can repeat the experiment with fresh candidates. And longer prompts make the channel stronger, since a hit saves more prefill. Real caches match in whole blocks (16 tokens for a standard model in vLLM, 17.f), so an attacker can also probe a secret block by block once they know the text that precedes it.
7. Performance implications#
- Salting costs hit rate, not latency. A system prompt shared by N tenants is prefilled and cached
N times. Measure it with
vllm:prefix_cache_hits_total÷vllm:prefix_cache_queries_totalbefore and after (22.j). - Dedicated instances cost utilisation. A small tenant on its own replica runs at a fraction of the batch size it would get in a shared pool (21.f).
- The gateway adds a little latency (authentication, validation, rewriting); usually a few milliseconds, far below prefill.
- Tight input limits are a performance feature. Caps on prompt length,
nand media size protect the KV cache and the CPU-side processors for everyone. - Patching costs rollout capacity. Every engine upgrade needs the evaluation and canary steps of 23.g; plan the cadence rather than discovering it during an incident.
8. Production implications#
- No engine port faces clients. A gateway allowlists paths, authenticates, sets limits, and sets
cache_saltand multimodal uuids from the authenticated tenant. - Internal ports live on a private network, firewalled to the other ranks.
- Write down the tenant trust policy: who may share a process, who gets a salt scope, who needs a dedicated instance.
- Rate limit by tokens and concurrency, not requests (23.j); lower
VLLM_MAX_N_SEQUENCES. - safetensors only, revisions pinned, checksums verified, no unreviewed
--trust-remote-code. - Track advisories for the engine version you run and have an expedited rollout path.
- Document data handling, disable core dumps, encrypt anything that spills KV to disk or network.
- Limit logprobs on public endpoints.
- Treat model output as untrusted input wherever it drives actions.
9. Common mistakes#
- Exposing vLLM directly and trusting
--api-key./invocations,/pauseand/update_weightsneed no key. - Running with
VLLM_SERVER_DEV_MODE=1in production./collective_rpcruns arbitrary RPC. - Rate limiting by requests. It does not bound cost or KV occupancy.
- No limit on
n,max_tokensor media size. One request takes a node. - A shared, unsalted prefix cache across untrusted tenants. Section 4.
- Using the tenant name as the salt, or accepting the client’s salt or uuid. Guessable or forgeable.
- Assuming batching never mixes data. It did, twice, in 2026; isolate tenants whose data must never mix.
- Loading pickle checkpoints or enabling
--trust-remote-codeon unreviewed models. - Mounting the engine cache directory from shared storage.
- Never upgrading the engine “because it works”. Advisories accumulate.
- Logging full prompts by default, or leaving core dumps on.
10. Hands-on exercise#
- Run
oracle.go. ChangepromptTokensto 128 and to 8,192. How does attacker accuracy change, and why? What delay range would be needed to hide an 8k-token prompt? - Start a vLLM v0.32.0 server with
--api-key. Without the key, call/v1/models,/invocations,/metricsand/version. Which answer? Now put an allowlisting proxy in front and repeat. - On a server with prefix caching, time a long prompt sent first as “tenant A” and then as “tenant B”,
with and without different
cache_saltvalues. Compare TTFT. - Audit a deployment you know: any
.binor.ptcheckpoints? Any--trust-remote-code? Images pinned by digest? Where doesVLLM_CACHE_ROOTpoint? - Take the vLLM advisories published in the last 90 days. For each, decide whether it applies to your configuration. How many did?
- Draw where prompt content goes in your system: logs, traces, caches, offload tiers, crash dumps. For each, write down retention and who can read it.
11. Interview questions#
- Why is a single request crashing the engine the most likely security problem, and how do you limit its impact?
- Which vLLM endpoints are unprotected by
--api-key, and how should the engine be exposed? - Explain the prefix-cache timing side channel. Why is random delay a poor fix, and how should the salt be chosen?
- Can batching leak one tenant’s data to another? What happened in 2026, and what follows for isolation policy?
- Why never load pickle checkpoints or enable
--trust-remote-codeon unreviewed models? What else in the supply chain needs trust? - How do logprobs help model extraction, and what would you expose on a public endpoint?
- Can the inference platform solve prompt injection? What can it provide?
12. Further reading#
Checked on 13 November 2026.
- vLLM security guide: endpoints, internal ports, cache salting, multimodal uuids, cache directories
- vLLM security advisories, for example the cross-user data leak, CVE-2026-73558
- Gu et al., Auditing Prompt Caching in Language Model APIs (ICML 2025)
- Zheng et al., InputSnatch: Stealing Input in LLM Services via Timing Side-Channel Attacks
- Carlini et al., Stealing Part of a Production Language Model (2024)
- OWASP Top 10 for LLM Applications
- safetensors and OpenSSF model signing
- NVIDIA MIG user guide
- The AI Security learning materials, especially models and supply chain and abuse and resource attacks