CVE-2021-20270
HIGH 7.5CVSS 3.1Infinite Loop in Pygments
An infinite loop in SMLLexer in Pygments versions 1.5 to 2.7.3 may lead to denial of service when performing syntax highlighting of a Standard ML (SML) source file, as demonstrated by input that only contains the "exception" keyword.
- Published
- 23 Mar 2021
- Last modified
- 17 Jun 2026
- Assigned by
- secalert@redhat.com
- NVD status
- Modified
- Weakness
- CWE-835
- Also known as
- GHSA-9w8r-397f-prfhPYSEC-2021-140
- Sources
- NVDJSONOSV GHSA-9w8r-397f-prfhJSONOSV PYSEC-2021-140JSON
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.5, <= 2.7.3 | |
| NVD | redhat | openshift_container_platformcpe:2.3:a:redhat:openshift_container_platform:3.11:*:*:*:*:*:*:* |
= 3.11 | |
| NVD | redhat | openshift_container_platformcpe:2.3:a:redhat:openshift_container_platform:4.0:*:*:*:*:*:*:* |
= 4.0 | |
| NVD | redhat | openstack_platformcpe:2.3:a:redhat:openstack_platform:10.0:*:*:*:*:*:*:* |
= 10.0 | |
| NVD | redhat | software_collectionscpe:2.3:a:redhat:software_collections:-:*:*:*:*:*:*:* |
(no version) | |
| NVD | redhat | enterprise_linuxcpe:2.3:o:redhat:enterprise_linux:7.0:*:*:*:*:*:*:* |
= 7.0 | |
| NVD | redhat | enterprise_linuxcpe:2.3:o:redhat:enterprise_linux:8.0:*:*:*:*:*:*:* |
= 8.0 | |
| NVD | fedoraproject | fedoracpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:* |
= 33 | |
| 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 | |
| OSV | PyPI | pygments | >= 1.5, < 2.7.4 | 2.7.4 |
References
- https://bugzilla.redhat.com/show_bug.cgi?id=1922136 · Issue Tracking, Patch, Third Party Advisory, WEB, REPORT
- 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://www.debian.org/security/2021/dsa-4889 · Third Party Advisory, WEB, ADVISORY
- https://www.oracle.com/security-alerts/cpuoct2021.html · Not Applicable, Third Party Advisory, WEB
- https://nvd.nist.gov/vuln/detail/CVE-2021-20270 · ADVISORY
- https://github.com/pygments/pygments/commit/f91804ff4772e3ab41f46e28d370f57898700333 · WEB
- https://github.com/pygments/pygments · PACKAGE
- https://github.com/pypa/advisory-database/tree/main/vulns/pygments/PYSEC-2021-140.yaml · WEB
- https://github.com/advisories/GHSA-9w8r-397f-prfh · ADVISORY
History
- 25 Nov 2026 20:32 UTC · NVD: first stored (published 23 Mar 2021)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 23 Mar 2021)
- 25 Nov 2026 20:11 UTC · OSV: first stored (published 20 Apr 2021)