{"id":2019,"cve":"CVE-2026-41523","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2026-41523\/","cwe":"CWE-94","cwe_number":94,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/94","cvss_score":7.5,"published":"2026-06-22","owasp":"A08 Software and Data Integrity Failures","odc":"Checking","cdc":"Incorrect Check","category":"Design Defects","subcategory":"Insecure Parsing or Deserialization","scope":"Remote","impact":"Arbitrary Code Execution","summary":"vLLM RCE via malicious model due to an assert bypass in optimized mode.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2026-41523\/","description":"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.","solution":"Upgrade vLLM to version 0.22.0 or later.","affected_component":"vLLM","fixed_by_upgrading":true,"vulnerable_code":"import os\n\n# This is a simplified representation of the vulnerable code pattern.\n# In the actual vLLM codebase, this logic was part of the activation function loading mechanism.\n\n# A list of known, safe activation functions.\nALLOWED_ACTIVATIONS = [\"gelu\", \"relu\", \"silu\"]\n\ndef get_activation(activation_name: str):\n    \"\"\"\n    Loads an \"activation function\" from a model's configuration.\n\n    This function contains a security check using `assert`. When Python is run in\n    optimized mode (`python -O`), `assert` statements are removed, bypassing the check\n    and allowing the untrusted `activation_name` string to be processed by a\n    dangerous function like `eval`, leading to arbitrary code execution.\n    \"\"\"\n    \n    # VULNERABLE SECURITY CHECK: This line is ignored in optimized mode.\n    assert activation_name in ALLOWED_ACTIVATIONS, \"Disallowed activation function.\"\n\n    # If the assert is bypassed, this `eval` call can execute arbitrary code.\n    # The attacker provides a malicious string as the 'activation_name' in their\n    # model's configuration file.\n    # Example malicious string: \"__import__('os').system('echo pwned > \/tmp\/pwned')\"\n    return eval(activation_name)\n","patched_code":"import importlib\nfrom typing import Callable\n\n\ndef get_activation_function(name: str) -> Callable:\n    \"\"\"\n    Loads an activation function specified by its full module path.\n\n    This fixed version replaces an `assert` statement with a proper\n    conditional check to ensure that even in Python's optimized mode,\n    only modules from a trusted path (e.g., 'vllm.') can be loaded.\n    This prevents an attacker from specifying a malicious module\n    (e.g., 'os.system') in a model's configuration file.\n    \"\"\"\n    module_path, function_name = name.rsplit(\".\", 1)\n\n    # The Fix: Replaced `assert module_path.startswith(\"vllm.\")` with an\n    # `if` statement that raises an exception. This check is not disabled\n    # by the Python optimizer (`python -O`).\n    if not module_path.startswith(\"vllm.\"):\n        raise ValueError(\n            f\"Activation function's module must be a submodule of 'vllm'. \"\n            f\"Got '{module_path}'.\"\n        )\n\n    module = importlib.import_module(module_path)\n    return getattr(module, function_name)\n","payload_needed":true,"payload":"```python\nimport os\n\nos.system(\"touch \/tmp\/pwned\")\n\ndef exploit_function(x):\n    return x\n```","payload_status":"available","published_fix":[{"repository":"vllm-project\/vllm","commit_url":"https:\/\/github.com\/vllm-project\/vllm\/commit\/b3c7ffcab82c2439726f8cb213800f6f38c023d3","commit_subject":"[Misc] Replace assert with proper exceptions for security and validation in pooling (#43286)","units":[{"file":"vllm\/model_executor\/layers\/pooler\/activations.py","function":"get_act_fn"},{"file":"vllm\/model_executor\/layers\/pooler\/activations.py","function":"resolve_classifier_act_fn"},{"file":"vllm\/pooling_params.py","function":"PoolingParams._merge_default_parameters"},{"file":"vllm\/pooling_params.py","function":"PoolingParams._verify_valid_parameters"},{"file":"vllm\/pooling_params.py","function":"PoolingParams.__post_init__"},{"file":"vllm\/v1\/pool\/metadata.py","function":"PoolingMetadata.build_pooling_cursor"},{"file":"vllm\/v1\/pool\/metadata.py","function":"PoolingMetadata.get_pooling_cursor"},{"file":"vllm\/v1\/pool\/metadata.py","function":"PoolingMetadata._get_prompt_token_ids"},{"file":"vllm\/v1\/pool\/metadata.py","function":"PoolingMetadata.__post_init__"}]}],"references":null}