Live threats

All CVEs / Pygments

CVE-2021-27291Pygments

High 7.5 No auth needed

Priority
60
CVSS 3.1
7.5
EPSS
3.9%
probability of exploitation in 30 days · percentile 91
Auth required
No
Published
Mar 17, 2021
Updated
Jun 17, 2026
Category
Application · Cross-platform
Weakness (CWE)
CWE-1333
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

What happens

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.

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.1 < 2.7.4 2.7.4 pip install "pygments>=2.7.4"
PyPI pygments ≥ 1.1 < 2.7.4 2.7.4 pip install "pygments>=2.7.4"

Per OSV / GitHub Advisories (GHSA-pq64-v7f5-gqh8, PYSEC-2021-141). Check the version in your lockfile before upgrading.

Affected products (CPE)

VendorProductVersions
pygmentspygments≥ 1.1 < 2.7.4
debiandebian_linux9.0
debiandebian_linux10.0
fedoraprojectfedora32
fedoraprojectfedora33

Official sources

References

Links published by the sources. Open them with care.