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


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.49% (40th 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-20158941
  • published27 Sept 2026
  • disclosed7 Sept 2026
  • creditcolinodell

Introduced: 7 Sep 2026

CVE-2026-86430  (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 due to quadratic reference link label lookup in CloseBracketParser and ReferenceMap when resolving shortcut and collapsed reference links in the CommonMark parser. An attacker can exhaust CPU by sending Markdown with deeply nested brackets plus a single reference definition, causing each closing bracket to normalize and compare an increasingly long label span. This affects applications that convert untrusted Markdown with the default CommonMarkConverter; the result is sustained CPU consumption that can stall PHP workers and delay or prevent legitimate requests from completing.

Workarounds

  • Enforce a maximum length for individual lines before passing Markdown to the converter, because each trigger fits on a single line and a genuinely small per-line cap bounds the worst-case CPU cost from deeply nested reference-link input.
  • Restrict Markdown conversion to trusted users only, so untrusted attackers cannot submit crafted reference-link payloads that consume disproportionate CPU time.
  • Apply strict execution-time limits and rate-limit conversion requests, which reduces the impact of repeated expensive parses and limits how long a single crafted request can tie up a PHP worker.

CVSS Base Scores

version 4.0
version 3.1