(security) Fix SSRF in batch runner download_bytes_from_url#38482
Merged
DarkLight1337 merged 1 commit intoMar 30, 2026
Merged
Conversation
Contributor
|
Documentation preview: https://vllm--38482.org.readthedocs.build/en/38482/ |
7878ce9 to
d4694bf
Compare
Contributor
There was a problem hiding this comment.
Code Review
This pull request extends SSRF protection to the batch runner by validating media URLs against an allowed domain list and normalizing them to prevent parsing-based bypasses. The changes include documentation, comprehensive security tests, and updates to the transcription/translation wrappers. Feedback points out that an empty allowlist currently permits all domains due to a truthiness check; it is recommended to explicitly check for None so that an empty list correctly denies all requests.
The `file_url` field in batch transcription/translation requests was passed directly to aiohttp without any hostname validation, allowing SSRF attacks against internal services (e.g. cloud metadata endpoints). Add domain validation to `download_bytes_from_url` using the existing `--allowed-media-domains` allowlist, consistent with MediaConnector. Normalize URLs through urllib3 to prevent parsing-discrepancy bypasses and respect `VLLM_MEDIA_URL_ALLOW_REDIRECTS` for redirect control. Signed-off-by: Juan Perez de Algaba <jperezdealgaba@redhat.com> Signed-off-by: jperezde <jperezde@redhat.com>
d4694bf to
aa3d773
Compare
DarkLight1337
approved these changes
Mar 30, 2026
neweyes
pushed a commit
to neweyes/vllm
that referenced
this pull request
Mar 31, 2026
…ject#38482) Signed-off-by: jperezde <jperezde@redhat.com> Signed-off-by: neweyes <328719365@qq.com>
puririshi98
pushed a commit
to puririshi98/vllm
that referenced
this pull request
Apr 7, 2026
…ject#38482) Signed-off-by: jperezde <jperezde@redhat.com> Signed-off-by: Rishi Puri <riship@nvidia.com>
mtparet
pushed a commit
to blackfuel-ai/vllm
that referenced
this pull request
Apr 9, 2026
…ject#38482) Signed-off-by: jperezde <jperezde@redhat.com>
mystous
pushed a commit
to mystous/vllm_hybrid
that referenced
this pull request
May 10, 2026
…ject#38482) Signed-off-by: jperezde <jperezde@redhat.com>
my-other-github-account
pushed a commit
to my-other-github-account/vllm
that referenced
this pull request
May 15, 2026
…ject#38482) Signed-off-by: jperezde <jperezde@redhat.com>
my-other-github-account
pushed a commit
to my-other-github-account/vllm
that referenced
this pull request
May 15, 2026
…ject#38482) Signed-off-by: jperezde <jperezde@redhat.com>
jhu960213
pushed a commit
to jhu960213/vllm
that referenced
this pull request
May 20, 2026
…ject#38482) Signed-off-by: jperezde <jperezde@redhat.com>
mvanhorn
pushed a commit
to mvanhorn/vllm
that referenced
this pull request
Jun 4, 2026
…ject#38482) Signed-off-by: jperezde <jperezde@redhat.com> Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix an SSRF (Server-Side Request Forgery) vulnerability in the batch runner's
download_bytes_from_urlfunction (vllm/entrypoints/openai/run_batch.py).The
file_urlfield in batch transcription/translation requests (BatchTranscriptionRequest,BatchTranslationRequest) was passed directly toaiohttp.ClientSession().get()without any hostname or domain validation. This allowed anyone who could control batch input JSON to make the vLLM batch runner issue arbitrary HTTP/HTTPS requests from the server (e.g. targeting cloud metadata endpoints like169.254.169.254, or internal HTTP APIs).The online serving path (
MediaConnector) already validates URLs against--allowed-media-domains, butdownload_bytes_from_urldid not reuse that protection. This patch closes the gap by:allowed_media_domainsparameter todownload_bytes_from_urlthat validates the URL's hostname against the allowlist before making any HTTP request. Usesurllib3.util.parse_url(consistent withMediaConnector) and normalizes the URL to prevent parsing-discrepancy bypasses (e.g. backslash-@ attacks).allowed_media_domainsfrom the CLI args (--allowed-media-domains) throughmake_transcription_wrapperandbuild_endpoint_registryintodownload_bytes_from_url.VLLM_MEDIA_URL_ALLOW_REDIRECTSfor HTTP redirect control (previously redirects were always followed).docs/usage/security.mdto document that the batch runner is also covered by--allowed-media-domains.data:URLs remain exempt from domain restrictions (they don't make network requests). When no allowlist is configured, behavior is unchanged (backward compatible).Test Plan
python -m pytest tests/entrypoints/openai/test_run_batch.py -v -k "test_download_bytes" --timeout=309 unit tests added covering:
data:URLs bypass domain restrictions169.254.169.254) is blocked10.x,192.168.x,127.x) are blockedNone) permits all domains (backward compat)[]) permits all domainsTest Result
All pre-commit hooks pass (ruff check, ruff format, typos, markdownlint, mypy, SPDX headers, and all project-specific checks).