Details
The sink passes the padded row straight to the native matcher with no lower-bound check on token ids:
# vllm/v1/structured_output/backend_guidance.py Lines 181-196
def validate_tokens(self, tokens: list[int]) -> list[int]:
"""Checks if the list of tokens are accepted by the parser in sequence.
Will not advance the parser.
Returns the prefix list of tokens that are accepted by the parser.
"""
if len(tokens) == 0:
return []
if self.ll_matcher.is_stopped():
return []
num_tokens = self.ll_matcher.validate_tokens(tokens)
self.check_error()
return tokens[:num_tokens]
Site 3 — Rust frontend accepts an empty structured-output value the Python frontend rejects. The opt-in Rust frontend admits an empty structured_outputs.json / structured_outputs.grammar string that the Python frontend rejects; the empty value passes through the wire-params conversion without validation, reaches the engine, and marks EngineCore dead.
impl TryFrom<WireStructuredOutputsParams> for StructuredOutputsParams: `rust/src/engine-core-client/src/protocol/structured_outputs.rs#L135-L163` —try_fromat L138 mapsraw.jsonto aJsonconstraint (L159) andraw.grammarto aGrammarconstraint (L162) with no non-empty check, so an empty value is forwarded unchanged.WireStructuredOutputsParamsis defined at `#L115`.
The conversion maps each field to a constraint with no non-empty check, so an empty json/grammar string is forwarded unchanged:
// rust/src/engine-core-client/src/protocol/structured_outputs.rs Lines 135-162
impl TryFrom<WireStructuredOutputsParams> for StructuredOutputsParams {
type Error = Error;
fn try_from(raw: WireStructuredOutputsParams) -> Result<Self> {
use StructuredOutputConstraint::*;
let mut constraint = None;
macro_rules! insert_constraint {
($name:literal, $value:expr) => {
if let Some(value) = $value {
if let Some((existing, _)) = constraint {
return Err(Error::InvalidStructuredOutputsParams {
message: format!(
"multiple structured output constraints specified: {existing}, {}",
$name
),
});
}
constraint = Some(($name, value));
}
};
}
insert_constraint!("json", raw.json.map(Json));
insert_constraint!("regex", raw.regex.map(Regex));
insert_constraint!("choice", raw.choice.map(Choice));
insert_constraint!("grammar", raw.grammar.map(Grammar));
Impact
Any client able to send an ordinary structured-output request (two requests for Site 1) can terminate the shared EngineCore, denying service to all tenants of that engine instance. Availability only; no code execution, memory corruption, or data disclosure.
- Site 1 affects the default
"auto"structured-output backend; no speculative decoding or non-default configuration is required. - Site 2 requires a deployment using the
guidancebackend together withngram_gpuspeculative decoding; the-1sentinel is produced by the proposer itself, so an ordinary constrained request suffices — the client does not craft the negative token. - Site 3 requires the opt-in Rust frontend; a single request with an empty constraint value is enough. API-key middleware narrows the attacker from unauthenticated to authenticated but does not restore the missing validation.
Suggested Fix
Convert structured-output failures into request-scoped errors at the boundary. Each site is a distinct fix shape; the core hunk for each is below.
Site 1 — resolve the backend per request instead of latching one process-wide, so a grammar is always compiled with the backend that auto actually selected for it (and a compile failure is that request's error, not the engine's):
# vllm/v1/structured_output/__init__.py — grammar_init(), replacing the latched-backend path
backend = self._get_or_create_backend(request.structured_output_request.backend)
if self._use_async_grammar_compilation:
grammar = self.executor.submit(self._create_grammar, request, backend)
else:
grammar = self._create_grammar(request, backend)
Site 2 — drop negative sentinels before handing the row to the native matcher, inside validate_tokens():
# vllm/v1/structured_output/backend_guidance.py — validate_tokens(), before the ll_matcher call
for i, token in enumerate(tokens):
if token < 0:
tokens = tokens[:i]
break
if len(tokens) == 0:
return []
Site 3 — reject empty json/grammar strings in the Rust wire-params conversion, matching the Python frontend, before the value reaches the engine:
// rust/src/engine-core-client/src/protocol/structured_outputs.rs — try_from(), before constraint mapping
if matches!(&raw.json, Some(Value::String(value)) if value.trim().is_empty()) {
return Err(Error::InvalidStructuredOutputsParams {
message: "structured_outputs.json cannot be an empty string".to_string(),
});
}
if matches!(&raw.grammar, Some(value) if value.trim().is_empty()) {
return Err(Error::InvalidStructuredOutputsParams {
message: "structured_outputs.grammar cannot be an empty string".to_string(),
});
}
The three sites share one root cause and the same fix shape (bound the failure to the request), so they are filed as a single advisory; happy to split into per-component advisories if the maintainers prefer. Each fix carries a regression test.
Credit
Reported by: Patch the Planet (Trail of Bits + OpenAI collaboration)
These vulnerabilities were discovered using GPT-5.5-Cyber as part of the Patch the Planet security initiative.
---
Proposed fix: a fix for this issue is proposed in a public pull request: https://github.com/vllm-project/vllm/pull/51450