All vulnerabilities
CVE-2026-61539GHSA-x2rj-828p-hx9mPYSEC-2026-3946

Xinference vulnerable to remote code execution via unsafe `eval()` in Llama3 tool-call parsing

xorbitsai xinferencepipLibraries & packages
CVSS
10.0Critical
ExploitationNo known exploitationNot in CISA KEV, which does not prove it is unexploitedCISA KEV
Exploit odds (EPSS)1.23%Chance of exploitation activity in the next 30 days, higher than 68% of CVEs. Scored 23 Oct 2026FIRST EPSS
Fixed in2.7.0Fixed versionGitHub
Published21 Aug 2026Updated 8 Oct 2026CVE List

What fixes it

  • 2.7.0xinference, pipGitHub
  • 2.7.0xinference, PyPIOSVpip install "xinference>=2.7.0"

A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.

Description

Summary

Xinference 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.

Details

Users 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.

When 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.

The 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():

def extract_tool_calls(
    self, model_output: str
) -> List[Tuple[Optional[str], Optional[str], Optional[Dict[str, Any]]]]:
    try:
        data = eval(model_output, {}, {})
        return [(None, data["name"], data["parameters"])]
    except Exception:
        return [(model_output, None, None)]

The 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:

__import__('os').system('touch /tmp/hacked')

When 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.

Score

Severity: Critical

CVSS v3.1: 10.0

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Rationale:

  • AV:N: the vulnerable API is remotely reachable over the network;
  • AC:L: exploitation only requires a crafted chat-completion request and tool-call parameter;
  • PR:N: the tested default configuration did not require authentication;
  • UI:N: no user interaction is required;
  • S:C: command execution can affect resources beyond the Xinference application boundary;
  • C:H/I:H/A:H: remote code execution can fully compromise confidentiality, integrity, and availability.

Credit

This vulnerability was discovered by:

  • XlabAI Team of Tencent Xuanwu Lab (xlabai@tencent.com)
  • Atuin Automated Vulnerability Discovery Engine
  • Guannan Wang (wgnbuaa@gmail.com), Zhanpeng Liu (pkugenuine@gmail.com), Guancheng Li (lgcpku@gmail.com)

Text from GitHub Advisory Database

Affected versions 53

  • xinference, pip<= 2.5.0GitHub
  • inferenceaffected: < 2.7.0CVE List
  • xinference, PyPIfrom first release, fixed in 2.7.0OSV
  • xinference, PyPI0.0.0OSV
  • xinference, PyPI0.0.1OSV
  • xinference, PyPI0.0.2OSV
  • xinference, PyPI0.0.3OSV
  • xinference, PyPI0.0.4OSV
  • xinference, PyPI0.0.5OSV
  • xinference, PyPI0.0.6OSV
  • xinference, PyPI0.1.0OSV
  • xinference, PyPI0.1.1OSV
  • xinference, PyPI0.1.2OSV
  • xinference, PyPI0.1.3OSV
  • xinference, PyPI0.10.0OSV
  • xinference, PyPI0.10.1OSV
  • xinference, PyPI0.10.2OSV
  • xinference, PyPI0.10.2.post1OSV
  • xinference, PyPI0.10.3OSV
  • xinference, PyPI0.11.0OSV
  • xinference, PyPI0.11.1OSV
  • xinference, PyPI0.11.2OSV
  • xinference, PyPI0.11.2.post1OSV
  • xinference, PyPI0.11.3OSV
  • xinference, PyPI0.12.0OSV
  • xinference, PyPI0.12.1OSV
  • xinference, PyPI0.12.2OSV
  • xinference, PyPI0.12.2.post1OSV
  • xinference, PyPI0.12.3OSV
  • xinference, PyPI0.13.0OSV
  • xinference, PyPI0.13.1OSV
  • xinference, PyPI0.13.2OSV
  • xinference, PyPI0.13.3OSV
  • xinference, PyPI0.13.4OSV
  • xinference, PyPI0.14.0OSV
  • xinference, PyPI0.14.0.post1OSV
  • xinference, PyPI0.14.1OSV
  • xinference, PyPI0.14.1.post1OSV
  • xinference, PyPI0.14.2OSV
  • xinference, PyPI0.14.3OSV
  • xinference, PyPI0.14.4OSV
  • xinference, PyPI0.14.4.post1OSV
  • xinference, PyPI0.15.0OSV
  • xinference, PyPI0.15.1OSV
  • xinference, PyPI0.15.2OSV
  • xinference, PyPI0.15.3OSV
  • xinference, PyPI0.15.4OSV
  • xinference, PyPI0.16.0OSV
  • xinference, PyPI0.16.1OSV
  • xinference, PyPI0.16.2OSV
  • xinference, PyPI0.16.3OSV
  • xinference, PyPI0.2.0OSV
  • xinference, PyPI0.2.1OSV

References 5