PYSEC-2026-2987
Pygments has Regular Expression Denial of Service (ReDoS) due to Inefficient Regex for GUID Matching
Quick fix
PYSEC-2026-2987 — pygments: upgrade to the fixed version with the command below.
pip install --upgrade '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.
Are you affected?
Enter the version of the package you're using.
Affected packages
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-4539[ADVISORY]
- https://github.com/pygments/pygments/issues/3058[WEB]
- https://github.com/pygments/pygments/pull/3064[WEB]
- https://github.com/pygments/pygments/commit/24b8aa76c6cd6d70f39c6dd605cce319c98e2ccc[WEB]
- https://github.com/pygments/pygments[PACKAGE]
- https://github.com/pygments/pygments/releases/tag/2.20.0[WEB]
- https://vuldb.com/?ctiid.352327[WEB]
- https://vuldb.com/?id.352327[WEB]
- https://vuldb.com/?submit.774685[WEB]
- https://pypi.org/project/pygments[PACKAGE]
- https://github.com/advisories/GHSA-5239-wwwm-4pmq[ADVISORY]
Check it before you install it
One call answers whether to add this package: known advisories, CISA KEV, and whether the name is a hallucinated or freshly squatted one. No key needed to try it.
curl -s https://vdb.ai.kr/v1/ai/check-packages \
-H 'Content-Type: application/json' \
-d '{"packages":["pkg:pypi/pygments"]}'