Skip to main content

xgrammar CVE-2026-25048

HIGH
Uncontrolled Recursion (CWE-674)
2026-03-05 security-advisories@github.com GHSA-7rgv-gqhr-fxg3
8.7
CVSS 4.0 · Vendor: github
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Reach LLM endpoint using xgrammar
  2. Delivery
    Submit deeply nested grammar/schema
  3. Exploit
    Trigger uncontrolled recursion in parser
  4. Execution
    Exhaust native stack, segmentation fault
  5. Impact
    Worker process crashes, service denied

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A06:2021 - Vulnerable and Outdated Components
ASVS 5.0
V15 - Secure Coding and Architecture Recursion depth limits
Exploitation Conditions

Exploitation requires that the target deployment uses xgrammar (versions before 0.1.32) for structured/guided generation AND that the attacker can supply or influence the grammar/JSON-schema input processed by the library - the specific trigger is multi-level deeply nested grammar syntax that drives uncontrolled recursion to a segfault. Per the CVSS vector (PR:N/UI:N/AC:L) no authentication, user interaction, or special configuration is otherwise needed, so against an endpoint that accepts client-controlled grammars this is unauthenticated and low-complexity. The principal limiting factor is exposure of the grammar input: deployments that only use fixed, server-side trusted grammars/schemas and never pass attacker-controlled grammar definitions to xgrammar are not realistically reachable. Impact is limited to availability (process crash); no code execution, data disclosure, or integrity impact results.

Impact

The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:N) describes a network-reachable, low-complexity, unauthenticated trigger, and the impact is purely availability (VA:H; VC:N/VI:N/VA only) - a crash/DoS, not code execution or data exposure. This is internally consistent with CWE-674 and the segfault description. The signals diverge on likelihood: CVSS base severity is High (8.7), but EPSS is only 0.06% (17th percentile), there is no CISA KEV listing, and no POC is referenced, so real-world risk is moderate-to-low and likely opportunistic at best. Note a data conflict: the input Tags label this 'Information Disclosure,' but the CVSS vector explicitly sets VC:N (no confidentiality impact) - the authoritative metrics indicate availability-only, so the 'Information Disclosure' tag appears to be mislabeled and should not drive prioritization. Practical priority: patch promptly on internet-exposed inference endpoints that accept attacker-controlled grammars/schemas, but this is not a critical drop-everything issue absent active exploitation.

Exploit ScenarioDerived

An attacker submits a generation request to an internet-facing LLM serving endpoint that uses xgrammar for guided decoding, supplying a maliciously crafted grammar or JSON schema with many levels of nested structure. When xgrammar compiles/matches the deeply nested syntax it recurses until the stack is exhausted, segfaults, and terminates the worker process, denying service to all users; given AV:N/AC:L/PR:N, this requires only network access and no authentication, though no public POC is currently referenced.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.1% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv5 – Jun 30, 2026

Denial of service in the mlc-ai xgrammar structured-generation library (versions prior to 0.1.32) allows remote attackers to crash the host process via deeply multi-level nested grammar syntax that triggers a segmentation fault (core dump). Because xgrammar is typically embedded in LLM inference servers to constrain model output, an attacker who can influence the grammar/schema passed to the engine can take the service offline. No public exploit identified at time of analysis, and EPSS exploitation probability is very low (0.06%), but the issue is fixed and has been picked up in multiple Red Hat advisories.

Earlier versions of this analysis (4)
v4 Jun 30, 2026 - 05:03 cvss changed CVSS 8.7

Denial of service in xgrammar before 0.1.32 lets an attacker crash the host process via a crafted grammar containing multi-level nested syntax, which triggers a segmentation fault (core dumped) in the structured-generation engine. Because xgrammar is embedded in LLM inference and serving stacks (Red Hat shipped fixes via RHSA-2026:5809/6761/6762), a single malformed grammar or schema can take down model-serving workers. No public exploit has been identified at time of analysis, and EPSS is very low (0.06%, 17th percentile), indicating no observed exploitation activity.

v3 Jun 30, 2026 - 05:02 cvss changed CVSS 8.7

Denial of service in xgrammar (mlc-ai) before 0.1.32 allows attackers to crash the host process via a structured-generation grammar containing multi-level nested syntax, which triggers a segmentation fault (core dumped). Because xgrammar is embedded in LLM inference/serving stacks, any interface that accepts attacker-controlled grammars or JSON schemas can be abused to take down the worker. No public exploit is identified at time of analysis and EPSS is low (0.06%), but the CVSS 4.0 score of 8.7 reflects an unauthenticated, network-reachable availability impact.

