CVE-2026-61539: Xinference Remote Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-x2rj-828p-hx9m
CVSS 10.0
CWE-95
Published
Advisory Summary

CVE-2026-61539 is a CRITICAL (CVSS 10.0) remote code execution vulnerability (CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')) affecting Xinference libraries in the PyPI ecosystem. The issue involves xinference vulnerable to remote code execution via unsafe `eval()` in llama3 tool-call parsing. Remediation is available by upgrading affected packages to version 2.7.0.

CVE-2026-61539 at a Glance

CVE Identifier CVE-2026-61539
GHSA Identifier GHSA-x2rj-828p-hx9m
Severity CRITICAL
CVSS v3.1 Base Score 10.0
CWE Classification CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')
Affected Product Xinference
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 10.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-61539

To remediate this vulnerability, upgrade all affected Xinference dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

xinference fixed: 2.7.0
pip install xinference>=2.7.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show xinference

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-61539, inspect your installed packages using pip:

pip show xinference

Analyze the terminal output to locate any version of Xinference in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.7.0), your application is affected.

Note: The pip show xinference command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection'), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before using the input in a dynamic evaluation call (e.g. "eval"). In Xinference, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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()`: ```python 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: ```python __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)

CVE-2026-61539 Affected Xinference Versions

1 component(s)
Fixed Versions:
2.7.0
Product / Package Ecosystem Affected Versions Fixed Version
xinference
PyPI
< 2.7.0
2.7.0

References

Frequently Asked Questions

What is CVE-2026-61539?
CVE-2026-61539 is a security vulnerability in Xinference involving Xinference vulnerable to remote code execution via unsafe `eval()` in Llama3 tool-call parsing under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection').
Which Xinference versions are affected?
Affected versions include releases prior to 2.7.0 across affected packages: xinference.
What version fixes CVE-2026-61539?
Upgrading to 2.7.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is xinference affected?
Yes, xinference is affected in releases prior to 2.7.0. Upgrade your dependency to 2.7.0 or later.
What is the CVSS score of CVE-2026-61539?
CVE-2026-61539 has a CVSS v3.1 base score of 10.0 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2026-61539?
CVE-2026-61539 is classified under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection') (The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before using the input in a dynamic evaluation call (e.g. "eval").).
How can I check PyPI dependencies for CVE-2026-61539?
Run the dependency tree command: 'pip show xinference'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-x2rj-828p-hx9m",
  "modified" : "2026-08-21T20:56:37Z",
  "published" : "2026-08-21T20:56:37Z",
  "aliases" : [ "CVE-2026-61539" ],
  "summary" : "Xinference vulnerable to remote code execution via unsafe `eval()` in Llama3 tool-call parsing",
  "details" : "### 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)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "xinference"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.7.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.5.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/xorbitsai/inference/security/advisories/GHSA-x2rj-828p-hx9m"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/xorbitsai/inference/pull/4786"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/xorbitsai/inference/commit/1b3d220f342ce68d34cec4586d9409d457dadc42"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/xorbitsai/inference"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/xorbitsai/inference/releases/tag/v2.7.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-95" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-21T20:56:37Z",
    "nvd_published_at" : null
  }
}