GHSA-g2gp-3wwq-f4ph: league/commonmark Denial of Service Vulnerability
HIGHGHSA-g2gp-3wwq-f4ph is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-407: Inefficient Algorithmic Complexity) affecting league/commonmark libraries in the Packagist ecosystem. The issue involves denial of service via adjacent inline attribute blocks. Remediation is available by upgrading affected packages to version 2.9.0.
GHSA-g2gp-3wwq-f4ph at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix GHSA-g2gp-3wwq-f4ph
To remediate this vulnerability, upgrade all affected league/commonmark dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade league/commonmark to 2.9.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for league/commonmark
How to Check if You Are Affected
To determine whether your application is affected by GHSA-g2gp-3wwq-f4ph, inspect your project dependencies for league/commonmark:
inspect dependencies for league/commonmark
Analyze the terminal output to locate any version of league/commonmark in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.9.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-407: Inefficient Algorithmic Complexity, where an algorithm in a product has an inefficient worst-case computational complexity that may be detrimental to system performance and can be triggered by an attacker, typically using crafted manipulations that ensure that the worst case is being reached. In league/commonmark, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-g2gp-3wwq-f4ph Affected league/commonmark Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
league/commonmark
|
Packagist |
≥ 1.5.0
< 2.9.0
|
2.9.0
|
References
Frequently Asked Questions
What is GHSA-g2gp-3wwq-f4ph?
Which league/commonmark versions are affected?
What version fixes GHSA-g2gp-3wwq-f4ph?
Is league/commonmark affected?
What is the CVSS score of GHSA-g2gp-3wwq-f4ph?
What CWE is associated with GHSA-g2gp-3wwq-f4ph?
How can I check Packagist dependencies for GHSA-g2gp-3wwq-f4ph?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-g2gp-3wwq-f4ph",
"modified" : "2026-08-06T20:39:52Z",
"published" : "2026-08-06T20:39:52Z",
"aliases" : [ ],
"summary" : "league/commonmark: Denial of service via adjacent inline attribute blocks",
"details" : "### Impact\n\nWith the Attributes extension enabled, `AttributesListener::findTargetAndDirection()` resolves each attribute node's target by walking outward through its siblings. For a run of N adjacent inline attribute blocks placed at the start of a block (with nothing to their left), each node scans the **entire** sibling list to the far-right end before giving up and falling back to the parent. Each resolution is therefore Θ(N) and the whole run is **Θ(N²)**.\n\nReaching the path requires `AttributesExtension` (opt-in, but first-party: `League\\CommonMark\\Extension\\Attributes\\AttributesExtension`). No other configuration matters — the quadratic walk runs unconditionally during parsing and is **not** gated by the `attributes/allow` allow-list, the `on*` hardening added in 2.7.0, or `allow_unsafe_links`. An unauthenticated attacker can submit a **~32 KB** input (`{#a}` repeated 8,000 times) that takes **over 5 seconds** to convert, with time growing quadratically in input length — a cheap denial of service. Availability impact only. **The Attributes extension was introduced in 1.5.0 (May 2020) with this outward-walk resolver present from the first commit, so all releases from 1.5.0 onward (including every 2.x) are affected.**\n\n### Workarounds\n\nThere is no library-level configuration that gates the quadratic walk. Integrators who cannot upgrade can only reduce exposure indirectly:\n\n- **Disable the Attributes extension** for untrusted input, or\n- **Impose a strict maximum input length before conversion** — noting that because the cost is quadratic, even a modest cap must be small to meaningfully bound worst-case CPU.\n\nUpgrading to a release containing the fix is recommended.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "league/commonmark"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.5.0"
}, {
"fixed" : "2.9.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/thephpleague/commonmark/security/advisories/GHSA-g2gp-3wwq-f4ph"
}, {
"type" : "WEB",
"url" : "https://github.com/thephpleague/commonmark/commit/2d4c0fafa62501be919262064cffa6d71687430b"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/thephpleague/commonmark"
}, {
"type" : "WEB",
"url" : "https://github.com/thephpleague/commonmark/releases/tag/2.9.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-407" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-08-06T20:39:52Z",
"nvd_published_at" : null
}
}