NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · vLLM

CVE-2025-61620: vLLM: Resource-Exhaustion (DoS) through Malicious Jinja Template in OpenAI-Compatible Server

mediumCVSS 3.1 6.5GHSA-6fvq-23cw-5628

vLLM's OpenAI-compatible server lets clients send a Jinja template through `chat_template` or `chat_template_kwargs`. A crafted template can burn CPU and memory and make the server stop answering. Blocking `chat_template` alone does not help, because a `chat_template` key inside `chat_template_kwargs` overrides it. Versions 0.5.1 up to 0.11.0 are affected. Upgrade to 0.11.0.

Published Oct 7, 2025 · Updated Oct 22, 2025 · Analysis Nov 1, 2026

What an attacker can do

To turn a conversation into model input, vLLM renders a Jinja template. The server lets callers supply that template. Jinja supports loops and nested iteration, so a template can be written to run for a very long time or build huge strings. The render happens inside the server, so one request can starve all other users.

The obvious mitigation, rejecting the chat_template parameter, is not enough. In vllm/entrypoints/openai/serving_engine.py the code builds a keyword-argument dict with the server's template, then calls dict.update with the user's chat_template_kwargs. A caller who puts a chat_template key in chat_template_kwargs replaces the template before apply_hf_chat_template runs.

The attacker needs access to an endpoint that accepts these parameters. The CVSS vector asks for low privileges, such as an API key, and rates only availability impact, high. No data leaves the server and no code runs outside the template engine. A shared inference endpoint with many tenants or public API keys is the main concern.

Who is affected

Affected: the pip package vllm from 0.5.1 up to but not including 0.11.0, when the OpenAI-compatible server (vllm serve) takes requests from clients you do not fully trust. Chat endpoints that accept the chat_template or chat_template_kwargs fields are the exposed surface.

Check your install:

pip show vllm

vllm

Ecosystem
PyPI
Affected
>= 0.5.1, < 0.11.0
Fixed in
0.11.0
Check
pip show vllm

How to fix it

Upgrade to vllm 0.11.0:

pip install -U "vllm>=0.11.0"

The fix is pull request 25794. The advisory lists no separate workaround. Do not rely on blocking only chat_template, since chat_template_kwargs can carry the same key. If you cannot upgrade, filter both fields at an API gateway or reverse proxy before requests reach vLLM, and keep untrusted clients off the endpoint.

How to tell if you were hit

Look for chat requests whose body contains chat_template or chat_template_kwargs, particularly a chat_template key nested in the kwargs, from clients that should not set templates. Watch for a vLLM process pinned at high CPU or growing memory while requests pile up, health checks that time out, and workers killed for out-of-memory. Match the time of the stall to the request that started it in your gateway logs.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

A resource-exhaustion (denial-of-service) vulnerability exists in multiple endpoints of the OpenAI-Compatible Server due to the ability to specify Jinja templates via the chat_template and chat_template_kwargs parameters. If an attacker can supply these parameters to the API, they can cause a service outage by exhausting CPU and/or memory resources.

Details

When using an LLM as a chat model, the conversation history must be rendered into a text input for the model. In hf/transformer, this rendering is performed using a Jinja template. The OpenAI-Compatible Server launched by vllm serve exposes a chat_template parameter that lets users specify that template. In addition, the server accepts a chat_template_kwargs parameter to pass extra keyword arguments to the rendering function.

Because Jinja templates support programming-language-like constructs (loops, nested iterations, etc.), a crafted template can consume extremely large amounts of CPU and memory and thereby trigger a denial-of-service condition.

Importantly, simply forbidding the chat_template parameter does not fully mitigate the issue. The implementation constructs a dictionary of keyword arguments for apply_hf_chat_template and then updates that dictionary with the user-supplied chat_template_kwargs via dict.update. Since dict.update can overwrite existing keys, an attacker can place a chat_template key inside chat_template_kwargs to replace the template that will be used by apply_hf_chat_template.

# vllm/entrypoints/openai/serving_engine.py#L794-L816
_chat_template_kwargs: dict[str, Any] = dict(
    chat_template=chat_template,
    add_generation_prompt=add_generation_prompt,
    continue_final_message=continue_final_message,
    tools=tool_dicts,
    documents=documents,
)
_chat_template_kwargs.update(chat_template_kwargs or {})

request_prompt: Union[str, list[int]]
if isinstance(tokenizer, MistralTokenizer):
    ...
else:
    request_prompt = apply_hf_chat_template(
        tokenizer=tokenizer,
        conversation=conversation,
        model_config=model_config,
        **_chat_template_kwargs,
    )

Impact

If an OpenAI-Compatible Server exposes endpoints that accept chat_template or chat_template_kwargs from untrusted clients, an attacker can submit a malicious Jinja template (directly or by overriding chat_template inside chat_template_kwargs) that consumes excessive CPU and/or memory. This can result in a resource-exhaustion denial-of-service that renders the server unresponsive to legitimate requests.

Fixes

  • https://github.com/vllm-project/vllm/pull/25794

Credited to key-moon, Ga-ryo, ota42y, Alnusjaponica, Isotr0py, DarkLight1337.

Questions

If I block the chat_template parameter, am I safe?

No. The server merges chat_template_kwargs into its own keyword arguments with dict.update, so a chat_template key in the kwargs overwrites the template. Block both fields or upgrade.

Does this allow code execution?

The advisory describes only resource exhaustion through a Jinja template. The vector rates availability impact and no confidentiality or integrity impact.

Which vLLM version fixes CVE-2025-61620?

vLLM 0.11.0. Versions from 0.5.1 up to but not including 0.11.0 are vulnerable.

References

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 entries