Live threats

All CVEs / Pygments

CVE-2021-20270Pygments

High 7.5 No auth needed

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.

Original NVD text.

What to do

  1. Apply the vendor's security update for Pygments.
  2. It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.

Affected packages

EcosystemPackageAffected versionsFixed inHow 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)

VendorProductVersions
pygmentspygments≥ 1.5 ≤ 2.7.3
redhatopenshift_container_platform3.11
redhatopenshift_container_platform4.0
redhatopenstack_platform10.0
redhatsoftware_collectionsall
redhatenterprise_linux7.0
redhatenterprise_linux8.0
fedoraprojectfedora33
debiandebian_linux9.0
debiandebian_linux10.0

Official advisories

Vendor, CERT and distribution advisories that name this CVE. Original titles.

Official sources

References

Links published by the sources. Open them with care.