league/commonmark: Denial of service via deeply nested XML output
The league/commonmark library's XmlRenderer component can cause a denial of service via excessive memory and output size when rendering deeply nested XML. This occurs because indentation whitespace grows quadratically with the depth of the XML tree, which can be triggered by deeply nested Markdown blockquotes or attacker-influenced ASTs. The vulnerability affects all 2.x versions from 2.0.0 up to but not including 2.9.0. There is no impact on confidentiality or integrity, only availability due to resource exhaustion. Mitigations include lowering the parser's max_nesting_level, capping input size, constraining XML consumers, or preferring HTML rendering for untrusted content. A patch is available.
AI Analysis
Technical Summary
The XmlRenderer in league/commonmark pretty-prints XML by emitting indentation proportional to the depth of each opening and closing tag, resulting in O(n²) output size and memory usage for a tree of depth n. This can be exploited by providing deeply nested Markdown content or attacker-controlled ASTs to cause denial of service through resource exhaustion. The parser's max_nesting_level setting limits parser-generated trees but does not constrain programmatically built ASTs passed directly to the renderer. This issue affects all 2.x releases starting from 2.0.0 (including 2.0.0-beta1) through versions before 2.9.0. The vulnerability does not affect 1.x versions, which lack XML rendering. The impact is limited to availability (memory/output size amplification) without confidentiality or integrity compromise. The vulnerability is rated medium severity with a CVSS 3.1 score of 5.3 (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
Potential Impact
This vulnerability can cause denial of service by consuming excessive memory and producing very large output when rendering deeply nested XML from untrusted Markdown input or attacker-influenced ASTs. There is no confidentiality or integrity impact. The resource exhaustion arises from the quadratic growth of indentation whitespace with XML tree depth, potentially leading to application slowdown or crash due to memory exhaustion.
Mitigation Recommendations
A patch is available for this vulnerability. Applications converting untrusted Markdown to XML should lower the max_nesting_level parser setting to a conservative value to limit tree depth, cap input size before conversion, and constrain XML consumers with memory or output size limits. Prefer HTML rendering for untrusted content when XML output is not strictly required, as the HTML renderer does not exhibit this amplification. Since the vulnerability affects programmatically built ASTs passed directly to XmlRenderer, additional input validation or limiting such usage is recommended.
league/commonmark: Denial of service via deeply nested XML output
Description
The league/commonmark library's XmlRenderer component can cause a denial of service via excessive memory and output size when rendering deeply nested XML. This occurs because indentation whitespace grows quadratically with the depth of the XML tree, which can be triggered by deeply nested Markdown blockquotes or attacker-influenced ASTs. The vulnerability affects all 2.x versions from 2.0.0 up to but not including 2.9.0. There is no impact on confidentiality or integrity, only availability due to resource exhaustion. Mitigations include lowering the parser's max_nesting_level, capping input size, constraining XML consumers, or preferring HTML rendering for untrusted content. A patch is available.
CVSS v3.1
Score 5.3medium
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The XmlRenderer in league/commonmark pretty-prints XML by emitting indentation proportional to the depth of each opening and closing tag, resulting in O(n²) output size and memory usage for a tree of depth n. This can be exploited by providing deeply nested Markdown content or attacker-controlled ASTs to cause denial of service through resource exhaustion. The parser's max_nesting_level setting limits parser-generated trees but does not constrain programmatically built ASTs passed directly to the renderer. This issue affects all 2.x releases starting from 2.0.0 (including 2.0.0-beta1) through versions before 2.9.0. The vulnerability does not affect 1.x versions, which lack XML rendering. The impact is limited to availability (memory/output size amplification) without confidentiality or integrity compromise. The vulnerability is rated medium severity with a CVSS 3.1 score of 5.3 (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
Potential Impact
This vulnerability can cause denial of service by consuming excessive memory and producing very large output when rendering deeply nested XML from untrusted Markdown input or attacker-influenced ASTs. There is no confidentiality or integrity impact. The resource exhaustion arises from the quadratic growth of indentation whitespace with XML tree depth, potentially leading to application slowdown or crash due to memory exhaustion.
Mitigation Recommendations
A patch is available for this vulnerability. Applications converting untrusted Markdown to XML should lower the max_nesting_level parser setting to a conservative value to limit tree depth, cap input size before conversion, and constrain XML consumers with memory or output size limits. Prefer HTML rendering for untrusted content when XML output is not strictly required, as the HTML renderer does not exhibit this amplification. Since the vulnerability affects programmatically built ASTs passed directly to XmlRenderer, additional input validation or limiting such usage is recommended.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-mj63-m3rc-8ppr
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["Packagist"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 3.1
Threat ID: 6a7573c1bf8831d539d945bc
Added to database: 08/07/2026, 05:57:21 UTC
Last enriched: 08/07/2026, 07:00:33 UTC
Last updated: 08/07/2026, 08:02:46 UTC
Views: 4
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.