GHSA-c2pc-g5qf-rfrf: League/commonmark Denial of Service Vulnerability

HIGH
CVSS 7.5
CWE-407
Published
Advisory Summary

GHSA-c2pc-g5qf-rfrf 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 league/commonmark's quadratic complexity bugs may lead to a denial of service. Remediation is available by upgrading affected packages to version 2.6.0.

GHSA-c2pc-g5qf-rfrf at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-c2pc-g5qf-rfrf
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-407: Inefficient Algorithmic Complexity
Affected Product League/commonmark
Package Ecosystem Packagist
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix GHSA-c2pc-g5qf-rfrf

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.

league/commonmark fixed: 2.6.0
Upgrade league/commonmark to 2.6.0
Verify Direct and Transitive Dependencies

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-c2pc-g5qf-rfrf, 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.6.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

### Impact Several polynomial time complexity issues in league/commonmark may lead to unbounded resource exhaustion and subsequent denial of service. Malicious users could trigger that inefficient code with carefully crafted Markdown inputs that are specifically designed to ensure the worst-case performance is reached. Sending multiple such requests in parallel could tie up all available CPU resources and/or PHP-FPM processes, leading to denial of service for legitimate users. ### Patches These vulnerabilities have been patched in version 2.6.0. All users on older versions are highly encouraged to upgrade as soon as possible. ### Workarounds If you cannot upgrade, you may be able to mitigate the issues by: - Setting very low `memory_limit` and `max_execution_time` PHP configurations to prevent runaway resource usage - Implementing rate-limiting, bot protection, or other approaches to reduce the risk of simultaneous bad requests hitting your site - Limiting the size of inputs fed into this library (specifically the max length of each line) - Limiting the use of this library to trusted users ### References Most of these issues were discovered in other Markdown parsers. You can read more about them here: * https://github.com/commonmark/commonmark.js/issues/129 * https://github.com/commonmark/commonmark.js/issues/157 * https://github.com/commonmark/commonmark.js/issues/172 * https://github.com/github/cmark-gfm/security/advisories/GHSA-r572-jvj2-3m8p * https://github.com/github/cmark-gfm/security/advisories/GHSA-24f7-9frr-5h2r * https://github.com/github/cmark-gfm/security/advisories/GHSA-29g3-96g3-jg6c * https://github.com/github/cmark-gfm/security/advisories/GHSA-r8vr-c48j-fcc5 * https://github.com/github/cmark-gfm/security/advisories/GHSA-w4qg-3vf7-m9x5 * https://github.com/github/cmark-gfm/security/advisories/GHSA-66g8-4hjf-77xh For general information about this type of issue: * https://en.wikipedia.org/wiki/Time_complexity * https://cwe.mitre.org/data/definitions/407.html

GHSA-c2pc-g5qf-rfrf Affected League/commonmark Versions

1 component(s)
Fixed Versions:
2.6.0
Product / Package Ecosystem Affected Versions Fixed Version
league/commonmark
Packagist
< 2.6.0
2.6.0

References

Frequently Asked Questions

What is GHSA-c2pc-g5qf-rfrf?
GHSA-c2pc-g5qf-rfrf is a security vulnerability in League/commonmark involving league/commonmark's quadratic complexity bugs may lead to a denial of service under CWE-407: Inefficient Algorithmic Complexity.
Which League/commonmark versions are affected?
Affected versions include releases prior to 2.6.0 across affected packages: league/commonmark.
What version fixes GHSA-c2pc-g5qf-rfrf?
Upgrading to 2.6.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is league/commonmark affected?
Yes, league/commonmark is affected in releases prior to 2.6.0. Upgrade your dependency to 2.6.0 or later.
What is the CVSS score of GHSA-c2pc-g5qf-rfrf?
GHSA-c2pc-g5qf-rfrf has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with GHSA-c2pc-g5qf-rfrf?
GHSA-c2pc-g5qf-rfrf is classified under CWE-407: Inefficient Algorithmic Complexity (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.).
How can I check Packagist dependencies for GHSA-c2pc-g5qf-rfrf?
Run the dependency tree command: 'inspect dependencies for league/commonmark'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c2pc-g5qf-rfrf",
  "modified" : "2024-12-09T20:42:08Z",
  "published" : "2024-12-09T20:42:07Z",
  "aliases" : [ ],
  "summary" : "league/commonmark's quadratic complexity bugs may lead to a denial of service",
  "details" : "### Impact\n\nSeveral polynomial time complexity issues in league/commonmark may lead to unbounded resource exhaustion and subsequent denial of service.\n\nMalicious users could trigger that inefficient code with carefully crafted Markdown inputs that are specifically designed to ensure the worst-case performance is reached.  Sending multiple such requests in parallel could tie up all available CPU resources and/or PHP-FPM processes, leading to denial of service for legitimate users.\n\n### Patches\n\nThese vulnerabilities have been patched in version 2.6.0.  All users on older versions are highly encouraged to upgrade as soon as possible.\n\n### Workarounds\n\nIf you cannot upgrade, you may be able to mitigate the issues by:\n\n- Setting very low `memory_limit` and `max_execution_time` PHP configurations to prevent runaway resource usage\n- Implementing rate-limiting, bot protection, or other approaches to reduce the risk of simultaneous bad requests hitting your site\n- Limiting the size of inputs fed into this library (specifically the max length of each line)\n- Limiting the use of this library to trusted users\n\n### References\n\nMost of these issues were discovered in other Markdown parsers. You can read more about them here:\n\n* https://github.com/commonmark/commonmark.js/issues/129\n* https://github.com/commonmark/commonmark.js/issues/157\n* https://github.com/commonmark/commonmark.js/issues/172\n* https://github.com/github/cmark-gfm/security/advisories/GHSA-r572-jvj2-3m8p\n* https://github.com/github/cmark-gfm/security/advisories/GHSA-24f7-9frr-5h2r\n* https://github.com/github/cmark-gfm/security/advisories/GHSA-29g3-96g3-jg6c\n* https://github.com/github/cmark-gfm/security/advisories/GHSA-r8vr-c48j-fcc5\n* https://github.com/github/cmark-gfm/security/advisories/GHSA-w4qg-3vf7-m9x5\n* https://github.com/github/cmark-gfm/security/advisories/GHSA-66g8-4hjf-77xh\n\nFor general information about this type of issue:\n\n* https://en.wikipedia.org/wiki/Time_complexity\n* https://cwe.mitre.org/data/definitions/407.html\n",
  "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" : "0"
      }, {
        "fixed" : "2.6.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/github/cmark-gfm/security/advisories/GHSA-24f7-9frr-5h2r"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/cmark-gfm/security/advisories/GHSA-29g3-96g3-jg6c"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/cmark-gfm/security/advisories/GHSA-66g8-4hjf-77xh"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/cmark-gfm/security/advisories/GHSA-r572-jvj2-3m8p"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/cmark-gfm/security/advisories/GHSA-r8vr-c48j-fcc5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/github/cmark-gfm/security/advisories/GHSA-w4qg-3vf7-m9x5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/thephpleague/commonmark/security/advisories/GHSA-c2pc-g5qf-rfrf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/commonmark/commonmark.js/issues/129"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/commonmark/commonmark.js/issues/157"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/commonmark/commonmark.js/issues/172"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/thephpleague/commonmark"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-407" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-12-09T20:42:07Z",
    "nvd_published_at" : null
  }
}