CVE-2026-61539
Remote code execution via eval() of attacker‑controlled Llama3 tool calls in Xinference.
- CVSS 10.0
- CWE-95
- Input Validation and Sanitization
- Remote
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.
- CWE
- CWE-95
- CVSS base score
- 10.0
- Published
- 2026-08-21
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Xinference
- Fixed by upgrading
- Yes
Solution
Upgrade Xinference to version 2.7.0 (or later) to fix the eval() remote‑code‑execution vulnerability.
Vulnerable code sample
import json
def _eval_llama3_chat_arguments(args_str: str):
# VULNERABLE: directly eval user‑controlled string
return eval(args_str)
def extract_tool_calls(response_json: str):
data = json.loads(response_json)
tool_calls = []
for call in data.get("tool_calls", []):
name = call.get("name")
arguments = call.get("arguments", "")
parsed_args = _eval_llama3_chat_arguments(arguments)
tool_calls.append((name, parsed_args))
return tool_callsPatched code sample
import json
import ast
def _eval_llama3_chat_arguments(args_str: str):
# FIX: safe literal parsing instead of eval
return ast.literal_eval(args_str)
def extract_tool_calls(response_json: str):
data = json.loads(response_json)
tool_calls = []
for call in data.get("tool_calls", []):
name = call.get("name")
arguments = call.get("arguments", "")
parsed_args = _eval_llama3_chat_arguments(arguments)
tool_calls.append((name, parsed_args))
return tool_callsPublished fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- fix: replace eval() with safe alternatives to prevent RCE in tool parsers (#4786) (xorbitsai/inference)
xinference/model/llm/tool_parsers/llama3_tool_parser.py,xinference/model/llm/tool_parsers/llama3_tool_parser.py · Llama3ToolParser.extract_tool_calls,xinference/model/llm/utils.py,xinference/model/llm/utils.py · ChatModelMixin._eval_llama3_chat_arguments
Cite this entry
@misc{vaitp:cve202661539,
title = {{Remote code execution via eval() of attacker‑controlled Llama3 tool calls in Xinference.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-61539},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-61539/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
