{"id":"CVE-2026-61539","aliases":["CVE-2026-61539","GHSA-x2rj-828p-hx9m","PYSEC-2026-3946"],"related":[],"kind":"vulnerability","state":"published","title":"Xinference: Remote code execution via unsafe `eval()` in Llama3 tool-call parsing","summary":"Xinference is an inference API for running open-source, speech, and multimodal models. In 2.5.0 and earlier, Xinference passes attacker-influenced Llama3 tool-call output to eval() in xinference/model/llm/tool_parsers/llama3_tool_parser.py and xinference/model/llm/utils.py. Requests to /v1/chat/completions with a tools field flow through xinference/api/restful_api.py, xinference/model/llm/transformers/core.py, handle_chat_result_non_streaming(), and _post_process_completion() before extract_tool_calls() or _eval_llama3_chat_arguments() evaluates the model-generated Python expression. An unauthenticated remote attacker can influence that output through a crafted prompt and execute commands in the Xinference server process context. This issue is fixed in version 2.7.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Xinference is an inference API for running open-source, speech, and multimodal models. In 2.5.0 and earlier, Xinference passes attacker-influenced Llama3 tool-call output to eval() in xinference/model/llm/tool_parsers/llama3_tool_parser.py and xinference/model/llm/utils.py. Requests to /v1/chat/completions with a tools field flow through xinference/api/restful_api.py, xinference/model/llm/transformers/core.py, handle_chat_result_non_streaming(), and _post_process_completion() before extract_tool_calls() or _eval_llama3_chat_arguments() evaluates the model-generated Python expression. An unauthenticated remote attacker can influence that output through a crafted prompt and execute commands in the Xinference server process context. This issue is fixed in version 2.7.0.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nXinference used Python's unsafe `eval()` function when parsing Llama3 tool-call output generated by a large language model. Because the model output can be influenced by attacker-controlled prompts sent to the chat completion API, a remote attacker can craft prompts that cause the model to return a Python expression. Xinference then evaluates that expression on the server while post-processing the tool-call result. In the tested default deployment, authentication was not enabled, so the vulnerability was exploitable by an unauthenticated remote attacker through the `/v1/chat/completions` endpoint.\n\n### Details\n\nUsers can interact with deployed models through Xinference's OpenAI-compatible `/v1/chat/completions` API. The request entry point is implemented in `xinference/api/restful_api.py`; non-streaming requests call the model instance's `chat()` method and return the inference result.\n\nWhen the Transformers backend is used, inference results flow through the batching logic in `xinference/model/llm/transformers/core.py`. Non-streaming chat results are handled by `handle_chat_result_non_streaming()`. If the request contains a `tools` field, Xinference calls `_post_process_completion()` to parse tool-call output from the model response.\n\nThe Llama3 tool-call parser is implemented in `xinference/model/llm/tool_parsers/llama3_tool_parser.py`. In affected versions, `extract_tool_calls()` parsed model output with `eval()`:\n\n```python\ndef extract_tool_calls(\n    self, model_output: str\n) -> List[Tuple[Optional[str], Optional[str], Optional[Dict[str, Any]]]]:\n    try:\n        data = eval(model_output, {}, {})\n        return [(None, data[\"name\"], data[\"parameters\"])]\n    except Exception:\n        return [(model_output, None, None)]\n```\n\nThe intended behavior was to convert a Python dictionary-like string generated by the model into a dictionary object. However, `eval()` executes the input as a Python expression, and `eval(model_output, {}, {})` is not a security sandbox. If an attacker can influence the model output through prompt injection or direct chat input, the attacker can cause the model to return an expression such as:\n\n```python\n__import__('os').system('touch /tmp/hacked')\n```\n\nWhen the expression reaches `eval()`, it is executed in the Xinference server process context. The harmless `touch /tmp/hacked` command can be replaced with other payloads, such as a reverse shell, malware download, sensitive file read, or lateral-movement payload.\n\n### Score\n\nSeverity: Critical\n\nCVSS v3.1: 10.0\n\nVector: `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H`\n\nRationale:\n\n- AV:N: the vulnerable API is remotely reachable over the network;\n- AC:L: exploitation only requires a crafted chat-completion request and tool-call parameter;\n- PR:N: the tested default configuration did not require authentication;\n- UI:N: no user interaction is required;\n- S:C: command execution can affect resources beyond the Xinference application boundary;\n- C:H/I:H/A:H: remote code execution can fully compromise confidentiality, integrity, and availability.\n\n### Credit\n\nThis vulnerability was discovered by:\n\n- XlabAI Team of Tencent Xuanwu Lab (xlabai@tencent.com)\n- Atuin Automated Vulnerability Discovery Engine\n- Guannan Wang (wgnbuaa@gmail.com), Zhanpeng Liu (pkugenuine@gmail.com), Guancheng Li (lgcpku@gmail.com)","format":"markdown","source":"ghsa"},{"lang":"es","text":"Xinference es una API de inferencia para ejecutar modelos de código abierto, de voz y multimodales. En las versiones 2.5.0 y anteriores, Xinference pasa la salida de llamadas a herramientas de Llama3 influenciada por el atacante a eval() en xinference/model/llm/tool_parsers/llama3_tool_parser.py y xinference/model/llm/utils.py. Las solicitudes a /v1/chat/completions con un campo 'tools' fluyen a través de xinference/api/restful_api.py, xinference/model/llm/transformers/core.py, handle_chat_result_non_streaming() y _post_process_completion() antes de que extract_tool_calls() o _eval_llama3_chat_arguments() evalúen la expresión Python generada por el modelo. Un atacante remoto no autenticado puede influenciar esa salida a través de un prompt manipulado y ejecutar comandos en el contexto del proceso del servidor de Xinference. Este problema se ha solucionado en la versión 2.7.0.","source":"nvd"}],"published":"2026-08-21T20:37:02.633Z","modified":"2026-10-12T16:10:00.220Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"}],"cwes":["CWE-95"],"affected":[{"ranges":[{"version":"< 2.7.0","status":"affected"}],"vendor":"xorbitsai","product":"inference","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.7.0"}],"ecosystem":"PyPI","package":"xinference","purl":"pkg:pypi/xinference","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.7.0"}],"ecosystem":"PyPI","package":"xinference","purl":"pkg:pypi/xinference","source":"pysec"}],"references":[{"url":"https://github.com/xorbitsai/inference/security/advisories/GHSA-x2rj-828p-hx9m","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/xorbitsai/inference/pull/4786","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/xorbitsai/inference/commit/1b3d220f342ce68d34cec4586d9409d457dadc42","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/xorbitsai/inference/releases/tag/v2.7.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/xorbitsai/inference","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/xinference","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-x2rj-828p-hx9m","tags":["advisory"],"sources":["pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-61539","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"total","date":"2026-08-24T19:45:03.839Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-61539","url":"https://www.cve.org/CVERecord?id=CVE-2026-61539","licence":"CVE Terms of Use","modified":"2026-08-24T19:45:13.875Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-x2rj-828p-hx9m","url":"https://github.com/advisories/GHSA-x2rj-828p-hx9m","licence":"CC-BY-4.0","modified":"2026-09-10T12:25:27.471Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-61539","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-61539","licence":"Public domain","modified":"2026-10-12T16:10:00.220Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3946","url":"https://osv.dev/vulnerability/PYSEC-2026-3946","licence":"CC-BY-4.0","modified":"2026-09-10T12:15:15.622Z"}],"updatedAt":"2026-11-25T22:59:34.828Z","epss":{"score":0.00748,"percentile":0.56088,"date":"2026-12-01T12:00:22.000Z"}}