Junglewise Threat Intelligence

thephpleague commonmark denial of service in UniqueSlugNormalizer

Severity: high · CVSS 7.5 · Published 2026-08-06

Executive brief

A performance vulnerability in the league/commonmark PHP library can allow an attacker to crash or slow down a website by providing specially crafted Markdown text. The library, which is used to convert Markdown into HTML, contains a flaw in how it handles duplicate headings, leading to excessive processor usage. This can result in a denial-of-service (DoS) condition where the server becomes unresponsive to legitimate users.

Technical details

The `UniqueSlugNormalizer::normalize()` function in league/commonmark versions 2.0.0 through 2.8.x exhibits O(K²) quadratic time complexity when handling colliding heading slugs. When generating unique anchors for headings, the normalizer restarts its search for an unused numeric suffix from '1' for every collision, leading to a massive increase in array lookups as the number of identical or empty headings increases. An unauthenticated remote attacker can exploit this by submitting a Markdown document with many identical headings or headings that normalize to empty strings (e.g., punctuation-only), causing high CPU consumption and service exhaustion. This affects configurations using `HeadingPermalinkExtension`, `FootnoteExtension`, or `TableOfContentsExtension`. The issue is resolved in version 2.9.0.

Affected products

  • thephpleague commonmark >= 2.0.0, < 2.9.0

Timeline

  • 2026-08-03: disclosed: Initial report to maintainers
  • 2026-08-06: advisory: GitHub Advisory published
  • 2026-08-06: patched: Version 2.9.0 released

References

Related threats