{"id":"CVE-2025-57809","published":"2025-08-25T21:22:00Z","modified":"2025-08-26T20:19:34Z","title":"XGrammar affected by Denial of Service by infinite recursion grammars","vendor":"mlc-ai","product":"xgrammar","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.7,"severity":"HIGH","version":"4.0","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","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00514,"percentile":0.44729,"provenance":"source"},"cwes":[{"id":"CWE-674","name":"Uncontrolled Recursion"}],"references":[{"url":"https://github.com/mlc-ai/xgrammar/security/advisories/GHSA-5cmr-4px5-23pc","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/mlc-ai/xgrammar/issues/250","tags":["x_refsource_MISC"]},{"url":"https://github.com/mlc-ai/xgrammar/commit/b943feacb5a1caf4d39de8ec3bf7c7ce066dcee5","tags":["x_refsource_MISC"]}],"priority":{"score":14.3,"factors":[{"name":"EPSS percentile","points":8.95},{"name":"CVSS severity","points":5.39}]},"vendorSlug":"mlc-ai","affectedVersions":[{"vendor":"mlc-ai","product":"xgrammar","versions":["< 0.1.21"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2025-08-26T20:19:08.061700Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"xgrammar","vulnerableRanges":["<0.1.21"],"patched":["0.1.21"],"from":["GHSA-5cmr-4px5-23pc","PYSEC-2026-2054"],"provenance":"source"}],"summary":{"text":"The XGrammar library (mlc-ai's xgrammar product) contains an infinite recursion flaw in its grammar handling, classified as uncontrolled recursion. An attacker with network access and no privileges or user interaction can supply a crafted grammar to trigger the infinite recursion and cause a denial of service.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:37:41Z"},"euvd":{"id":"EUVD-2025-28633","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-mlc-ai-xgrammar-cve-2025-57809","children":[{"from":"CVE-2025-57809","to":"CVE-2025-58446","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["cpp/earley_parser.cc","cpp/earley_parser.h","cpp/grammar_compiler.cc","cpp/grammar_matcher.cc"],"commits":["https://github.com/mlc-ai/xgrammar/commit/b943feacb5a1caf4d39de8ec3bf7c7ce066dcee5","https://github.com/mlc-ai/xgrammar/commit/ced69c3ad2f8f61b516cc278a342e7c644383e27"],"basis":"shared function","functions":["AcceptToken","GrammarMatcherForTokenMaskCache","IsTokenPassLookaheadAssertion","MultiThreadCompileGrammar"]}]}],"packageHistory":[{"cve":"CVE-2025-32381","published":"2025-04-09","fixed":"0.1.18","kev":false,"link":{"from":"CVE-2025-32381","to":"CVE-2025-57809","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:xgrammar","fromFixed":"0.1.18","toFixed":"0.1.21","daysApart":138}]}},{"cve":"CVE-2025-57809","published":"2025-08-25","fixed":"0.1.21","kev":false},{"cve":"CVE-2025-58446","published":"2025-09-06","fixed":"0.1.24","kev":false},{"cve":"CVE-2026-25048","published":"2026-03-05","fixed":"0.1.32","kev":false}],"package":"PyPI:xgrammar"}}