VAITP Dataset

← Back to the dataset

CVE-2026-76841

Xinference enables remote code execution via HuggingFace models by default.

  • CVSS 8.7
  • CWE-94
  • Configuration Issues
  • Remote

Xinference loads models with Hugging Face remote code execution unconditionally enabled, and before version 2.12.0 exposes no setting to disable it. Six loader call sites pass trust_remote_code=True as a literal or as an unconditional default: RerankModel._get_tokenizer in xinference/model/rerank/core.py, SentenceTransformerRerankModel.load in xinference/model/rerank/sentence_transformers/core.py, SentenceTransformerEmbeddingModel.load in xinference/model/embedding/sentence_transformers/core.py, FlagEmbeddingModel.load in xinference/model/embedding/flag/core.py, and two sites in xinference/model/llm/transformers/core.py where PytorchModel._sanitize_model_config and PytorchModel._get_components default the value to True. Because a caller with model launch access can register a model whose type is unknown and supply an arbitrary model path, the server reaches _auto_detect_type and then AutoTokenizer.from_pretrained, which imports and executes Python declared by the model directory's own tokenizer_config.json auto_map, running attacker-supplied code with the privileges of the worker process. Version 2.12.0 gates every site behind allow_trust_remote_code and the XINFERENCE_TRUST_REMOTE_CODE setting, permitting remote code only for bundled built-in models.

CVSS base score
8.7
Published
2026-08-24
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Configuration Issues
Subcategory
Remote File Inclusion (RFI)
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
Xinference
Fixed by upgrading
Yes

Solution

Upgrade Xinference to v2.12.0 or newer, which adds the allow_trust_remote_code gate and disables trust_remote_code by default.

Vulnerable code sample

import os
from transformers import AutoTokenizer, AutoModel

class ModelLoader:
    def __init__(self, model_path: str):
        self.model_path = model_path

    def load(self):
        # VULNERABLE: remote code execution enabled
        tokenizer = AutoTokenizer.from_pretrained(self.model_path, trust_remote_code=True)
        model = AutoModel.from_pretrained(self.model_path, trust_remote_code=True)
        return tokenizer, model

Patched code sample

import os
from transformers import AutoTokenizer, AutoModel

class ModelLoader:
    def __init__(self, model_path: str, allow_trust_remote_code: bool = False):
        self.model_path = model_path
        self.allow_trust_remote_code = allow_trust_remote_code

    def load(self):
        # FIX: respect allow_trust_remote_code flag
        tokenizer = AutoTokenizer.from_pretrained(
            self.model_path,
            trust_remote_code=self.allow_trust_remote_code
        )
        model = AutoModel.from_pretrained(
            self.model_path,
            trust_remote_code=self.allow_trust_remote_code
        )
        return tokenizer, model

Cite this entry

@misc{vaitp:cve202676841,
  title        = {{Xinference enables remote code execution via HuggingFace models by default.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-76841},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-76841/}}
}

Download this entry as JSON Download the whole dataset

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

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.