CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-61539

CVE-2026-61539: Remote Code Execution via Llama3 Tool Parser Eval Injection in Xinference

Alon Barad
Alon Barad
Software Engineer

Aug 22, 2026·6 min read·4 visits

Executive Summary (TL;DR)

Unsafe use of Python's eval() in Xinference's Llama3 tool parser enables unauthenticated remote code execution via prompt injection. Upgrading to version 2.7.0 mitigates this risk by replacing eval() with json.loads() and ast.literal_eval().

CVE-2026-61539 is a critical remote code execution vulnerability in Xinference, an inference API framework for open-source LLMs. In version 2.5.0 and earlier, model-generated outputs representing Llama3 tool calls are passed directly to Python's built-in eval() function inside the parser components. By manipulating conversational input or injecting instructions, an attacker can influence the LLM to output a Python expression containing malicious system commands, resulting in unauthenticated remote code execution on the host. This vulnerability has been resolved in Xinference version 2.7.0.

Vulnerability Overview

Xinference is an open-source inference API framework designed for serving Large Language Models (LLMs), speech models, and multimodal models. In deployments running Llama3 models with tool calling enabled, the framework is exposed to a critical security flaw. Specifically, the component parsing model outputs handles tool call data unsafely.

The attack surface is accessible via the standard chat completion endpoints. When client requests prompt the model to invoke tools, the application processes the generated assistant response to extract tool arguments. Because the framework does not sanitize the string generated by the LLM before interpreting it, this architectural pattern creates an indirect pathway for executing operating system commands.

The vulnerability is classified under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code. This issue allows unauthenticated remote attackers who can influence the LLM's output—either via direct API access or downstream prompt injection—to achieve code execution within the security context of the Xinference server process.

Root Cause Analysis

The root cause of CVE-2026-61539 resides in the dynamic interpretation of structured text using Python's built-in eval() function. When processing Llama3 tool calls, Xinference attempts to parse the text representation of a Python dictionary returned by the model. The application invokes eval(model_output, {}, {}) with the intent of converting the string into a native dictionary object.

While the developers passed empty dictionaries as the globals and locals arguments to restrict execution, this implementation does not establish a secure sandbox in Python. Python's runtime environment allows standard object attributes to be traversed to retrieve the built-in namespace. For example, expressions can utilize property accessors on basic literal objects, such as ().__class__.__bases__[0].__subclasses__(), to locate and invoke dangerous classes like subprocess.Popen or direct file handles.

Since Large Language Models generate text based on input prompts, the string passed to eval() is not entirely under the developer's control. An attacker can craft conversational inputs that influence or override the system instructions of the model. By manipulating the LLM into generating a Python expression containing malicious system calls instead of a valid JSON dictionary, the attacker triggers immediate execution of that payload when the server evaluates the generated string.

Code Analysis

The vulnerable logic was present in two locations within the codebase: extract_tool_calls in xinference/model/llm/tool_parsers/llama3_tool_parser.py and _eval_llama3_chat_arguments in xinference/model/llm/utils.py. In both cases, the raw model output was evaluated directly using the native eval() sink.

Below is the vulnerable implementation in llama3_tool_parser.py:

# Vulnerable code pattern
def extract_tool_calls(self, model_output: str):
    try:
        # DANGEROUS: Executes arbitrary code contained within model_output
        data = eval(model_output, {}, {})
        return [(None, data["name"], data["parameters"])]
    except Exception:
        return [(model_output, None, None)]

The corresponding patch replaces the dynamic interpreter sink with a secure parsing sequence using json.loads as the primary mechanism, and falling back to ast.literal_eval for Python-specific dictionary literals.

# Patched code implementation
try:
    # Try JSON first (most common LLM output format)
    data = json.loads(model_output)
except (json.JSONDecodeError, TypeError):
    try:
        # Fall back to ast.literal_eval for Python literal formats
        # Unlike eval(), ast.literal_eval() only parses literal structures
        data = ast.literal_eval(model_output)
    except (ValueError, SyntaxError):
        return [(model_output, None, None)]

Using ast.literal_eval secures the application because the Abstract Syntax Tree parser processes only standard Python constants (such as strings, numbers, tuples, lists, dictionaries, booleans, and None). If the input contains a function call, class instantiation, or module import, the parser raises a ValueError immediately instead of compiling and executing the code.

Exploitation Methodology

Exploitation of this vulnerability requires the attacker to submit a request to the chat completion API that forces the LLM to output a malicious Python expression. The endpoint /v1/chat/completions must be configured to utilize tools, which registers the Llama3 tool parser as the active parser for the session.

The attacker constructs a system or user message using prompt injection techniques designed to bypass the model's instructions. The objective is to instruct the model to ignore its tool formatting constraints and output a specific Python command string. A conceptual payload instruction might command the model to generate a response like __import__('os').system('id') instead of the expected dictionary.

When the LLM yields the malicious response, the Xinference server intercepts the string and passes it directly to extract_tool_calls. The server then executes the string via eval(). Because the execution occurs under the permissions of the Xinference daemon, this leads to system command execution on the host container or server, facilitating unauthorized access or control.

Impact Assessment

The security impact of CVE-2026-61539 is categorized as critical, receiving a CVSS v3.1 base score of 10.0. The exploit allows unauthenticated network-based attackers to execute arbitrary system commands, compromising the confidentiality, integrity, and availability of the host operating system.

Because the scope is changed (S:C), an exploit not only compromises the logical environment of the Python application but also allows the attacker to execute commands in the underlying container or host operating system. This capability permits attackers to access sensitive data, including model weights, API keys for upstream services, and database credentials stored on the server.

Furthermore, if the Xinference container is deployed with high privileges or lacks proper network isolation, attackers can leverage the initial foothold to pivot into internal networks, escalate privileges on the host system, or disrupt inference services entirely.

