Intel

AIKIDO-2026-177724

xgrammar is vulnerable to Denial of Service (DoS)

Denial of Service (DoS) Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published Today

59

Medium Risk

This Affects:

PYTHONxgrammar
0.1.24 - 0.2.4
Fixed in 0.2.5
Are you affected? Scan for Free

TL;DR

The XML tool-calling schema converter wraps unconstrained string properties with redundant formatting-whitespace repetitions around the string value, so a run of whitespace produces a linear number of active Earley parser states and a quadratic rollback history. A grammar built from an XML tool-calling style schema with an unconstrained string, combined with model output containing many whitespace characters, drives unbounded parser state and memory growth. The cumulative Compact2DArray CSR offset can then overflow int32_t, feeding an invalid parser state into the scan path and causing a SIGSEGV in Release builds alongside extreme memory consumption. The fix omits the redundant whitespace rules for unconstrained XML strings and adds always-on pre-mutation bounds checks that raise a controlled error before the compact array offsets become unrepresentable.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and generate grammars using an XML tool-calling style (for example Qwen, MiniMax, DeepSeek, or GLM XML) with an unconstrained string property.

Background info

xgrammar is vulnerable to Denial of Service (DoS) in versions 0.1.24 - 0.2.4.

How to fix this

Upgrade the xgrammar library to the patch version.