CVE-2021-27291Pygments
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
- 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.
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.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)
| Vendor | Product | Versions |
|---|---|---|
| pygments | pygments | ≥ 1.1 < 2.7.4 |
| debian | debian_linux | 9.0 |
| debian | debian_linux | 10.0 |
| fedoraproject | fedora | 32 |
| fedoraproject | fedora | 33 |
Official sources
References
Links published by the sources. Open them with care.
- gist.github.com Exploit Third Party Advisory
- github.com Patch Third Party Advisory
- lists.debian.org Mailing List Third Party Advisory
- lists.debian.org Mailing List Third Party Advisory
- lists.debian.org Mailing List Third Party Advisory
- lists.fedoraproject.org
- lists.fedoraproject.org
- www.debian.org Third Party Advisory
- www.debian.org Third Party Advisory