CVE-2026-41523: vLLM: Security Check Bypass via assert Statement in Activation Function Loading Allows Arbitrary Code Execution
vLLM before 0.22.0 guards which activation functions a model may load with a Python assert. When vLLM runs with python -O or PYTHONOPTIMIZE=1, the assert is removed, and a malicious cross-encoder model on HuggingFace can run arbitrary code on the server at load time. Upgrade to vLLM 0.22.0.
Published Jun 16, 2026 · Updated Sep 3, 2026 · Analysis Nov 2, 2026
What an attacker can do
In vllm/model_executor/layers/pooler/activations.py, get_act_fn() reads an activation function name from the model's config.json, from sentence_transformers["activation_fn"] or sbert_ce_default_activation_function. An assert function_name.startswith("torch.nn.modules.") is the only check. Python removes assert statements in optimized mode. The name then reaches resolve_obj_by_qualname(), which calls importlib.import_module and getattr on any module path, and the result is called.
An attacker publishes a model with a crafted config.json. A victim loads it with vLLM under python -O or PYTHONOPTIMIZE=1, using a cross-encoder architecture such as BERT or RoBERTa with sequence classification. Code runs during model initialization with the privileges of the vLLM process. The call sites are the SequencePooler and TokenPooler classes through resolve_classifier_act_fn().
The attack needs the victim to load the model, so the CVSS vector has user interaction and high complexity. The result is code execution on the inference server, which exposes model weights, API keys, cloud credentials and the host network. The advisory also notes that resolve_obj_by_qualname() is called from about 20 places with no validation of its own.
Who is affected
vLLM (pip package vllm) before 0.22.0. Exposure needs all of: optimized Python mode, a cross-encoder or classifier-style pooling model, and a model source you do not control. Check with:
pip show vllmThen check how the server starts, for example python -O in the command line or PYTHONOPTIMIZE set in the container or service environment. Without optimized mode, the assert still runs and rejects the name.
vllm
- Ecosystem
- PyPI
- Affected
- < 0.22.0
- Fixed in
- 0.22.0
- Check
pip show vllm
How to fix it
Upgrade to vllm 0.22.0:
pip install --upgrade "vllm>=0.22.0"The fix is commit b3c7ffc (PR #43286). It replaces the assert with an explicit check that raises ValueError, and it does the same for assert checks in vllm/pooling_params.py and vllm/v1/pool/metadata.py. Red Hat has also published errata for its vLLM builds.
The advisory names no other workaround. Not running vLLM with python -O or PYTHONOPTIMIZE=1 keeps the assert in place, and loading only models you have reviewed lowers the risk.
How to tell if you were hit
Check the process command line and environment of running vLLM servers for -O or PYTHONOPTIMIZE. Review which models were loaded and their config.json files for sentence_transformers.activation_fn or sbert_ce_default_activation_function values that do not start with torch.nn.modules. Look for unexpected child processes, outbound connections or file writes from the vLLM process right after a model load. Under normal python, a bad name fails with an AssertionError, or with ValueError after the fix, in the startup log.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
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).
Details
vLLM uses an assert statement at `vllm/model_executor/layers/pooler/activations.py:48` as its sole security control to restrict which activation functions can be loaded from a HuggingFace model's config.json:
# vllm/model_executor/layers/pooler/activations.py:35-53
function_name: str | None = None
if (
hasattr(config, "sentence_transformers")
and "activation_fn" in config.sentence_transformers
):
function_name = config.sentence_transformers["activation_fn"]
elif (
hasattr(config, "sbert_ce_default_activation_function")
and config.sbert_ce_default_activation_function is not None
):
function_name = config.sbert_ce_default_activation_function
if function_name is not None:
assert function_name.startswith("torch.nn.modules."), (
"Loading of activation functions is restricted to "
"torch.nn.modules for security reasons"
)
fn = resolve_obj_by_qualname(function_name)()Python's assert statements are stripped at compile time when running in optimized mode (python -O or PYTHONOPTIMIZE=1). When the assert is absent, the attacker-controlled function_name from the model's config.json is passed directly to `resolve_obj_by_qualname()` — an unrestricted import gadget:
def resolve_obj_by_qualname(qualname: str) -> Any:
module_name, obj_name = qualname.rsplit(".", 1)
module = importlib.import_module(module_name)
return getattr(module, obj_name)This is the same vulnerability class as CVE-2017-1000433 (pysaml2 assert-based auth bypass), flagged by Bandit B101 and Ruff S101, and the reason Django proactively replaced all assert-based security checks (ticket #32508).
Attacker-controlled input sources:
config.sentence_transformers["activation_fn"](line 40)config.sbert_ce_default_activation_function(line 45)
Affected call sites — get_act_fn() is called via resolve_classifier_act_fn() from:
vllm/model_executor/layers/pooler/seqwise/poolers.py:122— SequencePoolervllm/model_executor/layers/pooler/tokwise/poolers.py:130— TokenPooler
Broader systemic risk: resolve_obj_by_qualname is called from ~20 locations across the codebase with no validation of its own. Any future caller feeding user-controlled input to it without validation creates the same vulnerability class.
Suggested fix: Replace the assert with an explicit conditional raise:
if not function_name.startswith("torch.nn.modules."):
raise ValueError(
"Loading of activation functions is restricted to "
"torch.nn.modules for security reasons"
)Impact
Arbitrary code execution. A malicious model author publishes a HuggingFace model with a crafted config.json. When a victim loads this model with vLLM running under python -O or PYTHONOPTIMIZE=1, arbitrary code executes during model initialization with the privileges of the vLLM process.
The attack requires:
- Victim loads a malicious model from HuggingFace (user interaction)
- vLLM runs under
python -OorPYTHONOPTIMIZE=1(documented in production use) - Model uses a cross-encoder architecture (e.g. BERT or RoBERTa with sequence classification)
Coordinated disclosure note: This vulnerability was also reported via huntr.com on April 2, 2026 (https://huntr.com/bounties/dcb05b04-e625-41e7-adbc-bbae0cc2d64c). A GitHub Security Advisory was also filed because it is vLLM's stated preferred disclosure channel per SECURITY.md.
Fix
A fix for this was introduced in this commit: https://github.com/vllm-project/vllm/commit/b3c7ffcab82c2439726f8cb213800f6f38c023d3
Credited to pierreolivierbonin, jperezdealgaba.
Questions
- Is vLLM affected if I do not use python -O?
The advisory describes the bypass only when vLLM runs in optimized mode, python -O or PYTHONOPTIMIZE=1. Without it the assert runs and blocks the name. Upgrade anyway, since the check is not a reliable control.
- Does the attacker need access to my server?
No. They need you to load a model they published, typically from HuggingFace, with a cross-encoder architecture. That is why the CVSS vector has user interaction required.
- Which version fixes CVE-2026-41523?
vLLM 0.22.0. The fix commit b3c7ffc turns the assert into a ValueError.
References
Read for this analysis:
- https://github.com/vllm-project/vllm/security/advisories/GHSA-q8gq-377p-jq3r
- https://github.com/vllm-project/vllm/commit/b3c7ffcab82c2439726f8cb213800f6f38c023d3
- https://huntr.com/bounties/dcb05b04-e625-41e7-adbc-bbae0cc2d64c
- https://nvd.nist.gov/vuln/detail/CVE-2026-41523
- https://access.redhat.com/errata/RHSA-2026:36005
- https://access.redhat.com/errata/RHSA-2026:36006
- https://access.redhat.com/security/cve/CVE-2026-41523
- https://bugzilla.redhat.com/show_bug.cgi?id=2491582
- https://github.com/pypa/advisory-database/tree/main/vulns/vllm/PYSEC-2026-2300.yaml
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-41523.json
- https://access.redhat.com/errata/RHSA-2026:57380
- https://access.redhat.com/errata/RHSA-2026:57390
- https://access.redhat.com/errata/RHSA-2026:57387
- https://access.redhat.com/errata/RHSA-2026:57389
- https://access.redhat.com/errata/RHSA-2026:59151
- https://access.redhat.com/errata/RHSA-2026:59144
- https://access.redhat.com/errata/RHSA-2026:59139
- https://access.redhat.com/errata/RHSA-2026:59138
- https://access.redhat.com/errata/RHSA-2026:61629
- https://access.redhat.com/errata/RHSA-2026:61627
- https://access.redhat.com/errata/RHSA-2026:62336
- https://access.redhat.com/errata/RHSA-2026:62335
- https://github.com/advisories/GHSA-q8gq-377p-jq3r
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More vLLM vulnerabilities
All vLLM entriesCVE-2026-115911
vLLM: DoS via unbounded chat_template Jinja2 rendering exhausts the renderer thread pool
medium6.5Oct 28, 2026CVE-2026-115912
vLLM: Public multimodal SHM handle forgery reaches worker-side `pickle.loads()` with insecure serialization disabled
high7.5Oct 28, 2026CVE-2026-115913
vLLM: Phi-4 multimodal audio encoder materializes and retains full attention matrices: a single max-length audio OOM-crashes the vLLM engine
medium6.5Oct 28, 2026CVE-2026-115914
vLLM DeepSeek-OCR image processing vulnerable to denial of service
medium6.5Oct 28, 2026CVE-2026-115915
vLLM: Untrusted EPS inputs can trigger denial of service or Ghostscript RCE
high8.1Oct 28, 2026CVE-2026-115916
vLLM: Out-of-vocabulary prompt token id passes input validation and triggers a CUDA device-side assert (engine crash / DoS)
medium6.5Oct 28, 2026