Remediation and Defense

The primary mitigation for this vulnerability is upgrading the Xinference installation to version 2.7.0 or later. This release replaces the vulnerable dynamic evaluation patterns with a safe combination of json.loads and ast.literal_eval, neutralizing the execution path entirely.

If upgrading is not immediately possible, administrators can apply manual modifications to llama3_tool_parser.py and utils.py by replacing the eval() statements with the safe parsing implementation shown in the patch details. Additionally, organizations should implement defense-in-depth measures to limit the potential impact of similar flaws.

API endpoints should be shielded from the open internet using reverse proxies and robust access control policies such as API keys or JWT authentication. Finally, the Xinference service must run under a dedicated, unprivileged operating system user account, and the container should use a read-only root file system with minimal system binaries to limit the impact of arbitrary command execution.

Official Patches

xorbitsaiOfficial pull request to mitigate eval parsing in Llama3 tool parser
xorbitsaiCore fix commit replacing eval with json.loads and ast.literal_eval

Technical Appendix

CVSS Score
10.0/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Affected Systems

xorbitsai/inference (Xinference) API Service

Affected Versions Detail

Product
Affected Versions
Fixed Version
inference
xorbitsai
<= 2.5.02.7.0
AttributeDetail
CWE IDCWE-95
Attack VectorNetwork
CVSS Score10.0
ImpactArbitrary Code Execution
Exploit StatusProof-of-Concept
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1203Exploitation for Client Execution
Execution
CWE-95
Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')

The product receives input from an upstream component, but does not neutralize or incorrectly neutralizes code syntax elements before treating the input as an executable instruction, enabling an attacker to execute arbitrary code.

Known Exploits & Detection

GitHub Security AdvisoryDetails explaining prompt injection vector triggering python eval function execution.

Vulnerability Timeline

GitHub Security Advisory Published
2026-08-21
CVE-2026-61539 assigned and updated on NVD
2026-08-21

References & Sources

  • [1]GitHub Security Advisory GHSA-x2rj-828p-hx9m
  • [2]NVD CVE-2026-61539 Detail Entry
  • [3]CVE Org Record CVE-2026-61539
  • [4]Xinference v2.7.0 Release Notes

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•16 minutes ago•CVE-2026-59989
9.2

CVE-2026-59989: Remote Code Execution via Server-Side Template Injection in Phalcon Volt Engine

A critical server-side template injection (SSTI) vulnerability exists in the Volt template engine of the Phalcon PHP framework. In versions 5.15.0 and earlier, raw AST token values for filter arguments in the 'join' filter are directly spliced into the generated PHP template code. This allows an attacker who can influence Volt templates to execute arbitrary PHP code during template rendering.

Amit Schendel
Amit Schendel
0 views•5 min read
•about 2 hours ago•CVE-2026-77354
8.7

CVE-2026-77354: Uncontrolled Resource Consumption (OOM) via Sparse Array Indexes in kin-openapi

An uncontrolled resource consumption vulnerability (CWE-400/CWE-789) exists within the kin-openapi Go library prior to version 0.142.0. The vulnerability occurs during the processing of highly sparse array indexes inside query parameters defined in deepObject style. An unauthenticated remote attacker can exploit this flaw to cause an immediate Out-of-Memory (OOM) crash of the target application.

Amit Schendel
Amit Schendel
2 views•8 min read
•about 3 hours ago•CVE-2026-77413
9.3

CVE-2026-77413: Remote Code Execution via Prototype Chain Bypass in JSONata Evaluator

A critical prototype pollution and sandbox escape vulnerability was discovered in the JSONata query and transformation library before versions 1.8.8 and 2.2.0. By providing a malicious JSONata expression that bypasses ownership checks on object properties, remote attackers can execute arbitrary code in the context of the host Node.js application.

Alon Barad
Alon Barad
2 views•6 min read
•about 4 hours ago•CVE-2026-63135
8.2

CVE-2026-63135: Stored Cross-Site Scripting (XSS) via Referer Header in YOURLS

CVE-2026-63135 is a critical stored Cross-Site Scripting (XSS) vulnerability affecting YOURLS (Your Own URL Shortener) versions 1.5.1 up to (but not including) 1.10.4. Unauthenticated remote attackers can inject malicious JavaScript arrays by crafting an HTTP Referer header sent to a short URL redirect. This value is saved in the database logs and executed without context-aware escaping when an administrative user views the corresponding statistics visualization page.

Amit Schendel
Amit Schendel
2 views•6 min read
•about 5 hours ago•CVE-2026-68508
7.8

CVE-2026-68508: Arbitrary Code Execution via Unsafe Dynamic Instantiation in Hydra Core

CVE-2026-68508 is a high-severity arbitrary code execution vulnerability in facebookresearch/hydra (hydra-core) prior to version 1.3.4. The vulnerability exists within the dynamic instantiation system hydra.utils.instantiate(), which resolves and executes arbitrary Python callables from configuration files. An attacker capable of submitting untrusted configurations can achieve arbitrary code execution in the context of the consuming process.

Alon Barad
Alon Barad
5 views•7 min read
•about 6 hours ago•CVE-2026-77415
9.3

CVE-2026-77415: Sandbox Escape and Arbitrary Code Execution in JSONata Engine

A critical sandbox escape vulnerability in JSONata versions prior to 1.8.8 and 2.2.1 allows unauthenticated remote attackers to execute arbitrary code on the host machine. By submitting crafted JSONata expressions, an attacker can manipulate internal AST structures, bypass object clone helpers, spoof native function flags, and escape the evaluation environment to execute system commands through the Node.js runtime.

Alon Barad
Alon Barad
10 views•6 min read