v2 Jun 30, 2026 - 05:01 cvss changed CVSS 8.7

Denial of service in mlc-ai's xgrammar structured-generation library (versions <= 0.1.31) lets a client crash the host process by submitting a grammar with deeply nested syntax. When the GrammarCompiler parses a rule containing roughly 30,000 layers of nested parentheses, uncontrolled recursion exhausts the stack and produces a segmentation fault, terminating any LLM inference server that compiles caller-supplied grammars. Publicly available exploit code exists in the GitHub Security Advisory; the issue is not in CISA KEV and EPSS is low (0.06%), indicating no observed widespread exploitation.

v1 Mar 12, 2026 - 22:06 CVSS 7.5

xgrammar is an open-source library for efficient, flexible, and portable structured generation. Prior to version 0.1.32, the multi-level nested syntax caused a segmentation fault (core dumped).

RemediationAI

Vendor-released patch: upgrade xgrammar to version 0.1.32 or later (https://github.com/mlc-ai/xgrammar/releases/tag/v0.1.32), per advisory GHSA-7rgv-gqhr-fxg3. If you consume xgrammar through a Red Hat product, apply the corresponding errata (RHSA-2026:5809, RHSA-2026:6761, RHSA-2026:6762, or RHSA-2026:24977) to pick up the rebuilt package. Where immediate upgrade is not possible, reduce exposure by not allowing untrusted clients to supply arbitrary grammars/JSON schemas to the inference engine - restrict grammar input to server-side trusted templates, and add input validation that rejects excessively deep nesting before it reaches the parser (trade-off: legitimate deeply-nested schemas would be refused). Additionally place the inference endpoint behind authentication/rate limiting and run the worker under a supervisor that auto-restarts on crash to limit DoS dwell time (trade-off: restart-on-crash masks but does not prevent repeated outages).

Affected Packages

pypi xgrammar fix: 0.1.32

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

xgrammar is an open-source library (vendor mlc-ai, CPE cpe:2.3:a:mlc-ai:xgrammar) that compiles context-free grammars/JSON schemas into constraints for structured/guided generation in large language model serving stacks. The flaw is classified as CWE-674 (Uncontrolled Recursion): the grammar parser/matcher recurses without an effective depth bound, so multi-level nested syntax drives the parser into unbounded recursion that exhausts the native stack and causes a segmentation fault (core dumped). This is a memory-safety/availability failure in the native (C++/compiled) grammar-processing path rather than a logic bug in the Python wrapper, which is why it manifests as a process-terminating crash rather than a handled exception.

Know when Xgrammar gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (github) PRIMARY 8.7 HIGH
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
vuln.today AI 7.5 HIGH

Network-reachable, low-complexity, unauthenticated trigger via attacker-supplied nested grammar; impact is process crash only, so C:N/I:N and A:H with unchanged scope.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Red Hat 7.5 HIGH

Primary rating from Vendor (github).

CVSS VectorVendor: github

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

7
Analysis Updated
Jun 30, 2026 - 05:05 vuln.today
v5 - CVSS changed
Analysis Updated
Jun 30, 2026 - 05:03 vuln.today
v4 - CVSS changed
Analysis Updated
Jun 30, 2026 - 05:02 vuln.today
v3 - CVSS changed
Analysis Updated
Jun 30, 2026 - 05:01 vuln.today
v2 - CVSS changed
CVSS changed
Jun 30, 2026 - 03:24 NVD
7.5 (HIGH) 8.7 (HIGH)
Patch released
Mar 31, 2026 - 21:13 nvd
Patch available
CVE Published
Mar 05, 2026 - 16:16 nvd
HIGH 7.5

DescriptionCVE.org

xgrammar is an open-source library for efficient, flexible, and portable structured generation. Prior to version 0.1.32, the multi-level nested syntax caused a segmentation fault (core dumped). This issue has been patched in version 0.1.32.

Executive ViewAI

Why It Matters

The mlc-ai xgrammar library used in LLM inference services contains a denial-of-service vulnerability that enables attackers to crash inference servers, directly impacting availability of AI-driven applications. Organizations running xgrammar versions prior to 0.1.32 face service disruption risk, particularly if they accept external schema inputs. A vendor patch is available and deployment is straightforward.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.1%
Top 83% exploitable
Prevalence
Medium
structured-generation library embedded in LLM inference stacks, growing but not ubiquitous
Data Quality
6 sources
Confidence: High
NVD CVE.org EPSS Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.1%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Affected Products (CPE)CVE.org

cpe:2.3:a:mlc-ai:xgrammar:*:*:*:*:*:*:*:*

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy