HIGH 7.5

CVE-2026-41523: vLLM Remote Code Execution via Malicious HuggingFace Model

vLLM, a popular open-source inference engine for large language models, contains a critical vulnerability in versions before 0.22.0 that allows attackers to execute arbitrary code on affected servers. The vulnerability exploits a flawed security check in the activation function loader and can be triggered when vLLM runs in Python optimized mode (using the -O flag or PYTHONOPTIMIZE environment variable). An attacker can exploit this by publishing a malicious model to HuggingFace that, when loaded by vLLM, executes arbitrary code on the host. No authentication is required, and the attack requires only that a user interact with the malicious model.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.5 HIGH · CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
Weaknesses (CWE)
CWE-617, CWE-94
Affected products
1 configuration(s)
Published / Modified
2026-06-22 / 2026-07-15

NVD description (verbatim)

vLLM is an inference and serving engine for large language models (LLMs). Prior to 0.22.0, an assert-based security check in vLLM's activation function loading allows any unauthenticated attacker to achieve arbitrary code execution on the server by publishing a malicious HuggingFace model, when vLLM runs in Python optimized mode (python -O or PYTHONOPTIMIZE=1). This vulnerability is fixed in 0.22.0.

8 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability resides in vLLM's activation function loading mechanism, which uses an assert statement as a security control. In Python optimized mode (-O or PYTHONOPTIMIZE=1), assert statements are stripped at bytecode compilation, disabling the intended validation. This allows a maliciously crafted HuggingFace model to bypass the activation function check and achieve remote code execution. The issue is classified under CWE-617 (Reachable Assertion) and CWE-94 (Improper Control of Generation of Code), reflecting the misuse of assertions as a security boundary and the unsafe dynamic code execution pathway. The CVSS 3.1 score of 7.5 (HIGH) reflects network-accessible exploitation, but high attack complexity due to the requirement for Python optimized mode and user interaction.

Business impact

Organizations deploying vLLM for LLM inference services face significant risk. Compromise of a vLLM server could result in complete loss of confidentiality, integrity, and availability of the model serving infrastructure. Attackers could exfiltrate sensitive data, modify model outputs, launch lateral attacks into downstream systems, or disrupt service availability. The risk is heightened in multi-tenant environments where untrusted users may request model downloads, and in automated pipelines that fetch models without human review. Reputational damage and compliance violations (e.g., under data protection regulations) are also concerns if customer data is exposed through a compromised inference endpoint.

Affected systems

vLLM versions prior to 0.22.0 are vulnerable when run with Python optimization flags enabled. Systems at risk include standalone vLLM deployments, containerized instances launched with python -O, and cloud environments where PYTHONOPTIMIZE=1 is set. Organizations using vLLM in standard Python mode (without optimization) are not directly vulnerable to this exploit, though they should upgrade to 0.22.0 for defense-in-depth. The vulnerability requires the vLLM process to load a malicious HuggingFace model, so risk is proportional to the number of external or untrusted models accessed.

Exploitability

Exploitation requires three conditions: (1) vLLM running in Python optimized mode, (2) loading of a malicious HuggingFace model (either via user request or automated pipeline), and (3) user interaction (e.g., triggering model download or inference). The attack complexity is high because it depends on the Python optimization flag being enabled, which is not the default in most deployments. However, some organizations enable optimization for performance reasons, and the attack surface is large given the ease of publishing models to HuggingFace. The CVSS vector (AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H) correctly reflects network accessibility, high complexity, no privilege requirement, and user interaction. Once code execution is achieved, the attacker operates with the privileges of the vLLM process.

Remediation

Upgrade vLLM to version 0.22.0 or later immediately. This release includes a fix that replaces the assert-based check with a proper runtime validation that functions correctly regardless of Python optimization flags. Organizations unable to upgrade immediately should disable Python optimization flags on vLLM deployments (do not use python -O or set PYTHONOPTIMIZE=1) and restrict model sources to a curated, trusted whitelist of HuggingFace models. Implement model signature verification and conduct code review of activation functions before loading external models in high-risk environments.

Patch guidance

Update vLLM to 0.22.0 or later through your package manager (pip install --upgrade vllm or equivalent). Verify the upgrade by checking vllm.__version__ in a test environment. For containerized deployments, rebuild images with the patched version and redeploy. For managed services, contact your provider to confirm patch status. After patching, no configuration changes are needed; the fix is transparent. Test inference pipelines in a staging environment before production rollout to ensure compatibility.

Detection guidance

Monitor for vLLM processes running with Python optimization flags (check PYTHONOPTIMIZE environment variable and command-line arguments). Audit HuggingFace model access logs and API calls to identify which models are being loaded. Implement network monitoring to detect unusual outbound connections from vLLM servers, as post-exploitation activity may involve exfiltration or lateral movement. Scan vLLM deployment configurations and startup scripts to ensure optimization flags are not enabled. Use software inventory tools to identify vLLM installations running versions prior to 0.22.0. Monitor system logs for unexpected process execution spawned by the vLLM process.

Why prioritize this

Despite a CVSS score of 7.5, this vulnerability warrants rapid patching due to the combination of network accessibility, no authentication requirement, and potential for complete system compromise. The exploit path is practical for attackers with access to model publishing platforms, and the impact scope extends to downstream systems. Organizations running vLLM in optimized mode should treat this as critical. Even those in standard mode should prioritize 0.22.0 adoption to eliminate future risk from configuration drift or accidental optimization flag introduction.

Risk score, explained

The CVSS 3.1 score of 7.5 (HIGH) reflects: network-accessible attack vector (AV:N), high attack complexity due to Python optimization requirement (AC:H), no privilege requirement (PR:N), and the need for user interaction such as requesting model load (UI:R). Impact is severe: confidentiality, integrity, and availability are all fully compromised (C:H/I:H/A:H). The scope is unchanged (S:U), as compromise of the vLLM process does not inherently elevate impact to other systems, though lateral movement is possible post-exploitation. The score appropriately reflects that while the vulnerability is serious, the optimization flag requirement reduces real-world exploitation likelihood compared to a vulnerability exploitable in default configurations.

Frequently asked questions

Does this vulnerability affect vLLM running in default Python mode?

No, the vulnerability requires Python optimization mode to be explicitly enabled via the -O flag or PYTHONOPTIMIZE environment variable. Default vLLM installations without these flags are not vulnerable to this specific exploit path, as the assert statement functions normally in standard Python mode. However, upgrading to 0.22.0 is still recommended to eliminate the risk should optimization flags be accidentally introduced in future deployments.

What is the difference between Python optimized mode and standard mode for vLLM?

When Python runs with optimization enabled (python -O or PYTHONOPTIMIZE=1), it skips assert statements and optimizes bytecode for performance. This removes the security check in vLLM's activation function loader. Standard mode preserves all assert statements and provides the intended validation. Optimization mode is sometimes used in production for performance, but it comes with security trade-offs. The patch in 0.22.0 uses proper runtime validation instead of assertions, so optimization mode is no longer a vulnerability vector.

If I upgrade to 0.22.0, do I need to change my vLLM configuration?

No, the patch is transparent and requires no configuration changes. Simply upgrade the package, and the improved security validation will be active immediately. You may continue running vLLM with or without Python optimization flags; the vulnerability is eliminated in both cases. Test the upgrade in a non-production environment first to ensure compatibility with your specific models and workflows.

How would an attacker publish a malicious model to exploit this?

An attacker would create a malicious model file with weaponized activation functions and publish it to HuggingFace under a benign-sounding name, or compromise an existing popular model. When a vLLM instance loads that model (either because a user requests it or it is in an automated pipeline), the activation function validation is bypassed in optimized mode, allowing the malicious code to execute. The attacker has no need for credentials or direct access; exploitation occurs purely through the model loading mechanism.

This analysis is provided for informational purposes and reflects publicly available information as of the publication and modification dates listed. Security vulnerabilities are subject to change as vendors release patches and additional details emerge. Organizations should verify all patch version numbers and remediation steps directly against official vendor advisories and release notes before deploying patches. This assessment does not constitute professional security advice tailored to your specific infrastructure or risk profile; consult with your security team or a qualified security consultant for guidance applicable to your environment. References to exploitation techniques are for defensive understanding only; unauthorized access to computer systems remains illegal. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).