🛡️ CVE-2026-46432 — lmdeploy

🟠 CVSS 8.0 — High ✅ No Known Exploit CWE-94 NVD
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

LMDeploy: Arbitrary code execution via hardcoded trust_remote_code=True in lmdeploy model initialization

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

```

3. The lmdeploy serving process starts with that model path:

```bash

lmdeploy serve api_server attacker-org/malicious-model

```

4. During model initialization, lmdeploy calls HuggingFace Transformers APIs with trust_remote_code=True.

5. Transformers loads and executes remote Python code from the attacker-controlled model repository.

6. 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()

How this vulnerability can be exploited

This issue can be reached with local access to the system, attack complexity is low, an attacker needs low-level privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality high, integrity high, availability high.

Weakness class

CVE-2026-46432 is classified as CWE-94: Code Injection. Input is incorporated into code that the runtime evaluates, so an attacker can have their own code executed.

Affected software

CVE-2026-46432 is recorded against 2 packages.

  • lmdeploy (fixed in 0.13.0)
  • unknown

Timeline and source

Published on 21 May 2026 and last revised on 13 July 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Package)

Details

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CWE CWE-94
Public Exploit ✅ No
Source NVD
Published 2026-05-21
Updated 2026-08-12
Modified 2026-07-13
Fix URL N/A

Affected Packages

Software From version Fixed in
lmdeploy 0.13.0
unknown

Similar Threats

Site Security Check

Is lmdeploy part of your stack?

CVE-2026-46432 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026