Xgrammar Segmentation Fault Vulnerability Leading to Denial-of-Service

Vulnerability

A denial-of-service vulnerability has been identified in the Xgrammar library, prior to version 0.1.32. The issue arises from multi-level nested syntax, which can cause a segmentation fault and core dump. This vulnerability can be exploited by creating a grammar rule with 30,000 layers of nested parentheses, triggering a stack overflow or memory exhaustion.

Impact

Exploitation of this vulnerability leads to a segmentation fault, causing a core dump and disrupting normal operation.

Reproduction

The vulnerability can be reproduced by using Xgrammar version 0.1.31 and constructing a grammar rule that includes 30,000 layers of nested parentheses. This can be done by a script that utilizes the Xgrammar library, along with PyTorch and the Transformers library, to generate a mathematical expression that exploits the nesting flaw.

Remediation

Users can upgrade to Xgrammar version 0.1.32, where this vulnerability has been patched.

Added: Mar 5, 2026, 4:31 PM
Updated: Mar 5, 2026, 4:31 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
2.5
exploitability
8.0
remediation
0.0
relevance
3.5
threat
6.4
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.