CVE-2025-54381: Bentoml BentoML SSRF Vulnerability Vulnerability

CRITICAL
Advisory Identifier: GHSA-mrmq-3q62-6cc8
CVSS 9.9
CWE-918
Published
Advisory Summary

CVE-2025-54381 is a CRITICAL (CVSS 9.9) bentoml ssrf vulnerability vulnerability (CWE-918: Server-Side Request Forgery (SSRF)) affecting Bentoml libraries in the PyPI ecosystem. The issue involves bentoml ssrf vulnerability in file upload processing. Remediation is available by upgrading affected packages to version 1.4.19.

CVE-2025-54381 at a Glance

CVE Identifier CVE-2025-54381
GHSA Identifier GHSA-mrmq-3q62-6cc8
Severity CRITICAL
CVSS v3.1 Base Score 9.9
CWE Classification CWE-918: Server-Side Request Forgery (SSRF)
Affected Product Bentoml
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2025-54381

To remediate this vulnerability, upgrade all affected Bentoml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

bentoml fixed: 1.4.19
pip install bentoml>=1.4.19
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show bentoml

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2025-54381, inspect your installed packages using pip:

pip show bentoml

Analyze the terminal output to locate any version of Bentoml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.19), your application is affected.

Note: The pip show bentoml command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-918: Server-Side Request Forgery (SSRF), where the web server receives a url or similar request from an upstream component and retrieves the contents of this url, but it does not sufficiently ensure that the request is being sent to the expected destination. In Bentoml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.parse_request()` in `src/_bentoml_impl/serde.py:202` processes the request 3. `form = await request.form()` parses multipart data using Starlette 4. For file-type fields: `value = [await self.ensure_file(v) for v in form.getlist(k)]` at line 209 5. `MultipartSerde.ensure_file()` 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` + `multipart_fields` 2. `JSONSerde.parse_request()` in `src/_bentoml_impl/serde.py:157` processes the request 3. `body = await request.body()` extracts request body 4. Condition check: `if issubclass(cls, IORootModel) and cls.multipart_fields:` at line 164 5. Weak validation: `if is_http_url(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 process_image(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/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.

CVE-2025-54381 Affected Bentoml Versions

1 component(s)
Fixed Versions:
1.4.19
Product / Package Ecosystem Affected Versions Fixed Version
bentoml
PyPI
≥ 1.4.0
< 1.4.19
1.4.19

References

Frequently Asked Questions

What is CVE-2025-54381?
CVE-2025-54381 is a security vulnerability in Bentoml involving BentoML SSRF Vulnerability in File Upload Processing under CWE-918: Server-Side Request Forgery (SSRF).
Which Bentoml versions are affected?
Affected versions include releases prior to 1.4.19 across affected packages: bentoml.
What version fixes CVE-2025-54381?
Upgrading to 1.4.19 (or the latest patched release for your respective branch) resolves the vulnerability.
Is bentoml affected?
Yes, bentoml is affected in releases prior to 1.4.19. Upgrade your dependency to 1.4.19 or later.
What is the CVSS score of CVE-2025-54381?
CVE-2025-54381 has a CVSS v3.1 base score of 9.9 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:L.
What CWE is associated with CVE-2025-54381?
CVE-2025-54381 is classified under CWE-918: Server-Side Request Forgery (SSRF) (The web server receives a URL or similar request from an upstream component and retrieves the contents of this URL, but it does not sufficiently ensure that the request is being sent to the expected destination.).
How can I check PyPI dependencies for CVE-2025-54381?
Run the dependency tree command: 'pip show bentoml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mrmq-3q62-6cc8",
  "modified" : "2025-07-30T11:43:56Z",
  "published" : "2025-07-29T19:24:47Z",
  "aliases" : [ "CVE-2025-54381" ],
  "summary" : "BentoML SSRF Vulnerability in File Upload Processing  ",
  "details" : "### Description\n\nThere'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.\n\nThe 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.\n\nThe 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.\n\n### Source - Sink Analysis\n\n**Source:** User-controlled multipart form field values and JSON request bodies containing URLs\n\n**Call Chain - Path 1 (MultipartSerde - No Validation):**\n1. HTTP POST request with multipart form data to any BentoML endpoint with file-type input parameters  \n2. `MultipartSerde.parse_request()` in `src/_bentoml_impl/serde.py:202` processes the request\n3. `form = await request.form()` parses multipart data using Starlette\n4. For file-type fields: `value = [await self.ensure_file(v) for v in form.getlist(k)]` at line 209\n5. `MultipartSerde.ensure_file()` called at lines 186-200 with user-controlled string URL\n6. **Sink:** `resp = await client.get(obj)` at line 193 - Direct HTTP request with zero validation\n\n**Call Chain - Path 2 (JSONSerde - Weak Validation):**  \n1. HTTP POST request with JSON body containing URL to endpoint with `IORootModel` + `multipart_fields`\n2. `JSONSerde.parse_request()` in `src/_bentoml_impl/serde.py:157` processes the request\n3. `body = await request.body()` extracts request body\n4. Condition check: `if issubclass(cls, IORootModel) and cls.multipart_fields:` at line 164\n5. Weak validation: `if is_http_url(url := body.decode(\"utf-8\", \"ignore\")):` at line 165 (only checks scheme)\n6. **Sink:** `resp = await client.get(url)` at line 168 - HTTP request after insufficient validation\n\n### Proof of Concept\n\nCreate a BentoML service:\n```python\nfrom pathlib import Path\nimport bentoml\n\n@bentoml.service  \nclass ImageProcessor:\n    @bentoml.api\n    def process_image(self, image: Path) -> str:\n        return f\"Processed image: {image}\"\n```\n\nDeploy and exploit:\n```bash\n# Start service (binds to 0.0.0.0:3000 by default)\nbentoml serve service.py:ImageProcessor\n\n# SSRF Attack 1 - Access AWS metadata  \ncurl -X POST http://target:3000/process_image \\\n     -F 'image=http://169.254.169.254/latest/meta-data/'\n\n# SSRF Attack 2 - Internal service enumeration\ncurl -X POST http://target:3000/process_image \\  \n     -F 'image=http://localhost:8080/admin'\n\n# SSRF Attack 3 - Internal network scanning\ncurl -X POST http://target:3000/process_image \\\n     -F 'image=http://10.0.0.1:22'\n```\n\nExpected result: Server makes HTTP requests to internal/cloud endpoints, potentially returning sensitive data in error messages or logs.\n\n### Impact\n- Access AWS/GCP/Azure cloud metadata services for credential theft\n- Enumerate and interact with internal HTTP services and APIs  \n- Bypass firewall restrictions to reach internal network resources\n- Perform network reconnaissance from the server's perspective\n- Retrieve sensitive information disclosed in HTTP response data\n- Potential for internal service exploitation through crafted requests\n\n### Remediation  \n\nImplement 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "bentoml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.4.0"
      }, {
        "fixed" : "1.4.19"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/bentoml/BentoML/security/advisories/GHSA-mrmq-3q62-6cc8"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-54381"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bentoml/BentoML/commit/534c3584621da4ab954bdc3d814cc66b95ae5fb8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/bentoml/BentoML"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-918" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-07-29T19:24:47Z",
    "nvd_published_at" : "2025-07-29T23:15:32Z"
  }
}