CVE-2025-57809: CWE-674: Uncontrolled Recursion in mlc-ai xgrammar
XGrammar is an open-source library for efficient, flexible, and portable structured generation. Prior to version 0.1.21, XGrammar has an infinite recursion issue in the grammar. This issue has been resolved in version 0.1.21.
AI Analysis
Technical Summary
CVE-2025-57809 is a high-severity vulnerability affecting versions of the open-source library XGrammar prior to 0.1.21. XGrammar, developed by mlc-ai, is designed for efficient, flexible, and portable structured generation. The vulnerability is classified under CWE-674, which pertains to uncontrolled recursion. Specifically, the issue arises from an infinite recursion condition in the grammar processing logic of the library. This flaw can cause the application using the vulnerable XGrammar versions to enter an infinite recursive loop, leading to stack overflow and ultimately denial of service (DoS) due to resource exhaustion. The CVSS 4.0 base score of 7.7 reflects a high severity, with the vector indicating that the vulnerability is remotely exploitable over the network without any authentication or user interaction required. The impact is primarily on availability, as the infinite recursion can crash or hang the affected application. No known exploits are currently reported in the wild, and the issue was resolved in version 0.1.21 of XGrammar. Since XGrammar is a library, the risk depends on its integration into larger software systems, which may be used in various domains requiring structured generation capabilities.
Potential Impact
For European organizations, the impact of this vulnerability can be significant if they rely on software products or internal tools that incorporate vulnerable versions of XGrammar. The uncontrolled recursion can cause critical applications to become unresponsive or crash, leading to service outages and potential disruption of business operations. This is particularly concerning for sectors with high availability requirements such as finance, healthcare, telecommunications, and critical infrastructure. Additionally, denial of service conditions could be exploited by attackers to degrade service quality or cause operational interruptions. Since the vulnerability does not require authentication or user interaction, it could be exploited remotely, increasing the risk of automated attacks. Organizations using XGrammar in development or production environments must assess their exposure and prioritize patching to avoid potential service disruptions and maintain operational continuity.
Mitigation Recommendations
To mitigate this vulnerability, European organizations should: 1) Identify all instances where XGrammar is used, including direct dependencies and transitive dependencies in software projects. 2) Upgrade all affected XGrammar versions to 0.1.21 or later, where the infinite recursion issue is fixed. 3) If immediate upgrading is not feasible, implement runtime safeguards such as limiting recursion depth or applying input validation to prevent malicious or malformed grammar inputs that could trigger infinite recursion. 4) Monitor application logs and performance metrics for signs of recursion-related crashes or hangs. 5) Incorporate static and dynamic analysis tools in the development pipeline to detect unsafe grammar definitions or recursive patterns. 6) Engage with software vendors or third-party providers to ensure they have patched this vulnerability in their products. 7) Establish incident response plans to quickly address potential denial of service incidents linked to this vulnerability.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Finland, Italy, Spain
CVE-2025-57809: CWE-674: Uncontrolled Recursion in mlc-ai xgrammar
Description
XGrammar is an open-source library for efficient, flexible, and portable structured generation. Prior to version 0.1.21, XGrammar has an infinite recursion issue in the grammar. This issue has been resolved in version 0.1.21.
AI-Powered Analysis
Technical Analysis
CVE-2025-57809 is a high-severity vulnerability affecting versions of the open-source library XGrammar prior to 0.1.21. XGrammar, developed by mlc-ai, is designed for efficient, flexible, and portable structured generation. The vulnerability is classified under CWE-674, which pertains to uncontrolled recursion. Specifically, the issue arises from an infinite recursion condition in the grammar processing logic of the library. This flaw can cause the application using the vulnerable XGrammar versions to enter an infinite recursive loop, leading to stack overflow and ultimately denial of service (DoS) due to resource exhaustion. The CVSS 4.0 base score of 7.7 reflects a high severity, with the vector indicating that the vulnerability is remotely exploitable over the network without any authentication or user interaction required. The impact is primarily on availability, as the infinite recursion can crash or hang the affected application. No known exploits are currently reported in the wild, and the issue was resolved in version 0.1.21 of XGrammar. Since XGrammar is a library, the risk depends on its integration into larger software systems, which may be used in various domains requiring structured generation capabilities.
Potential Impact
For European organizations, the impact of this vulnerability can be significant if they rely on software products or internal tools that incorporate vulnerable versions of XGrammar. The uncontrolled recursion can cause critical applications to become unresponsive or crash, leading to service outages and potential disruption of business operations. This is particularly concerning for sectors with high availability requirements such as finance, healthcare, telecommunications, and critical infrastructure. Additionally, denial of service conditions could be exploited by attackers to degrade service quality or cause operational interruptions. Since the vulnerability does not require authentication or user interaction, it could be exploited remotely, increasing the risk of automated attacks. Organizations using XGrammar in development or production environments must assess their exposure and prioritize patching to avoid potential service disruptions and maintain operational continuity.
Mitigation Recommendations
To mitigate this vulnerability, European organizations should: 1) Identify all instances where XGrammar is used, including direct dependencies and transitive dependencies in software projects. 2) Upgrade all affected XGrammar versions to 0.1.21 or later, where the infinite recursion issue is fixed. 3) If immediate upgrading is not feasible, implement runtime safeguards such as limiting recursion depth or applying input validation to prevent malicious or malformed grammar inputs that could trigger infinite recursion. 4) Monitor application logs and performance metrics for signs of recursion-related crashes or hangs. 5) Incorporate static and dynamic analysis tools in the development pipeline to detect unsafe grammar definitions or recursive patterns. 6) Engage with software vendors or third-party providers to ensure they have patched this vulnerability in their products. 7) Establish incident response plans to quickly address potential denial of service incidents linked to this vulnerability.
Affected Countries
For access to advanced analysis and higher rate limits, contact root@offseq.com
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2025-08-20T14:30:35.010Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 68acd67cad5a09ad004ff987
Added to database: 8/25/2025, 9:32:44 PM
Last enriched: 8/25/2025, 9:48:25 PM
Last updated: 8/25/2025, 9:48:25 PM
Views: 2
Related Threats
CVE-2025-9429: Cross Site Scripting in mtons mblog
MediumCVE-2025-9426: SQL Injection in itsourcecode Online Tour and Travel Management System
MediumCVE-2025-9425: SQL Injection in itsourcecode Online Tour and Travel Management System
MediumCVE-2025-9424: OS Command Injection in Ruijie WS7204-A
MediumCVE-2025-9423: SQL Injection in Campcodes Online Water Billing System
MediumActions
Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.
Need enhanced features?
Contact root@offseq.com for Pro access with improved analysis and higher rate limits.