Skip to main content
Menu
Advisories

vllm denial of service

GHSA-P6G9-7V3X-M8MVPublished Updated GitHub

Description

Severity

  • Severity: Moderate
  • CVSS v3.1: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H (6.5)
  • CWE: CWE-770 (Allocation of Resources Without Limits or Throttling) / CWE-400 (Uncontrolled Resource Consumption); CWE-1284 (Improper Validation of Quantity in Input) for the per-modality item-count site.

The family vector uses PR:L because the chat and batch surfaces sit behind the API key when one is configured. One of the four sites — the Rust frontend POST /tokenize route — is unauthenticated by design, so that specific vector is PR:N; the maintainers may wish to note that unauthenticated sub-vector in the published advisory.

Affected

  • Ecosystem / package: pip / vllm
  • Affected versions: vLLM ≤ 0.25.1 (confirmed on 0.25.1, commit 752a3a504485). The code paths predate 0.25.1; maintainers can confirm the lower bound during triage.

Summary

vLLM documents several media controls as protection against out-of-memory denial of service: a compressed audio filesize cap (VLLM_MAX_AUDIO_CLIP_FILESIZE_MB, default 25 MB), per-modality item limits (--limit-mm-per-prompt), and a general guidance to restrict media decode sizes. Each of these is premised on oversized or over-count media being rejected before the process commits memory. Across four ingress paths, the media-acquisition layer instead performs the expensive work first — it fully reads the HTTP response body, base64-decodes the inline payload, or spawns one fetch/decode task per media part — and only then applies the documented limit (or, on some paths, never applies it).

A single request can therefore make the API-server or batch-runner process allocate memory and consume outbound bandwidth proportional to an attacker-chosen body size or media item count before the request is rejected. This is a remote, pre-inference memory / bandwidth exhaustion (availability) primitive. No code execution and no data disclosure.

The four sites share one root cause (media work / materialization before the documented control) and one fix shape (bound the input at the acquisition boundary, ideally through a shared helper). They are filed together for that reason; the maintainers are welcome to split this into per-component advisories (shared Python fetch layer, chat audio, batch speech, Rust frontend) if that is easier to track and patch.

This report is distinct from the published advisory GHSA-v82g-2437-67m2 — that fix threads VLLM_MAX_AUDIO_CLIP_FILESIZE_MB only into the speech-to-text UploadFile transcription/translation routes (request.file.read()), leaving this chat audio_url / base64 path uncovered — and from GHSA-pf3h-qjgv-vcpr, whose fix adds only an SSRF domain allowlist on download_bytes_from_url and no byte ceiling, so the full-body materialization before the len(audio_data) check survives it.

Affected code

Links pinned to the confirmed commit 752a3a504485 (v0.25.1). The common sink for the remote paths is HTTPConnection.get_bytes() / async_get_bytes(), which return requests.Response.content / await ClientResponse.read() — the whole body — with no byte ceiling:

# vllm/connections.py Lines 278-302
    @_sync_retry
    def get_bytes(
        self, url: str, *, timeout: float | None = None, allow_redirects: bool = True
    ) -> bytes:
        with self.get_response(
            url, timeout=timeout, allow_redirects=allow_redirects
        ) as r:
            r.raise_for_status()

            return r.content

    @_async_retry
    async def async_get_bytes(
        self,
        url: str,
        *,
        timeout: float | None = None,
        allow_redirects: bool = True,
    ) -> bytes:
        async with await self.get_async_response(
            url, timeout=timeout, allow_redirects=allow_redirects
        ) as r:
            r.raise_for_status()

            return await r.read()

Both return the entire response body (r.content / await r.read()) with no byte ceiling — the full attacker-sized payload is materialized before any caller-side media limit can run.

Site 1 — shared remote-fetch layer has no byte ceiling (all remote modalities). The media connector reaches the unbounded helper before invoking any decoder, on all remote modalities (image, audio, video):

Site 2 — chat audio materialized before the compressed-size cap (/v1/chat/completions). audio_url flows through MediaConnector.load_from_url → HTTPConnection.get_bytes (full body); input_audio flows through the chat parser into a base64 decode of the full payload. VLLM_MAX_AUDIO_CLIP_FILESIZE_MB is never applied on this path — only the decode-duration guard (VLLM_MAX_AUDIO_DECODE_DURATION_S) runs, and it covers a different (PCM-expansion) case:

# vllm/multimodal/media/audio.py Lines 238-250
    def load_bytes(self, data: bytes) -> tuple[npt.NDArray, float]:
        return load_audio(
            BytesIO(data),
            sr=None,
            max_duration_s=envs.VLLM_MAX_AUDIO_DECODE_DURATION_S,
        )

    def load_base64(
        self,
        media_type: str,
        data: str,
    ) -> tuple[npt.NDArray, float]:
        return self.load_bytes(pybase64.b64decode(data))

b64decode(data) allocates the full decoded payload and load_bytes applies only VLLM_MAX_AUDIO_DECODE_DURATION_S; VLLM_MAX_AUDIO_CLIP_FILESIZE_MB is never consulted here.

