CVE-2021-27291
JSON

7.5high

Pygments vulnerable to Regular Expression Denial of Service (ReDoS)

Severity
7.5high CVSS:3.1 by NVD
Exploit likelihood
3.91% (higher than 90% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-pq64-v7f5-gqh8PYSEC-2021-141

Description

In pygments 1.1+, fixed in 2.7.4, the lexers used to parse programming languages rely heavily on regular expressions. Some of the regular expressions have exponential or cubic worst-case complexity and are vulnerable to ReDoS. By crafting malicious input, an attacker can cause a denial of service.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
pygments (PyPI)from 1.1 before 2.7.4, before 2e7e8c4a7b318f4032493773732754e418279a14GitHub Advisory Database, PyPA Advisory Database
pygments pygmentsfrom 1.1 before 2.7.4NVD
debian debian_linux9.0, 10.0NVD
fedoraproject fedora32, 33NVD

All scores

GitHub7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
GitHubhigh 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
NVD7.5high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
NVD5.0medium CVSS:2.0AV:N/AC:L/Au:N/C:N/I:N/A:P

Classification

What each source says

CVE List

In pygments 1.1+, fixed in 2.7.4, the lexers used to parse programming languages rely heavily on regular expressions. Some of the regular expressions have exponential or cubic worst-case complexity and are vulnerable to ReDoS. By crafting malicious input, an attacker can cause a denial of service.

NVD (es)

En pygments versión 1.1+, corregido en 2.7.4, los lexers usados para analizar unos lenguajes de programación dependen en gran medida en expresiones regulares. Algunas de las expresiones regulares presentan una complejidad exponencial o cúbica en el peor de los casos y son vulnerables a ReDoS. Al diseñar una entrada maliciosa, un atacante puede causar una denegación de servicio

References

https://gist.github.com/b-c-ds/b1a2cc0c68a35c57188575eb496de5ceexploit, third-party-advisory, web
https://github.com/pygments/pygments/commit/2e7e8c4a7b318f4032493773732754e418279a14fix, patch, third-party-advisory, web
https://lists.debian.org/debian-lts-announce/2021/03/msg00024.htmlmailing-list, third-party-advisory, web
https://www.debian.org/security/2021/dsa-4878advisory, third-party-advisory, vendor-advisory, web
https://www.debian.org/security/2021/dsa-4889advisory, third-party-advisory, vendor-advisory, web
https://lists.debian.org/debian-lts-announce/2021/05/msg00003.htmlmailing-list, third-party-advisory, web
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/GSJRFHALQ7E3UV4FFMFU2YQ6LUDHAI55/vendor-advisory
https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WSLD67LFGXOX2K5YNESSWAS4AGZIJTUQ/vendor-advisory
https://lists.debian.org/debian-lts-announce/2021/05/msg00006.htmlmailing-list, third-party-advisory, web
https://nvd.nist.gov/vuln/detail/CVE-2021-27291advisory
https://github.com/pygments/pygmentspackage
https://github.com/pypa/advisory-database/tree/main/vulns/pygments/PYSEC-2021-141.yamlweb

Sources

SourceRecordLicence
CVE ListCVE-2021-27291 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-pq64-v7f5-gqh8 changed 2024-10-14CC-BY-4.0
NVDCVE-2021-27291 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2021-141 changed 2023-11-08CC-BY-4.0