HighGHSA-9w8r-397f-prfhCVE-2021-20270PYSEC-2021-140

Infinite Loop in Pygments

Published 20 Apr 2021 · Updated 14 Oct 2024

Is your project on an affected pygments?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

Affected
>=1.5 <2.7.4
Fixed in
2.7.4
Update to the fixed version for your release line, for example:pip install 'pygments>=2.7.4'

Details

An infinite loop in SMLLexer in Pygments versions 1.5 to 2.7.3 may lead to denial of service when performing syntax highlighting of a Standard ML (SML) source file, as demonstrated by input that only contains the "exception" keyword.

Is GHSA-9w8r-397f-prfh 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

  • LowCVE-2026-4539Pygments has Regular Expression Denial of Service (ReDoS) due to Inefficient Regex for GUID Matching · 22 Mar 2026
  • MediumCVE-2022-40896Pygments vulnerable to ReDoS · 19 Jul 2023
  • CriticalCVE-2015-8557Command Injection in Pygments · 17 May 2022
  • HighCVE-2021-27291Pygments vulnerable to Regular Expression Denial of Service (ReDoS) · 29 Mar 2021
pygments security overview

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.