Miggo Logo

CVE-2025-48887:
vLLM has a Regular Expression Denial of Service (ReDoS, Exponential Complexity) Vulnerability in `pythonic_tool_parser.py`

6.5

CVSS Score
3.1

Basic Information

EPSS Score
0.14483%
Published
5/28/2025
Updated
5/30/2025
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
Package NameEcosystemVulnerable VersionsFirst Patched Version
vllmpip>= 0.6.4, < 0.9.00.9.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability is a Regular Expression Denial of Service (ReDoS) caused by a complex and inefficient regular expression used for parsing tool calls in vLLM's OpenAI entrypoint. The specific regex, _TOOL_CALL_PATTERN, located in vllm/entrypoints/openai/tool_parsers/pythonic_tool_parser.py, contained multiple nested quantifiers (*, +) and optional groups. This structure made it vulnerable to catastrophic backtracking when processing certain specially crafted input strings.

The PythonicToolParser.parse_tool_calls method directly utilizes this vulnerable regex via the _TOOL_CALL_PATTERN.fullmatch() call to validate incoming tool call strings. When a malicious string (as shown in the attack example) is passed to this function, the regex matching process consumes CPU resources exponentially with the input length, leading to a denial of service.

The provided patch (commit 4fc1bf813ad80172c1db31264beaef7d93fe0601) addresses this by:

  1. Replacing the standard Python re module with the regex module, which has better performance and protections against ReDoS for some patterns.
  2. Modifying the _TOOL_CALL_PATTERN itself to a less complex version (r"\\[(?:([a-zA-Z_]\\w*)\\((?:([a-zA-Z_]\\w*)=(?:.*)(?:,\\s*)?)*\\)(?:,\\s*)?)+\\]") that uses possessive quantifiers and atomic grouping to reduce backtracking, changing its complexity from O(2^N) to O(N^2).

Therefore, the parse_tool_calls function is the runtime indicator as it's the direct consumer of the vulnerable regex pattern. During an exploit, this function's execution time would skyrocket due to the regex processing the malicious input.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

## Summ*ry * R**ul*r *xpr*ssion **ni*l o* S*rvi** (R**oS) vuln*r**ility *xists in t** *il* [`vllm/*ntrypoints/op*n*i/tool_p*rs*rs/pyt*oni*_tool_p*rs*r.py`](*ttps://*it*u*.*om/vllm-proj**t/vllm/*lo*/m*in/vllm/*ntrypoints/op*n*i/tool_p*rs*rs/pyt*oni*_

Reasoning

T** vuln*r**ility is * R**ul*r *xpr*ssion **ni*l o* S*rvi** (R**oS) **us** *y * *ompl*x *n* in***i*i*nt r**ul*r *xpr*ssion us** *or p*rsin* tool **lls in vLLM's Op*n*I *ntrypoint. T** sp**i*i* r***x, `_TOOL_**LL_P*TT*RN`, lo**t** in `vllm/*ntrypoints