CVE-2021-27291
HIGH 7.5CVSS 3.1Pygments vulnerable to Regular Expression Denial of Service (ReDoS)
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.
- Published
- 17 Mar 2021
- Last modified
- 17 Jun 2026
- Assigned by
- cve@mitre.org
- NVD status
- Modified
- Weakness
- CWE-1333CWE-400
- Also known as
- GHSA-pq64-v7f5-gqh8PYSEC-2021-141
- Sources
- NVDJSONOSV GHSA-pq64-v7f5-gqh8JSONOSV PYSEC-2021-141JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| OSV | GitHub | CVSS 4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N | |
| NVD | nvd@nist.gov (Primary) | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| OSV | GitHub | CVSS 3.1 | HIGH 7.5 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| NVD | nvd@nist.gov (Primary) | CVSS 2.0 | MEDIUM 5.0 | AV:N/AC:L/Au:N/C:N/I:N/A:P |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | pygments | pygmentscpe:2.3:a:pygments:pygments:*:*:*:*:*:*:*:* |
>= 1.1, < 2.7.4 | 2.7.4 |
| NVD | debian | debian_linuxcpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:* |
= 9.0 | |
| NVD | debian | debian_linuxcpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* |
= 10.0 | |
| NVD | fedoraproject | fedoracpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:* |
= 32 | |
| NVD | fedoraproject | fedoracpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:* |
= 33 | |
| OSV | PyPI | pygments | >= 1.1, < 2.7.4 | 2.7.4 |
References
- https://gist.github.com/b-c-ds/b1a2cc0c68a35c57188575eb496de5ce · Exploit, Third Party Advisory, WEB
- https://github.com/pygments/pygments/commit/2e7e8c4a7b318f4032493773732754e418279a14 · Patch, Third Party Advisory, WEB, FIX
- https://lists.debian.org/debian-lts-announce/2021/03/msg00024.html · Mailing List, Third Party Advisory, WEB
- https://lists.debian.org/debian-lts-announce/2021/05/msg00003.html · Mailing List, Third Party Advisory, WEB
- https://lists.debian.org/debian-lts-announce/2021/05/msg00006.html · Mailing List, Third Party Advisory, WEB
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/GSJRFHALQ7E3UV4FFMFU2YQ6LUDHAI55/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WSLD67LFGXOX2K5YNESSWAS4AGZIJTUQ/
- https://www.debian.org/security/2021/dsa-4878 · Third Party Advisory, WEB, ADVISORY
- https://www.debian.org/security/2021/dsa-4889 · Third Party Advisory, WEB, ADVISORY
- https://nvd.nist.gov/vuln/detail/CVE-2021-27291 · ADVISORY
- https://github.com/pygments/pygments · PACKAGE
- https://github.com/pypa/advisory-database/tree/main/vulns/pygments/PYSEC-2021-141.yaml · WEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GSJRFHALQ7E3UV4FFMFU2YQ6LUDHAI55 · WEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WSLD67LFGXOX2K5YNESSWAS4AGZIJTUQ · WEB
- https://github.com/advisories/GHSA-pq64-v7f5-gqh8 · ADVISORY
History
- 25 Nov 2026 20:32 UTC · NVD: first stored (published 17 Mar 2021)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 17 Mar 2021)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 29 Mar 2021)