CVE-2025-54381: BentoML SSRF Vulnerability in File Upload Processing
BentoML 1.4.0 up to 1.4.18 downloads files from user-supplied URLs in its upload handlers without blocking internal addresses. An unauthenticated attacker can make the server request localhost, internal services or cloud metadata endpoints. Upgrade to 1.4.19.
Published Jul 29, 2025 · Updated Oct 27, 2026 · Analysis Nov 10, 2026
What an attacker can do
BentoML's serialization handlers fetch a file when a request carries a URL instead of file bytes. In MultipartSerde, form values go straight into an HTTP GET with no validation. In JSONSerde, only the URL scheme is checked, so internal, localhost and cloud metadata addresses still pass.
Any service endpoint with file-type parameters (pathlib.Path or PIL.Image.Image) is reachable this way. The JSON path also needs an IORootModel with multipart_fields. No authentication or user interaction is needed, and a BentoML service binds to 0.0.0.0:3000 by default.
The attacker uses your model server as a proxy into the network behind it. The advisory lists theft of cloud credentials from AWS, GCP and Azure metadata services, access to internal HTTP services and APIs, internal reconnaissance, and leaks of response data or error messages. It rates the flaw critical (CVSS 3.1 of 9.9).
Who is affected
The pip package bentoml, versions from 1.4.0 up to but not including 1.4.19, for services that accept file-type inputs. Check:
pip show bentomlThen look at your service definitions for pathlib.Path or PIL.Image.Image input parameters.
bentoml
- Ecosystem
- PyPI
- Affected
- >= 1.4.0, < 1.4.19
- Fixed in
- 1.4.19
- Check
pip show bentoml
How to fix it
Upgrade to 1.4.19:
pip install --upgrade bentoml==1.4.19Rebuild and redeploy your Bentos, since the library is packaged into them. The advisory lists no workaround for earlier versions. It recommends blocking private ranges, localhost and metadata endpoints in both serialization paths and tightening is_http_url() with an allowlist. Until you upgrade, restrict egress from the service to internal ranges and block 169.254.169.254.
How to tell if you were hit
Review request logs for file parameters whose values are URLs pointing at localhost, private ranges or 169.254.169.254. Check outbound connections from the BentoML host to internal services it should not call, and check cloud logs for metadata credentials used from unexpected places.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Description
There's an SSRF in the file upload processing system that allows remote attackers to make arbitrary HTTP requests from the server without authentication. The vulnerability exists in the serialization/deserialization handlers for multipart form data and JSON requests, which automatically download files from user-provided URLs without proper validation of internal network addresses.
The framework automatically registers any service endpoint with file-type parameters (pathlib.Path, PIL.Image.Image) as vulnerable to this attack, making it a framework-wide security issue that affects most real-world ML services handling file uploads. While BentoML implements basic URL scheme validation in the JSONSerde path, the MultipartSerde path has no validation whatsoever, and neither path restricts access to internal networks, cloud metadata endpoints, or localhost services.
The documentation explicitly promotes this URL-based file upload feature, making it an intended but insecure design that exposes all deployed services to SSRF attacks by default.
Source - Sink Analysis
Source: User-controlled multipart form field values and JSON request bodies containing URLs
Call Chain - Path 1 (MultipartSerde - No Validation):
- HTTP POST request with multipart form data to any BentoML endpoint with file-type input parameters
MultipartSerde.parse_request()insrc/_bentoml_impl/serde.py:202processes the requestform = await request.form()parses multipart data using Starlette- For file-type fields:
value = [await self.ensure_file(v) for v in form.getlist(k)]at line 209 MultipartSerde.ensure_file()called at lines 186-200 with user-controlled string URL- Sink:
resp = await client.get(obj)at line 193 - Direct HTTP request with zero validation
Call Chain - Path 2 (JSONSerde - Weak Validation):
- HTTP POST request with JSON body containing URL to endpoint with
IORootModel+multipart_fields JSONSerde.parse_request()insrc/_bentoml_impl/serde.py:157processes the requestbody = await request.body()extracts request body- Condition check:
if issubclass(cls, IORootModel) and cls.multipart_fields:at line 164 - Weak validation:
if is_http_url(url := body.decode("utf-8", "ignore")):at line 165 (only checks scheme) - Sink:
resp = await client.get(url)at line 168 - HTTP request after insufficient validation
Proof of Concept
Create a BentoML service:
from pathlib import Path
import bentoml
@bentoml.service
class ImageProcessor:
@bentoml.api
def process_image(self, image: Path) -> str:
return f"Processed image: {image}"Deploy and exploit:
# Start service (binds to 0.0.0.0:3000 by default)
bentoml serve service.py:ImageProcessor
# SSRF Attack 1 - Access AWS metadata
curl -X POST http://target:3000/process_image \
-F 'image=http://169.254.169.254/latest/meta-data/'
# SSRF Attack 2 - Internal service enumeration
curl -X POST http://target:3000/process_image \
-F 'image=http://localhost:8080/admin'
# SSRF Attack 3 - Internal network scanning
curl -X POST http://target:3000/process_image \
-F 'image=http://10.0.0.1:22'Expected result: Server makes HTTP requests to internal/cloud endpoints, potentially returning sensitive data in error messages or logs.
Impact
- Access AWS/GCP/Azure cloud metadata services for credential theft
- Enumerate and interact with internal HTTP services and APIs
- Bypass firewall restrictions to reach internal network resources
- Perform network reconnaissance from the server's perspective
- Retrieve sensitive information disclosed in HTTP response data
- Potential for internal service exploitation through crafted requests
Remediation
Implement comprehensive URL validation in both serialization paths by adding network restriction checks to prevent access to internal/private network ranges, localhost, and cloud metadata endpoints. The existing is_http_url() function should be enhanced to include allowlist validation rather than just scheme checking.
Credited to geckosecurity, jjjutla, nkoorty.
Questions
- Which BentoML versions are affected by CVE-2025-54381?
From 1.4.0 up to but not including 1.4.19. The fixed version is 1.4.19.
- Does it need authentication?
No. The advisory describes a remote attack with no privileges and no user interaction. The service binds to 0.0.0.0:3000 by default.
- Which services are exposed?
Those with endpoints that take file-type parameters such as pathlib.Path or PIL.Image.Image. The JSON path also requires an IORootModel with multipart_fields.
- What can an attacker reach?
Cloud metadata services (AWS, GCP, Azure), internal HTTP services and APIs, and internal network hosts, through requests made by your server.
References
Read for this analysis:
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More BentoML vulnerabilities
All BentoML entriesCVE-2026-44345
BentoML Dockerfile command injection via docker.base_image (sister of pending GHSA-w2pm-x38x-jp44 / CVE-2026-33744 / CVE-2026-35043)
high8.8May 11, 2026CVE-2026-44346
Dockerfile command injection via envs[*].name in bentofile.yaml (sibling fix-bypass of CVE-2026-33744 and CVE-2026-35043)
high8.8May 11, 2026CVE-2026-40610
BentoML has Information Disclosure in `bentoml build` via symlink traversal in the build context
medium5.5May 7, 2026CVE-2026-35043
BentoML: Command Injection in cloud deployment setup script
high7.8Apr 3, 2026CVE-2026-35044
BentoML: SSTI via Unsandboxed Jinja2 in Dockerfile Generation
high8.8Apr 3, 2026CVE-2026-33744
BentoML has Dockerfile Command Injection via system_packages in bentofile.yaml
high7.8Mar 26, 2026
