Advisory

GHSA-9xq9-36w5-q796

Details, part 2 of 2. The advisory

Details

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.

Severity

CVSS v3.1 AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H — Base 7.8 High.

  • AV:L — local (the user runs lmdeploy on their own host).
  • AC:L — single command.
  • PR:N — no privilege.
  • UI:R — user must invoke lmdeploy with the malicious repo. Minor qualifier: many users will type lmdeploy serve api_server <repo> trusting that lmdeploy implements basic safety.
  • C:H, I:H, A:H — full RCE on the user's machine; can read ~/.aws/credentials, exfiltrate data, persist, etc.

If the lmdeploy host is a multi-tenant inference platform (e.g. a
cloud provider running lmdeploy as a service for multiple paying
customers), the attack changes shape: any tenant who can pin a
custom model name in their tenancy gets RCE on the inference host
and scope changes to S:C with cross-tenant impact. CVSS rises
to 9.6+. We are not claiming this dimension here without
runtime evidence; just flagging it for triage.

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

  1. Submit privately via lmdeploy security contact (typically email or GitHub Security Advisory at https://github.com/InternLM/lmdeploy/security/advisories/new).
  2. Reference Hugging Face Transformers' historical opt-out → opt-in change as precedent for the fix shape.
  3. 90-day coordinated-disclosure window starting from acknowledgement.
  4. 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.

Sources & licences