# CVE-2025-58446: xgrammar vulnerable to denial of service by huge enum grammar

> Attackers can cause denial of service in model providers using xgrammar by submitting huge enum grammars that trigger inefficient processing.

- **Severity:** Medium 6.9 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Sep 2025
- **Updated:** 8 Sep 2025
- **Also known as:** GHSA-9q5r-wfvf-rr7f, PYSEC-2026-2055

## What is CVE-2025-58446?

CVE-2025-58446 is a medium-severity denial of service vulnerability in mlc-ai xgrammar, published on 6 Sep 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

xgrammar is an open-source library for efficient, flexible, and portable structured generation. A grammar optimizer introduced in 0.1.23 processes large grammars (>100k characters) at very low rates, and can be used for DOS of model providers. This issue is fixed in version 0.1.24.

Weakness: CWE-770 (Allocation of Resources Without Limits or Throttling)

## Which versions are affected by CVE-2025-58446?

3 open source packages ship an affected version, including xgrammar. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `xgrammar` | PyPI | From 0.1.23 | 0.1.24 |
| `xgrammar` | PyPI | From 0.1.23 | 0.1.24 |
| `xgrammar` | PyPI | From 0.1.23 | 0.1.24 |

Products: Mlc-Ai Xgrammar.

## How do I fix CVE-2025-58446?

Upgrade xgrammar to 0.1.24 or later.

## Is CVE-2025-58446 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-58446 exists.

## Other vulnerabilities in mlc-ai xgrammar

- [CVE-2026-25048](https://insights.sbomify.com/CVE-2026-25048/): xgrammar: Multi-layer nesting causes DoS (high 8.7)
- [CVE-2025-57809](https://insights.sbomify.com/CVE-2025-57809/): XGrammar affected by Denial of Service by infinite recursion grammars (high 7.7)
- [CVE-2025-32381](https://insights.sbomify.com/CVE-2025-32381/): Denial of Service by abusing xgrammar unbounded cache in memory (medium 6.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-58446 and fix it if it is affected.

What it is: CVE-2025-58446 is a medium-severity denial of service vulnerability in mlc-ai xgrammar, published on 6 Sep 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-58446 exists.

Affected packages and fixed versions:
- xgrammar (PyPI): affected from 0.1.23; fixed in 0.1.24
- xgrammar (PyPI): affected from 0.1.23; fixed in 0.1.24
- xgrammar (PyPI): affected from 0.1.23; fixed in 0.1.24

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-58446/ (Markdown: https://insights.sbomify.com/CVE-2025-58446/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-58446
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-58446
- OSV: https://osv.dev/vulnerability/CVE-2025-58446

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-58446/
Summaries are generated and may contain mistakes; the official description above is the record.