Site 3 — batch speech file_url materialized before the endpoint size cap (vllm run-batch). Speech rows fully download (HTTP) or base64.b64decode (data:) the body before the shared handler applies its len(audio_data) filesize check; the runner asyncio.gathers all row futures, so several oversized rows overlap in memory:

Site 4 — Rust frontend fetches per-part media before per-modality item limits (/v1/chat/completions, /tokenize). The frontend records the media-part count and then spawns one async fetch/decode task per part with no count check between; --limit-mm-per-prompt is marked unsupported in the Rust CLI. Both routes reach the shared preparation path, and /tokenize is unauthenticated by design:

  • rust/src/chat/src/multimodal.rs#L305-L328 — prepare_multimodal() records media_parts_len (L314) then calls self.fetch_images(media_parts) (L316) with no count check between; #L333-L337 — fetch_images() calls tracker.push_part(part) for every attacker-supplied part.
// rust/src/chat/src/multimodal.rs Lines 314-337
        let media_parts_len = media_parts.len();

        let fetched = self.fetch_images(media_parts).await?;
        let preprocessed = self.preprocess_images(&fetched.frames).await?;
        let replacements = self.spec.prompt_replacements(&self.context, &preprocessed)?;
        let ranges = self.expand_prompt_tokens(prompt_token_ids, replacements)?;

        let features = self.build_features(preprocessed, fetched, ranges, model_dtype)?;
        if features.len() != media_parts_len {
            bail_multimodal!(
                "number of built multimodal features {} does not match number of media parts {}",
                features.len(),
                media_parts_len
            );
        }
        Ok(features)
    }

    /// Fetch all image parts and preserve their request-order UUID metadata.
    async fn fetch_images(&self, media_parts: Vec<MediaContentPart>) -> Result<FetchedImageMedia> {
        let mut tracker = AsyncMultiModalTracker::new(Arc::clone(&self.media_connector));
        for part in media_parts {
            tracker.push_part(part).map_err(|error| multimodal!("{error}"))?;
        }

media_parts_len is recorded but never compared against a per-modality limit before fetch_images spawns one tracker/fetch task per attacker-supplied part.

The correct (early-bound) sibling that these paths drifted from is vllm/entrypoints/speech_to_text/base/utils.py#L14 — read_upload_with_limit(), which checks file.size, reads in 64 KiB chunks, and rejects as soon as the cumulative total exceeds the budget, before joining.

Impact

A single client that can reach an affected media ingress path can force the shared serving process (or batch runner) to allocate memory and consume outbound bandwidth proportional to an attacker-chosen compressed body size (Sites 1, 2, 3) or media item count (Site 4) before the request is rejected. Repeated or concurrent requests compound the pressure, up to out-of-memory of a single process. The documented VLLM_MAX_AUDIO_CLIP_FILESIZE_MB / --limit-mm-per-prompt controls give operators a false sense of protection on these surfaces because they run too late or not at all. Media URL parts are compact, so a single request body under the JSON size cap can carry thousands of references (Site 4). Availability only — no RCE, no data exposure. Optional media caching (VLLM_MEDIA_CACHE) can additionally persist oversized responses to disk.

Proof of concept

Confirmed on v0.25.1 (752a3a504485).

Worked example — the shared byte-ceiling gap (Site 1). A loopback server returns a 2 MiB body; the harness drives the real HTTPConnection.async_get_bytes():

data = await connection.async_get_bytes(url)   # url -> loopback server returning a 2 MiB body
# vulnerable (v0.25.1): {"bytes": 2097152, "result": "accepted"}  -- whole body materialized
# with the fix below:   raises a download-size-exceeded error      -- rejected mid-stream

async_get_bytes returns await ClientResponse.read() (the entire body) with no ceiling, so the full 2 MiB bytes object is allocated before any media limit runs. Input (attacker-chosen response size) flows straight into the sink (r.read()) with no budget between; the observed result is complete materialization. The streaming guard in the Suggested Fix aborts once the cumulative chunk total crosses the budget, so the same request is rejected after at most one 64 KiB chunk.

  • Site 1 (shared fetch layer). A loopback harness serves a 2 MiB chunked body through HTTPConnection.async_get_bytes(); the vulnerable target accepts and materializes the full response ({"bytes": 2097152, "result": "accepted"}), while a patched oracle rejects the same body with a download-size-exceeded error.
  • Site 2 (chat audio). A bounded ordering harness (96 KiB payload against a 64 KiB illustrative limit) shows both the audio_url HTTP sink and the input_audio base64 sink receive the full payload before any compressed-size check, while the read_upload_with_limit sibling stops at the chunk boundary. AST verification against a checkout confirms AudioMediaIO.load_base64 calls self.load_bytes(pybase64.b64decode(data)), that load_bytes applies only the duration guard, and that VLLM_MAX_AUDIO_CLIP_FILESIZE_MB is absent from the chat connector and AudioMediaIO.
  • Site 3 (batch speech). AST-node harnesses compiled the exact download_bytes_from_url, async_get_bytes, and _preprocess_speech_to_text nodes from a checkout and drove 1 MiB + 1 byte through both the data: and HTTP branches; both returned the complete payload ({"data_url_materialized_bytes": 1048577, "http_materialized_bytes": 1048577}) before the late len(audio_data) rejection. Running the actual checked-out run_batch() coroutine in fresh subprocesses on oversized 4 MiB rows produced monotonic peak-RSS deltas of ~7.8 / 21 / 39 / 74 MB for 1 / 4 / 8 / 16 concurrent rows before the late rejection fired.
  • Site 4 (Rust frontend). A disposable Rust frontend built with protoc v35.1 accepted an anonymous /tokenize request carrying eight media parts and returned 200 OK with callback_hits=8, callback_peak_inflight=8 (one fetch per part, all before tokenization returned); the same test confirmed /v1/chat/completions returned 401 when API keys were configured. A ~334 KB body carries 4096 image_url parts under the JSON cap. Exact blast radius (max parts under the JSON cap, fetch-timeout overlap, per-model decode cost) is argued from the source path plus the eight-part HTTP test, not from a production sweep.

Suggested Fix

Enforce a shared compressed-byte / item-count budget at the acquisition boundary before vLLM creates a full attacker-sized bytes object or spawns per-part fetch work, then keep the existing decode-stage limits as second-stage guards.

  • Add a max_bytes parameter to HTTPConnection.get_bytes / async_get_bytes: honor Content-Length when present, stream in bounded (e.g. 64 KiB) chunks, and abort once the cumulative total exceeds the budget. Only cache or hand off to a decoder after the budget check passes.
  • For inline data: / input_audio payloads, reject from the encoded length (max_encoded_chars = 4 * ((max_bytes + 2) // 3)) before b64decode, with a post-decode length backstop.
  • Thread VLLM_MAX_AUDIO_CLIP_FILESIZE_MB into the chat and batch audio paths so the documented cap actually runs there; prefer one shared "read media with limit" helper reused by the online multipart, chat, and batch paths so they cannot drift again.
  • Rust frontend: count media items per modality before any fetch_images / tracker task creation and reject over-limit requests using the same --limit-mm-per-prompt semantics as the Python frontend (plumb the currently-"unsupported" flag into the Rust config); apply the check in the shared prepare_multimodal so both /v1/chat/completions and /tokenize inherit it.
  • Regression tests: body at the limit vs one byte over (rejected before decode); HTTP response with and without Content-Length; async response that stops after the first over-limit chunk; a chat/tokenize request with limit + 1 media parts rejected before any connector fetch.

The essential change is a max_bytes streaming ceiling on the shared HTTP reader, threaded from each modality's configured cap, plus an equivalent pre-decode check on inline base64 and a per-modality count check in the Rust frontend. Core hunks:

# vllm/connections.py — bounded streaming read (async_get_bytes; get_bytes mirrors it)
     async def async_get_bytes(
-        self, url, *, timeout=None, allow_redirects=True,
+        self, url, *, timeout=None, allow_redirects=True, max_bytes: int | None = None,
     ) -> bytes:
         async with await self.get_async_response(...) as r:
             r.raise_for_status()
-            return await r.read()
+            if max_bytes is None:
+                return await r.read()
+            if r.content_length is not None:
+                _raise_if_body_too_large(r.content_length, max_bytes)   # honor Content-Length
+            chunks, total = [], 0
+            async for chunk in r.content.iter_chunked(_READ_CHUNK_SIZE):  # 64 KiB
+                total += len(chunk)
+                _raise_if_body_too_large(total, max_bytes)               # abort mid-stream
+                chunks.append(chunk)
+            return b"".join(chunks)
# vllm/multimodal/media/audio.py — reject inline base64 from encoded length before b64decode
+        max_encoded_chars = 4 * ((self.get_max_bytes() + 2) // 3)  # get_max_bytes() =
+        if len(data) > max_encoded_chars:                          # VLLM_MAX_AUDIO_CLIP_FILESIZE_MB
+            raise VLLMValidationError("Maximum file size exceeded", ...)
         return self.load_bytes(pybase64.b64decode(data))

The connector threads the modality cap through as media_io.get_max_bytes() → get_bytes(..., max_bytes=...), so the documented VLLM_MAX_AUDIO_CLIP_FILESIZE_MB is enforced on the chat / batch paths that currently skip it.

// rust/src/chat/src/multimodal.rs — count parts per modality before any fetch task is spawned
         let media_parts_len = media_parts.len();
+        validate_media_part_counts(&media_parts)?;   // reject > limit_mm_per_prompt
         let fetched = self.fetch_images(media_parts).await?;

Each hunk carries regression tests: body at the limit vs one byte over (rejected before decode), HTTP response with and without Content-Length, an async response that stops after the first over-limit chunk, and a chat/tokenize request with limit + 1 media parts rejected before any connector fetch.

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: github.com/vllm-project/vllm/pull/51896

Affected versions

References

GitHub · vllm-project/vllm