Denial of Service via unbounded cache in xgrammar
Xgrammar versions before 0.1.18 contain an unbounded memory cache for compiled grammars that can be abused to cause denial of service by sending many requests with unique JSON schemas. The vulnerability was patched by implementing an LRU cache with a configurable size limit.
What happened
Xgrammar includes an unbounded cache for compiled grammars held in memory to increase performance with repeated use of the same grammar. Since the cache has no size limit, an attacker sending many requests with unique JSON schemas can fill up a host's memory and cause a denial of service.
The vulnerability affects xgrammar versions prior to 0.1.18. The fix was to add a limit to the cache size, implemented as a policy-based thread cache with an LRU (Least Recently Used) eviction policy.
Reported impact
Any system making use of xgrammar and taking requests as input from potentially untrusted parties would be vulnerable to this denial of service issue. An example of abuse would be sending many small requests to an LLM inference server with unique JSON schemas.
Index analysis
The vulnerability has a CVSS v3 base score of 6.5 (Moderate severity), with network attack vector, low attack complexity, low privileges required, and no user interaction needed. The impact is limited to availability, with no confidentiality or integrity concerns.
Classification
Sources and evidence
Sources not yet published
This record was researched and written by the Index from original reporting. Its sources are still being verified by an editor, and they are listed here once that check is complete. Until then the record carries no reviewer.