# CVE-2026-25048: xgrammar: Multi-layer nesting causes DoS

> Attackers can cause a segmentation fault and denial of service in xgrammar by providing multi-layer nested syntax inputs.

- **Severity:** High 8.7 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/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:** 5 Mar 2026
- **Updated:** 21 Jul 2026
- **Also known as:** GHSA-7rgv-gqhr-fxg3, PYSEC-2026-2322

## What is CVE-2026-25048?

CVE-2026-25048 is a high-severity denial of service vulnerability in mlc-ai xgrammar, published on 5 Mar 2026. 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. Prior to version 0.1.32, the multi-level nested syntax caused a segmentation fault (core dumped). This issue has been patched in version 0.1.32.

Weakness: CWE-674 (Uncontrolled Recursion)

## Which versions are affected by CVE-2026-25048?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `xgrammar` | PyPI | All versions | 0.1.32 |
| `xgrammar` | PyPI | All versions | 0.1.32 |
| `xgrammar` | PyPI | All versions | 0.1.32 |

Products: Mlc-Ai Xgrammar.

## How do I fix CVE-2026-25048?

Upgrade xgrammar to 0.1.32 or later.

## Is CVE-2026-25048 being exploited?

There is no known exploitation of CVE-2026-25048 in the wild and no public exploit code.

## Other vulnerabilities in mlc-ai xgrammar

- [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-58446](https://insights.sbomify.com/CVE-2025-58446/): xgrammar vulnerable to denial of service by huge enum grammar (medium 6.9)
- [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-2026-25048 and fix it if it is affected.

What it is: CVE-2026-25048 is a high-severity denial of service vulnerability in mlc-ai xgrammar, published on 5 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-25048 in the wild and no public exploit code.

Affected packages and fixed versions:
- xgrammar (PyPI): affected all versions; fixed in 0.1.32
- xgrammar (PyPI): affected all versions; fixed in 0.1.32
- xgrammar (PyPI): affected all versions; fixed in 0.1.32

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-2026-25048/ (Markdown: https://insights.sbomify.com/CVE-2026-25048/index.md)
```

## Sources

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

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