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
EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.
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' |
Detection & 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.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like CVE-2025-57809 can be triaged on real exposure rather than presence alone.
Tailored to CVE-2025-57809. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
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…
| 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?
O3 Security finds CVE-2025-57809 across PyPI dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.