High
Security advisory
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.
- Products
- Not specified
- Affected versions
- Not specified
- Fixed versions
- Not specified
- CVEs
- CVE-2021-27291
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 31 Oct 2026, 11:43 UTC · Revision 1
Source evidence
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.
osv:CVE-2021-27291
Complete source record
{
"id": "19912a1f6e640033d499730abf993b83b1b35d3fe523975ea90a5aff77368f74",
"url": "https://osv.dev/vulnerability/CVE-2021-27291",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "CVE-2021-27291",
"summary": "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.",
"evidence": "osv:CVE-2021-27291",
"products": [],
"severity": "high",
"structured": {
"id": "CVE-2021-27291",
"aliases": [
"CVE-2021-27291",
"GHSA-pq64-v7f5-gqh8",
"PYSEC-2021-141"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/pygments/pygments",
"type": "GIT",
"events": [
{
"introduced": "f534f990331df660f5a5ea6947943e184672ac51"
},
{
"fixed": "4d555d0fffc914a2a4ac9874416cdaaf8f8c9e74"
},
{
"fixed": "2e7e8c4a7b318f4032493773732754e418279a14"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:pygments:pygments:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "1.1"
},
{
"fixed": "2.7.4"
}
],
"source": "CPE_RANGE"
},
{
"range": [
{
"fixed": "2e7e8c4a7b318f4032493773732754e418279a14"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
}
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2021-27291.json"
}
}
],
"modified": "2026-10-20T10:54:35.504740624Z",
"provider": "osv",
"references": [
"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/GSJRFHALQ7E3UV4FFMFU2YQ6LUDHAI55/",
"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/WSLD67LFGXOX2K5YNESSWAS4AGZIJTUQ/",
"https://lists.debian.org/debian-lts-announce/2021/03/msg00024.html",
"https://lists.debian.org/debian-lts-announce/2021/05/msg00003.html",
"https://lists.debian.org/debian-lts-announce/2021/05/msg00006.html",
"https://www.debian.org/security/2021/dsa-4878",
"https://www.debian.org/security/2021/dsa-4889",
"https://github.com/pygments/pygments/commit/2e7e8c4a7b318f4032493773732754e418279a14",
"https://gist.github.com/b-c-ds/b1a2cc0c68a35c57188575eb496de5ce"
],
"provider_metadata": {
"unresolved_ranges": [
{
"cpes": [
"cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*",
"cpe:2.3:o:debian:debian_linux:9.0:*:*:*:*:*:*:*"
],
"vendor_product": "debian:debian_linux",
"extracted_events": [
{
"range": [
{
"introduced": "9.0"
},
{
"last_affected": "9.0"
},
{
"introduced": "10.0"
},
{
"last_affected": "10.0"
}
],
"source": "CPE_STRING"
}
]
},
{
"cpes": [
"cpe:2.3:o:fedoraproject:fedora:32:*:*:*:*:*:*:*",
"cpe:2.3:o:fedoraproject:fedora:33:*:*:*:*:*:*:*"
],
"vendor_product": "fedoraproject:fedora",
"extracted_events": [
{
"range": [
{
"introduced": "32"
},
{
"last_affected": "32"
},
{
"introduced": "33"
},
{
"last_affected": "33"
}
],
"source": "CPE_STRING"
}
]
}
]
}
},
"related_cves": [
{
"value": "CVE-2021-27291",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 385682,
"published_at": "2021-03-17T13:15:15.137+00:00"
}