/

CVE-2026-76841

Severity:

HIGH RISK

(8.8)

Code Injection (CWE-94) in Xinference Model Loading

CVE-2026-76841

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Xinference enables Hugging Face remote model code execution unconditionally during several model-loading paths. A user with model-launch access may register a model with an attacker-controlled directory, causing Python code declared by the model configuration to execute with the worker process's privileges.

Affected context

The vulnerability occurs in Xinference deployments that load Hugging Face models through affected reranking, embedding, or Transformers-based language-model paths. Risk is present when a caller can launch a model using an arbitrary or untrusted model path and the loader processes model metadata that enables custom Python components without an explicit trust decision.

Exploit preconditions

  • Attack surface: Xinference model-launch and model-loading interfaces
  • Required access: Permission to register or launch a model and provide its model path or configuration
  • Trigger point: Hugging Face tokenizer, component, or model loading
  • Why exploitation is possible: Affected call sites enable trust_remote_code unconditionally, allowing model metadata to direct the loader to import Python code from the model directory

Why this happens

The underlying bug is an unsafe trust-boundary decision in model loading. Several Xinference call sites pass trust_remote_code=True or use an unconditional default, so code supplied by a model repository is treated as trusted executable logic rather than untrusted model data.

This behavior maps to CWE-94: Improper Control of Generation of Code, because attacker-influenced model metadata can cause Python modules to be imported and executed without an effective authorization or policy check.

Potential impact

  • An attacker could execute arbitrary Python code in the worker process
  • The worker environment could be modified or compromised
  • Model-serving credentials or locally accessible secrets may be exposed
  • The attacker could alter model outputs or poison inference behavior
  • Compromised workers could be used for lateral movement, subject to deployment privileges

General mitigation guidance

Mitigation generally focuses on making execution of model-supplied code an explicit, restricted choice rather than a default behavior.

Common defensive patterns include:

  • Disable remote model code execution by default and require an explicit policy-controlled opt-in
  • Permit custom code only for an allowlisted set of reviewed, bundled, or otherwise trusted models
  • Restrict model-launch users from supplying arbitrary paths or unapproved repositories
  • Validate model metadata and separate model data from executable components
  • Run model workers with least-privilege identities, isolated filesystems, and limited network access
  • Treat model artifacts as untrusted supply-chain inputs and verify their provenance before deployment

How teams detect issues like this

Organizations can detect this class of issue through:

  • Static analysis searches for literal trust_remote_code=True values and unconditional defaults
  • Code review checks for model-loading APIs that import repository-provided Python modules
  • Policy enforcement that rejects unapproved remote-code execution settings or repositories
  • Runtime monitoring for unexpected Python imports, subprocess creation, filesystem changes, or outbound connections from model workers
  • Configuration audits confirming that model-launch permissions and remote-code policies are independently controlled
  • Automated security review tools that flag unsafe trust-boundary settings in dependency and model-loading code

Sources

SourceLink
github.comgithub.com/xorbitsai/inference
github.comgithub.com/xorbitsai/inference/blob/v2.11.0/xinference/model/rerank/core.py
github.comgithub.com/xorbitsai/inference/issues/5023
github.comgithub.com/xorbitsai/inference/pull/5027
vulncheck.comvulncheck.com/advisories/xinference-through-remote-code-execution-via-hardcoded-trust-remote-code-in-model-loaders

Frequently asked

questions

It can be exploitable through a network-accessible Xinference service when an attacker has permission to launch models and can cause an untrusted model directory or repository to be loaded. The exact exposure depends on service authentication and deployment configuration.

The key requirement is model-launch access or another capability that permits registering a model and supplying an attacker-controlled path or model source. Mere access to inference requests may not be sufficient.

Make remote code execution opt-in, disabled by default, and restricted to reviewed or bundled models through an explicit allowlist and policy-controlled setting.

Treat model artifacts as untrusted code, review their metadata and provenance, enforce least privilege for workers, and continuously monitor model-loading behavior for unexpected imports or process activity.

Find out what's already
exploitable in your codebase.