CVE-2021-27291: Pygments vulnerable to Regular Expression Denial of Service (ReDoS)

CVE-2021-27291 · Severity: low · CVSS 3.1 · Published 2021-03-17

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.

Technologies: pygments (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2021-27291 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2021-27291 being exploited in the wild.
How severe is CVE-2021-27291?
Low severity, with a CVSS score of 3.1, published 17 March 2021.
Which products and versions are affected?
pygments (PyPI) ECOSYSTEM:introduced=1.1,fixed=2.7.4, GIT:introduced=0,fixed=2e7e8c4a7b318f4032493773732754e418279a14|ECOSYSTEM:introduced=1.1,fixed=2.7.4.
Is there a fix for CVE-2021-27291?
Yes. pygments (PyPI): upgrade to 2.7.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
Am I affected by CVE-2021-27291?
Check whether you run pygments (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • pygments (PyPI): upgrade to 2.7.4 or later
    pip install "pygments>=2.7.4"

Affected products

  • pygments (PyPI) ECOSYSTEM:introduced=1.1,fixed=2.7.4, GIT:introduced=0,fixed=2e7e8c4a7b318f4032493773732754e418279a14|ECOSYSTEM:introduced=1.1,fixed=2.7.4

Identifiers

  • CVE-2021-27291
  • GHSA-pq64-v7f5-gqh8
  • PYSEC-2021-141

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.