High

vLLM: Security Check Bypass via assert Statement in Activation Function Loading Allows Arbitrary Code Execution

  • Disclosed: 16.06.2026
  • Updated: 11.10.2026 15:17

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:

python
# 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:

python
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 — SequencePooler
  • vllm/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:

python
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:

  1. Victim loads a malicious model from HuggingFace (user interaction)
  2. vLLM runs under python -O or PYTHONOPTIMIZE=1 (documented in production use)
  3. 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

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) vllm < 0.22.0 0.22.0

References

CVSS score 7.5/10
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness (CWE)
CWE-617, CWE-94
Platform
Python (PyPI)
Package
vllm
Disclosed
16.06.2026
Updated
11.10.2026 15:17

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-2300 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-q8gq-377p-jq3r - CC BY 4.0

Vulnerability history: vllm

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (94) in the archive
Total entries
94
First → latest
09.2024 10.2026
Without a fix
5
Exploited in attacks
0

Severity breakdown

  • Critical 9
  • High 23
  • Medium 47
  • Low 4
  • Unrated 11

Disclosures per year

  1. 2024: 2
  2. 2025: 30
  3. 2026: 62
Severity:
  1. High · 7.5 CVE-2026-54234 >= 0.17.1, < 0.24.0 0.24.0
  2. High CVE-2026-55514 >= 0.12.0, < 0.24.0 0.24.0
  3. Critical · 9.1 CVE-2026-48746 >= 0.3.0, < 0.22.0 0.22.0
  4. vLLM: Security Check Bypass via assert Statement in Activation Function Loading Allows Arbitrary Code Execution this entry
    High · 7.5 CVE-2026-41523 < 0.22.0 0.22.0
  5. Critical · 9.8 CVE-2026-22778 >= 0.8.3, < 0.14.1 0.14.1
  6. High · 8.8 CVE-2026-22807 >= 0.10.1, < 0.14.0 0.14.0
  7. High · 8.8 CVE-2026-56340 >= 0.10.2, < 0.13.0 0.13.0
  8. High · 6.5 CVE-2025-62372 >= 0.5.5, < 0.11.1 0.11.1
  9. High · 8.8 CVE-2025-62164 >= 0.10.2, < 0.11.1 0.11.1
  10. High · 7.5 CVE-2025-59425 < 0.11.0 0.11.0
  11. High · 8.8 CVE-2025-9141 >= 0.10.0, < 0.10.1.1 0.10.1.1
Show more (12) Showing 20 of 32

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.