/

CVE-2026-41523

Severity:

HIGH RISK

(7.5)

Code Injection (CWE-94) in vLLM Model Activation Loader

CVE-2026-41523

Modified

Vulnerability type

Category:

Code Injection

CWE:

CWE-94, CWE-617

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A code injection flaw in vLLM's activation function loading allows arbitrary Python code execution when loading specially crafted HuggingFace models.

When vLLM runs in Python optimized mode and relies on assert-based checks, an unauthenticated attacker can publish a malicious model that, once loaded by the server, executes attacker-controlled code.

Affected context

The vulnerability appears in deployments that use vLLM as an inference or serving engine and load activation functions from HuggingFace-hosted models.

It becomes relevant when the server process is started with Python optimizations enabled (for example, using python -O or PYTHONOPTIMIZE=1), because this disables assert statements used as a security check.

In such environments, any model that the server pulls and loads from a remote repository may be able to supply executable Python code through its activation logic.

Exploit preconditions

  • Attack surface: Model loading pipeline for HuggingFace (or similarly sourced) models in vLLM.
  • Required access: Ability to publish or control a model artifact that the target vLLM instance will subsequently load; no direct authentication to the vLLM server itself is required.
  • Trigger point: The moment vLLM loads and initializes model activation functions from the malicious model under Python optimized mode.
  • Why exploitation is possible: Security validation relies on assert statements, which are removed when Python optimization is enabled, allowing unvalidated, attacker-supplied activation code to execute.

Why this happens

The core issue is reliance on assert statements as a security boundary around dynamic code loading for activation functions.

Under Python optimized mode, assert statements are stripped, effectively disabling the intended safety check and turning the model activation loading path into a generic code execution sink.

This aligns with CWE-94: Improper Control of Generation of Code, because external model content can influence what Python code gets executed, and with CWE-617: Reachable Assertion, because assertions meant to protect the code path can be bypassed by configuration (optimization flags).

Potential impact

  • An attacker-controlled model may execute arbitrary Python code in the vLLM server process.
  • The attacker could access or exfiltrate sensitive in-memory data (such as prompts, responses, or secrets cached in the process).
  • The attacker may tamper with model outputs, causing misinformation, data poisoning, or biased behavior.
  • The attacker could use the compromised process as a foothold for lateral movement in the hosting environment.

General mitigation guidance

Mitigation typically focuses on removing implicit trust in model-supplied code and avoiding assertions as security controls.

Useful patterns include:

  • Treat dynamically loaded model artifacts (including activation functions) as untrusted input and avoid executing embedded code where possible.
  • Replace assert-based checks with explicit runtime validations that cannot be disabled by interpreter flags.
  • Introduce strict whitelisting or schema-based validation for which components of a model can influence execution paths.
  • Run inference services with least-privilege OS accounts and restricted file system and network permissions to limit blast radius if code is executed.
  • Isolate model execution in constrained environments (such as containers, sandboxes, or separate worker processes) to reduce impact.

How teams detect issues like this

Detection approaches can focus on both code and runtime behavior:

  • Use static analysis or linters to flag reliance on assert for security checks and to identify dynamic code loading from model artifacts.
  • During code review, look for logic that uses assert to enforce security invariants, especially around plugin systems, extensions, or model hooks.
  • Apply CI policies that fail builds when security-sensitive modules contain reachable assertions or eval/exec-style patterns tied to external inputs.
  • At runtime, monitor model-loading logs and telemetry for unusual activation definitions or models sourced from untrusted publishers.

Sources

SourceLink
github.comgithub.com/vllm-project/vllm/commit/b3c7ffcab82c2439726f8cb213800f6f38c023d3
github.comgithub.com/vllm-project/vllm/security/advisories/GHSA-q8gq-377p-jq3r
huntr.comhuntr.com/bounties/dcb05b04-e625-41e7-adbc-bbae0cc2d64c
access.redhat.comaccess.redhat.com/errata/RHSA-2026:36005
access.redhat.comaccess.redhat.com/errata/RHSA-2026:36006
access.redhat.comaccess.redhat.com/errata/RHSA-2026:57380
access.redhat.comaccess.redhat.com/errata/RHSA-2026:57387
access.redhat.comaccess.redhat.com/errata/RHSA-2026:57389
access.redhat.comaccess.redhat.com/errata/RHSA-2026:57390
access.redhat.comaccess.redhat.com/errata/RHSA-2026:59138
access.redhat.comaccess.redhat.com/errata/RHSA-2026:59139
access.redhat.comaccess.redhat.com/errata/RHSA-2026:59144
access.redhat.comaccess.redhat.com/errata/RHSA-2026:59151
access.redhat.comaccess.redhat.com/errata/RHSA-2026:61627
access.redhat.comaccess.redhat.com/errata/RHSA-2026:61629
access.redhat.comaccess.redhat.com/errata/RHSA-2026:62335
access.redhat.comaccess.redhat.com/errata/RHSA-2026:62336
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-41523
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2491582
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-41523.json

Frequently asked

questions

Yes, if a vLLM deployment automatically loads models from remote sources such as HuggingFace, an attacker can remotely trigger code execution by publishing and causing the service to load a malicious model, provided Python optimized mode is enabled.

The attacker must be able to publish or control a model that the vLLM server will load, but does not need direct shell access or authentication to the server itself; control over the model supply chain is sufficient.

Replace assert-based security checks with explicit validation logic that cannot be disabled by interpreter flags, and ensure that activation or hook loading does not execute arbitrary model-supplied code.

Avoid using assertions as security boundaries, treat all externally sourced model components as untrusted input, and enforce defense-in-depth: strong validation, minimal privileges for inference services, and isolation or sandboxing of any dynamically loaded execution paths.

Find out what's already
exploitable in your codebase.