Skip to main content
No exploitation reportedFix available

CVE-2021-27291

No exploitation reported by the sources we read.

  • Published2021-03-17
  • Fixed in2.7.4
  • WeaknessCWE-1333

Am I affected?

With a domain, we read the version its public headers and pages expose. A distribution build can carry the fix under an older number.

Description

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.

Timeline

dates in UTC
  1. 2021-03-1713:15CVE publishedNVD

Versions per branch

NVD · OSV
Pygments
BranchAffectedFixed in
2.7≥ 1.1, < 2.7.42.7.4
Debian debian linux
BranchAffectedFixed in
9.0= 9.0no fix published
10.0= 10.0no fix published
Fedoraproject fedora
BranchAffectedFixed in
32.x= 32no fix published
33.x= 33no fix published

as publishedRanges as NVD and OSV publish them; a distribution’s build can be fixed under an older number.

Distribution builds and vendor advisories

Packages from OSV.dev and products from the vendors' CSAF advisories.

version not verifiedVersions not verified: read as OSV.dev and the vendors publish them, not checked against each vendor's release list.

Packages

  • automation-hubRed Hat:ansible_automation_platform:4.2::el8all versions · fixed in 0:4.2.2-1.el8pcand 2 other packages
  • automation-hubRed Hat:ansible_automation_platform:4.2::el7all versions · fixed in 0:4.2.2-1.el7pcand 2 other packages
  • babelRocky Linux:8all versions · fixed in 0:2.5.1-10.module+el8.5.0+706+735ec4b3
  • babelRed Hat:enterprise_linux:8::appstreamall versions · fixed in 0:2.5.1-10.module+el8.5.0+11014+88fc0d0band 1 other package
  • babelAlmaLinux:8all versions · fixed in 2.5.1-10.module_el8.6.0+2781+fed64c13and 1 other package
  • CythonRocky Linux:8all versions · fixed in 0:0.28.1-7.module+el8.4.0+403+9ae17a31
  • CythonRocky Linux:8all versions · fixed in 0:0.28.1-7.module+el8.5.0+706+735ec4b3
  • CythonRed Hat:enterprise_linux:8::appstreamall versions · fixed in 0:0.28.1-7.module+el8.1.0+3111+de3f2d8eand 3 other packages

249 more package ranges on OSV.dev

Vendor advisories

  • CVE-2021-27291 Red Hat Product Security488 products fixed · 11 known affected

    python-pygments: ReDoS in multiple lexers

    python-pygments.src as a component of Red Hat Enterprise Linux 6 · python-pygments.src as a component of Red Hat Enterprise Linux 7 · resource-agents as a component of Red Hat Enterprise Linux 7 · +8 more

  • RHSA-2021:4150 Red Hat Product Security82 products fixed

    Red Hat Security Advisory: python36:3.6 security and bug fix update

  • RHSA-2021:4151 Red Hat Product Security264 products fixed

    Red Hat Security Advisory: python27:2.7 security update

  • RHSA-2021:4139 Red Hat Product Security36 products fixed

    Red Hat Security Advisory: resource-agents security, bug fix, and enhancement update

  • RHSA-2021:3252 Red Hat Product Security80 products fixed

    Red Hat Security Advisory: python27 security update

  • RHSA-2021:0781 Red Hat Product Security26 products fixed

    Red Hat Security Advisory: Red Hat Ansible Automation Platform 1.2.2 security and bug fix update

Full record on NVD

Fix

  1. Update Pygments to 2.7.4
  2. Vendor fix Red Hat Product Security RHSA-2021:4150 · 82 productsFor details on how to apply this update, which includes the changes described in this advisory, refer to: https://access.redhat.com/articles/11258
  3. Vendor fix Red Hat Product Security RHSA-2021:0781 · 26 productsBefore applying this update, make sure all previously released errata relevant to your system have been applied. For details on how to apply this update, refer to: https://access.redhat.com/articles/11258
  4. No fix planned, says the vendor Red Hat Product Security CVE-2021-27291 · 11 productsOut of support scope

Advisories and patches

Detection

Nuclei template
none so far
ProjectDiscovery
Exploit-DB
no entry
Exploit-DB
Proof of concept
Metasploit modules
none listed
Metasploit Framework

Sources

Identifiers

Technical details

CVSS v3 vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Published
2021-03-17
Last modified
2026-06-17
NVD status
Modified
GitHub advisory
GHSA-pq64-v7f5-gqh8

Frequently asked questions

What is CVE-2021-27291?

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.

Is CVE-2021-27291 actively exploited?

Active exploitation of CVE-2021-27291 has not been confirmed. Its EPSS score was 3.9% on 2026-12-04, the estimated probability of exploitation in the next 30 days.

What is the CVSS score for CVE-2021-27291?

CVE-2021-27291 has a CVSS v3 base score of 7.5 (High severity), with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.

Running pygments? Hear about its next vulnerability

Surveillance reads the versions in your stack — a domain, a lockfile or a list — checks each CVE against the ranges its sources publish, and alerts you when one you run is exploited or enters CISA KEV. A version it cannot read stays « version not verified ».

No credit card required · No monthly cap on website checks · 250 API requests/month

Sources for this record