CVE-2024-58382
JSON

8.7high

league/commonmark before 2.6.0 Denial of Service via Quadratic Complexity

Severity
8.7high CVSS:4.0 by VulnCheck
Exploit likelihood
0.28% (higher than 21% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
VulnCheck
Also known as
GHSA-c2pc-g5qf-rfrf

Description

league/commonmark versions before 2.6.0 contain polynomial time complexity vulnerabilities in Markdown parsing that allow attackers to cause denial of service. Attackers can submit carefully crafted Markdown inputs designed to trigger worst-case performance, and sending multiple requests in parallel exhausts CPU resources and PHP-FPM processes.

Affected

Product or packageVersionsReported by
thephpleague commonmarkbefore 2.6.0
Not affected: 2.6.0
CVE List
league/commonmark (Packagist)before 2.6.0GitHub Advisory Database

All scores

VulnCheck8.7high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
VulnCheck7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Classification

CWE-407

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

league/commonmark versions before 2.6.0 contain polynomial time complexity vulnerabilities in Markdown parsing that allow attackers to cause denial of service. Attackers can submit carefully crafted Markdown inputs designed to trigger worst-case performance, and sending multiple requests in parallel exhausts CPU resources and PHP-FPM processes.

GitHub Advisory Database
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:

For general information about this type of issue:

NVD (es)

Las versiones de league/commonmark anteriores a la 2.6.0 contienen vulnerabilidades de complejidad temporal polinómica en el análisis sintáctico de Markdown que permiten a los atacantes causar denegación de servicio. Los atacantes pueden enviar entradas de Markdown cuidadosamente elaboradas diseñadas para desencadenar el peor rendimiento posible, y el envío de múltiples solicitudes en paralelo agota los recursos de la CPU y los procesos de PHP-FPM.

References

https://github.com/thephpleague/commonmark/security/advisories/GHSA-c2pc-g5qf-rfrfvendor-advisory, web
https://www.vulncheck.com/advisories/league-commonmark-before-2.6.0-denial-of-service-via-quadratic-complexitythird-party-advisory
https://github.com/github/cmark-gfm/security/advisories/GHSA-24f7-9frr-5h2rweb
https://github.com/github/cmark-gfm/security/advisories/GHSA-29g3-96g3-jg6cweb
https://github.com/github/cmark-gfm/security/advisories/GHSA-66g8-4hjf-77xhweb
https://github.com/github/cmark-gfm/security/advisories/GHSA-r572-jvj2-3m8pweb
https://github.com/github/cmark-gfm/security/advisories/GHSA-r8vr-c48j-fcc5web
https://github.com/github/cmark-gfm/security/advisories/GHSA-w4qg-3vf7-m9x5web
https://github.com/commonmark/commonmark.js/issues/129web
https://github.com/commonmark/commonmark.js/issues/157web
https://github.com/commonmark/commonmark.js/issues/172web
https://github.com/thephpleague/commonmarkpackage

Sources

SourceRecordLicence
CVE ListCVE-2024-58382 changed 2026-10-08CVE Terms of Use
GitHub Advisory DatabaseGHSA-c2pc-g5qf-rfrf changed 2026-09-10CC-BY-4.0
NVDCVE-2024-58382 changed 2026-10-27Public domain