{"id":"CVE-2025-32381","aliases":["CVE-2025-32381","GHSA-389x-67px-mjg3","PYSEC-2025-235"],"related":[],"kind":"vulnerability","state":"published","title":"Denial of Service by abusing xgrammar unbounded cache in memory","summary":"XGrammar is an open-source library for efficient, flexible, and portable structured generation. Prior to 0.1.18, Xgrammar includes a cache for compiled grammars to increase performance with repeated use of the same grammar. This cache is held in memory. Since the cache is unbounded, a system making use of xgrammar can be abused to fill up a host's memory and case a denial of service. For example, sending many small requests to an LLM inference server with unique JSON schemas would eventually cause this denial of service to occur. This vulnerability is fixed in 0.1.18.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"XGrammar is an open-source library for efficient, flexible, and portable structured generation. Prior to 0.1.18, Xgrammar includes a cache for compiled grammars to increase performance with repeated use of the same grammar. This cache is held in memory. Since the cache is unbounded, a system making use of xgrammar can be abused to fill up a host's memory and case a denial of service. For example, sending many small requests to an LLM inference server with unique JSON schemas would eventually cause this denial of service to occur. This vulnerability is fixed in 0.1.18.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nXgrammar includes a cache for compiled grammars to increase performance with repeated use of the same grammar. This cache is held in memory. Since the cache is unbounded, a system making use of xgrammar can be abused to fill up a host's memory and case a denial of service. For example, sending many small requests to an LLM inference server with unique JSON schemas would eventually cause this denial of service to occur.\n\n### Details\n\nThe fix is to add a limit to the cache size. This was done in https://github.com/mlc-ai/xgrammar/pull/243\n\nAn example of making use of the new cache size limit can be found in vLLM here: https://github.com/vllm-project/vllm/pull/16283\n\n### Impact\n\nAny system making use of Xgrammar and taking requests as input from potentially untrusted parties would be vulnerable to this denial of service issue.","format":"markdown","source":"ghsa"},{"lang":"es","text":"XGrammar es una librería de código abierto para la generación estructurada eficiente, flexible y portátil. Antes de la versión 0.1.18, Xgrammar incluía una caché para gramáticas compiladas que mejoraba el rendimiento con el uso repetido de la misma gramática. Esta caché se almacena en memoria. Dado que la caché es ilimitada, un sistema que utiliza xgrammar puede ser utilizado de forma abusiva para saturar la memoria del host y provocar una denegación de servicio. Por ejemplo, enviar muchas solicitudes pequeñas a un servidor de inferencia LLM con esquemas JSON únicos podría provocar esta denegación de servicio. Esta vulnerabilidad se corrigió en la versión 0.1.18.","source":"nvd"}],"published":"2025-04-09T13:08:59.000Z","modified":"2026-09-10T03:50:57.150Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":6.5,"rating":"MEDIUM"}],"cwes":["CWE-770"],"affected":[{"ranges":[{"version":"< 0.1.18","status":"affected"}],"vendor":"mlc-ai","product":"xgrammar","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.1.18"}],"ecosystem":"PyPI","package":"xgrammar","purl":"pkg:pypi/xgrammar","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"0.1.18"}],"vendor":"mlc-ai","product":"xgrammar","cpe":"cpe:2.3:a:mlc-ai:xgrammar:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"0.1.18"}],"ecosystem":"PyPI","package":"xgrammar","purl":"pkg:pypi/xgrammar","source":"pysec"}],"references":[{"url":"https://github.com/mlc-ai/xgrammar/security/advisories/GHSA-389x-67px-mjg3","tags":["advisory","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/mlc-ai/xgrammar/pull/243","tags":["fix","issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/vllm-project/vllm/pull/16283","tags":["fix","issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-32381","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/mlc-ai/xgrammar","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/xgrammar/PYSEC-2025-235.yaml","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2025-04-09T17:26:48.431Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-32381","url":"https://www.cve.org/CVERecord?id=CVE-2025-32381","licence":"CVE Terms of Use","modified":"2025-04-09T20:43:33.169Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-389x-67px-mjg3","url":"https://github.com/advisories/GHSA-389x-67px-mjg3","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:57.150Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-32381","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-32381","licence":"Public domain","modified":"2026-06-17T09:11:54.667Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2025-235","url":"https://osv.dev/vulnerability/PYSEC-2025-235","licence":"CC-BY-4.0","modified":"2026-05-20T09:19:24.371Z"}],"updatedAt":"2026-11-25T22:58:56.311Z","epss":{"score":0.00517,"percentile":0.45481,"date":"2026-12-01T12:00:22.000Z"}}