Pygments has Regular Expression Denial of Service (ReDoS) due to Inefficient Regex for GUID Matching
Published 22 Mar 2026 · Updated 10 Sept 2026
Is your project on an affected pygments?
Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- <2.20.0
- Fixed in
- 2.20.0
pip install 'pygments>=2.20.0'Details
A security flaw has been discovered in pygments before 2.20.0. The impacted element is the function AdlLexer of the file pygments/lexers/archetype.py. The manipulation results in inefficient regular expression complexity. The attack is only possible with local access. The exploit has been released to the public and may be used for attacks. The project was informed of the problem early through an issue report but has not responded yet.
Is GHSA-5239-wwwm-4pmq in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected pygments, and gives you the command that fixes it.
More advisories for pygments
- MediumCVE-2022-40896Pygments vulnerable to ReDoS · 19 Jul 2023
- CriticalCVE-2015-8557Command Injection in Pygments · 17 May 2022
- HighCVE-2021-20270Infinite Loop in Pygments · 20 Apr 2021
- HighCVE-2021-27291Pygments vulnerable to Regular Expression Denial of Service (ReDoS) · 29 Mar 2021
References
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-4539
- Linkgithub.com/pygments/pygments/issues/3058
- Linkgithub.com/pygments/pygments/pull/3064
- Linkgithub.com/pygments/pygments/commit/24b8aa76c6cd6d70f39c6dd605cce319c98e2ccc
- Packagegithub.com/pygments/pygments
- Linkgithub.com/pygments/pygments/releases/tag/2.20.0
- Linkvuldb.com/?ctiid.352327
- Linkvuldb.com/?id.352327
- Linkvuldb.com/?submit.774685
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.