league/commonmark: Denial of service via colliding heading slugs
Affects league/commonmarkSource GCVE Database
CVSS 7.5 High : upgrade to 2.9.0 soon.
Data as of 7 Aug 2026, 06:11 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:HWhat 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 that removes the quadratic behavior while maintaining unique slug IDs and output correctness. Users should upgrade to a patched release at or beyond version 2.9.0. As temporary workarounds, integrators can disable slug uniqueness by setting slug_normalizer/unique to false, disable the HeadingPermalinkExtension and TableOfContentsExtension (which depends on it), and FootnoteExtension for untrusted Markdown, or limit document size and heading count upstream to avoid triggering the quadratic cost. These workarounds trade off functionality or correctness and are not recommended long-term.
Description
A denial of service vulnerability exists in league/commonmark versions 2.0.0 through 2.8.x due to a quadratic algorithmic complexity in the UniqueSlugNormalizer::normalize() function. This function restarts its search for unique slug suffixes from 1 on every collision, causing O(K²) CPU cost for K colliding slugs. The issue affects processing of headings and footnotes when certain extensions are enabled, allowing an attacker to cause significant CPU consumption and service disruption without authentication. Workarounds include disabling slug uniqueness or affected extensions, but upgrading to a patched release is recommended.