league/commonmark: Denial of service via deeply nested XML output
Affects league/commonmarkSource GCVE Database
CVSS 5.3 Medium : upgrade to 2.9.0 when convenient.
Data as of 7 Aug 2026, 07:00 UTC
- Patch
- Available – fixed in 2.9.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LWhat to do
Upgrade league/commonmark to 2.9.0.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| Packagistleague/commonmark | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
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.
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.
References
- github.com/thephpleague/commonmark/security/advisories/GHSA-mj63-m3rc-8ppr (opens in a new tab)
- github.com/thephpleague/commonmark/commit/b5ac8c3947ca81844e85a09c7e0a5b4148bde2e1 (opens in a new tab)
- github.com/thephpleague/commonmark (opens in a new tab)
- github.com/thephpleague/commonmark/releases/tag/2.9.0 (opens in a new tab)