CVE-2021-20270Pygments
High 7.5 No auth needed
Follow: this CVE · Pygments · Pygments We alert you by email or Slack (account required).
- Priority
- 60
- CVSS 3.1
- 7.5
- EPSS
- 2.5% probability of exploitation in 30 days · percentile 85
- Auth required
- No
- Published
- Mar 23, 2021
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-835
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
What happens
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.
What to do
- Apply the vendor's security update for Pygments.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| PyPI | pygments |
≥ 1.5 < 2.7.4 |
2.7.4 |
pip install "pygments>=2.7.4" |
| PyPI | pygments |
≥ 1.5 < 2.7.4 |
2.7.4 |
pip install "pygments>=2.7.4" |
Per OSV / GitHub Advisories (GHSA-9w8r-397f-prfh, PYSEC-2021-140). Check the version in your lockfile before upgrading.
Affected products (CPE)
| Vendor | Product | Versions |
|---|---|---|
| pygments | pygments | ≥ 1.5 ≤ 2.7.3 |
| redhat | openshift_container_platform | 3.11 |
| redhat | openshift_container_platform | 4.0 |
| redhat | openstack_platform | 10.0 |
| redhat | software_collections | all |
| redhat | enterprise_linux | 7.0 |
| redhat | enterprise_linux | 8.0 |
| fedoraproject | fedora | 33 |
| debian | debian_linux | 9.0 |
| debian | debian_linux | 10.0 |
Official advisories
- python313-Pygments-2.21.0-1.1 on GA media · SUSE · openSUSE-SU-2026:11568-1 · Aug 21, 2026 High
Vendor, CERT and distribution advisories that name this CVE. Original titles.
Official sources
References
Links published by the sources. Open them with care.
- bugzilla.redhat.com Issue Tracking Patch Third Party Advisory
- lists.debian.org Mailing List Third Party Advisory
- lists.debian.org Mailing List Third Party Advisory
- www.debian.org Third Party Advisory
- www.oracle.com Not Applicable Third Party Advisory