Inefficient Algorithmic Complexity Affecting league/commonmark package, versions >=1.5.0, <2.9.1


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.52% (42nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PHP-LEAGUECOMMONMARK-20158924
  • published27 Sept 2026
  • disclosed7 Sept 2026
  • creditUnknown

Introduced: 7 Sep 2026

CVE-2026-86429  (opens in a new tab)
CWE-407  (opens in a new tab)

How to fix?

Upgrade league/commonmark to version 2.9.1 or higher.

Overview

league/commonmark is a PHP-based Markdown parser which supports the full CommonMark spec. It is based on the CommonMark JS reference implementation.

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity through the AttributesListener::findTargetAndDirection() path in src/Extension/Attributes/Event/AttributesListener.php and the block-attribute merge logic in src/Extension/Attributes/Parser/AttributesBlockContinueParser.php and src/Extension/Attributes/Util/AttributesHelper.php. An attacker can exhaust CPU and stall Markdown conversion by submitting crafted input with long runs of block-level attribute nodes or repeated .class attributes. The vulnerable code repeatedly rescans sibling chains for block-level attributes and rebuilds the accumulated class list on each merge, producing quadratic parsing time. In affected applications that register the Attributes extension on untrusted Markdown, a small request can tie up PHP workers and prevent legitimate conversions from completing.

Workarounds

  • Do not register AttributesExtension when converting untrusted Markdown; this removes the block-attribute scanning and class-list merge paths that can be driven into quadratic CPU use.
  • If AttributesExtension is required, impose a strict maximum input length before conversion so attackers cannot supply long runs of block-level attributes or repeated .class attributes that trigger the expensive parsing path.

CVSS Base Scores

version 4.0
version 3.1