CVE-2025-57809 — xgrammar
Fix: mlc-ai/xgrammar@b943feaCVE-2025-57809 is a CWE-674 vulnerability in xgrammar. A fix is available for xgrammar — see the affected versions and patch details below.
XGrammar affected by Denial of Service by infinite recursion grammars
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2025-57809.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
xgrammarReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Summary
This issue: http://github.com/mlc-ai/xgrammar/issues/250 should have it's own security advisory. Since several tools accept and pass user supplied grammars to xgrammar, and it is so easy to trigger it seems like a High.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | xgrammar | all versions | 0.1.21pip install --upgrade 'xgrammar==0.1.21' |
Affected Products
xgrammarmlc-aiDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for xgrammar, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update xgrammar to 0.1.21 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2025-57809 is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This vulnerability is considered Important because it can be exploited remotely, without authentication or user interaction, and directly impacts the availability of systems that rely on xgrammar for structured output parsing. Unlike a Moderate flaw that might require unusual conditions or only cause partial…
Mitigation is either unavailable or does not meet Red Hat Product Security standards for usability, deployment, applicability, or stability.Source: Red Hat security advisory for CVE-2025-57809 (CC BY 4.0)
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat Enterprise Linux AI 1.5 | rhelai1/instructlab-intel-rhel9:1.5.4-1761050413 | RHSA-2025:19421 |
| Red Hat Enterprise Linux AI 1.5 | rhelai1/bootc-intel-rhel9:1.5.4-1761060689 | RHSA-2025:19422 |
| Red Hat Enterprise Linux AI 1.5 | rhelai1/instructlab-nvidia-rhel9:1.5.4-1761220254 | RHSA-2025:19423 |
| Red Hat Enterprise Linux AI 1.5 | rhelai1/bootc-azure-amd-rhel9:1.5.4-1761073793 | RHSA-2025:19424 |
| Red Hat Enterprise Linux AI 1.5 | rhelai1/instructlab-amd-rhel9:1.5.4-1761043227 | RHSA-2025:19425 |
| Red Hat Enterprise Linux AI 1.5 | rhelai1/bootc-gcp-nvidia-rhel9:1.5.4-1761236079 | RHSA-2025:19426 |
| Red Hat Enterprise Linux AI 1.5 | rhelai1/bootc-amd-rhel9:1.5.4-1761064179 | RHSA-2025:19427 |
| Red Hat Enterprise Linux AI 1.5 | rhelai1/bootc-nvidia-rhel9:1.5.4-1761228838 | RHSA-2025:19428 |
Frequently Asked Questions
Is CVE-2025-57809 in your dependencies?
Find it across PyPI, including transitive dependencies.