Skip to content

GHSA-jfm3-95jq-q3rf league/commonmark: Denial of service via duplicate footnote definitions

HighCVSS 7.5
Published
Updated
Exploit status
No public exploit known
Technology
PHP

Description

Impact

The Footnote extension records one backref per footnote reference and then appends the entire backref list for every footnote definition block in the document, without ever de-duplicating or removing repeated definitions of the same label (GatherFootnotesListener, populated by NumberFootnotesListener). A document that references a single label N times and also supplies N duplicate [^a]: definitions of that label therefore produces N × N FootnoteBackref nodes, so output size, parse time, and peak memory are all O(N²).

Reaching the vulnerable path requires FootnoteExtension to be registered on the Environment. This is opt-in, but is a commonly enabled GFM-style feature; no other non-default configuration is required. An unauthenticated attacker can expand a ~10 KB request into a ~62 MB HTML response, ~3 s of CPU, and ~440 MB of peak memory — enough to OOM-kill a default 128 MB PHP worker and deny service. Availability impact only; no confidentiality or integrity effect. The Footnote extension was introduced in 1.5.0 (May 2020) with this backref logic present from the first commit, so all releases from 1.5.0 onward (including every 2.x through 2.8.x) are affected.

Workarounds

There is no library-level option to cap the number of footnotes, references, or definitions, so no configuration switch prevents the amplification. Integrators who cannot upgrade should:

  • Disable the Footnote extension for untrusted input, or
  • Enforce a strict input-size limit before conversion — but note this is a weak control here, since the ~10 KB payload that already triggers the 62 MB / ~440 MB blowup is well within typical request-body limits, so any cap must be aggressively small to help.

Upgrading to the patched release is the recommended remediation.

Upgrade path

1 package: 1 fixed.

PackageAffectedFixed inStatus
league/commonmark(Packagist) = 1.5.0; = 1.5.1; = 1.5.2; = 1.5.3 +62 more 2.9.0 Fixed

Affected products

ProductAffected versionsFixed in
league/commonmark(Packagist) >= 1.5.0, < 2.9.0 2.9.0
league/commonmark(Packagist) = 1.5.0 No fix listed
league/commonmark(Packagist) = 1.5.1 No fix listed
league/commonmark(Packagist) = 1.5.2 No fix listed
league/commonmark(Packagist) = 1.5.3 No fix listed
league/commonmark(Packagist) = 1.5.4 No fix listed
league/commonmark(Packagist) = 1.5.5 No fix listed
league/commonmark(Packagist) = 1.5.6 No fix listed
league/commonmark(Packagist) = 1.5.7 No fix listed
league/commonmark(Packagist) = 1.5.8 No fix listed
league/commonmark(Packagist) = 1.6.0 No fix listed
league/commonmark(Packagist) = 1.6.1 No fix listed
league/commonmark(Packagist) = 1.6.2 No fix listed
league/commonmark(Packagist) = 1.6.3 No fix listed
league/commonmark(Packagist) = 1.6.4 No fix listed
league/commonmark(Packagist) = 1.6.5 No fix listed
league/commonmark(Packagist) = 1.6.6 No fix listed
league/commonmark(Packagist) = 1.6.7 No fix listed
league/commonmark(Packagist) = 2.0.0 No fix listed
league/commonmark(Packagist) = 2.0.0-beta1 No fix listed
league/commonmark(Packagist) = 2.0.0-beta2 No fix listed
league/commonmark(Packagist) = 2.0.0-beta3 No fix listed
league/commonmark(Packagist) = 2.0.0-rc1 No fix listed
league/commonmark(Packagist) = 2.0.0-rc2 No fix listed
league/commonmark(Packagist) = 2.0.1 No fix listed
Show 41 more
ProductAffected versionsFixed in
league/commonmark(Packagist) = 2.0.2 No fix listed
league/commonmark(Packagist) = 2.0.3 No fix listed
league/commonmark(Packagist) = 2.0.4 No fix listed
league/commonmark(Packagist) = 2.1.0 No fix listed
league/commonmark(Packagist) = 2.1.1 No fix listed
league/commonmark(Packagist) = 2.1.2 No fix listed
league/commonmark(Packagist) = 2.1.3 No fix listed
league/commonmark(Packagist) = 2.2.0 No fix listed
league/commonmark(Packagist) = 2.2.1 No fix listed
league/commonmark(Packagist) = 2.2.2 No fix listed
league/commonmark(Packagist) = 2.2.3 No fix listed
league/commonmark(Packagist) = 2.2.4 No fix listed
league/commonmark(Packagist) = 2.2.5 No fix listed
league/commonmark(Packagist) = 2.3.0 No fix listed
league/commonmark(Packagist) = 2.3.1 No fix listed
league/commonmark(Packagist) = 2.3.2 No fix listed
league/commonmark(Packagist) = 2.3.3 No fix listed
league/commonmark(Packagist) = 2.3.4 No fix listed
league/commonmark(Packagist) = 2.3.5 No fix listed
league/commonmark(Packagist) = 2.3.6 No fix listed
league/commonmark(Packagist) = 2.3.7 No fix listed
league/commonmark(Packagist) = 2.3.8 No fix listed
league/commonmark(Packagist) = 2.3.9 No fix listed
league/commonmark(Packagist) = 2.4.0 No fix listed
league/commonmark(Packagist) = 2.4.1 No fix listed
league/commonmark(Packagist) = 2.4.2 No fix listed
league/commonmark(Packagist) = 2.4.3 No fix listed
league/commonmark(Packagist) = 2.4.4 No fix listed
league/commonmark(Packagist) = 2.5.0 No fix listed
league/commonmark(Packagist) = 2.5.1 No fix listed
league/commonmark(Packagist) = 2.5.2 No fix listed
league/commonmark(Packagist) = 2.5.3 No fix listed
league/commonmark(Packagist) = 2.6.0 No fix listed
league/commonmark(Packagist) = 2.6.1 No fix listed
league/commonmark(Packagist) = 2.6.2 No fix listed
league/commonmark(Packagist) = 2.7.0 No fix listed
league/commonmark(Packagist) = 2.7.1 No fix listed
league/commonmark(Packagist) = 2.8.0 No fix listed
league/commonmark(Packagist) = 2.8.1 No fix listed
league/commonmark(Packagist) = 2.8.2 No fix listed
league/commonmark(Packagist) = 2.8.3 No fix listed

References