Is pygments 2.7 vulnerable?

PyPI · 5 releases from 2.7.0 to 2.7.4 · latest pygments is 2.21.0 · checked 18 Nov 2026

Yes: 2 known advisories

Yes. pygments 2.7.4, the last 2.7 release, is affected by 2 known security advisories (1 medium, 1 low), including CVE-2022-40896, CVE-2026-4539. 2 more affect earlier 2.7.x releases. Upgrade to 2.20.0 or later to fix all of them.

Upgrade with:pip install 'pygments>=2.20.0'

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

Advisories affecting pygments 2.7.4

  • LowCVE-2026-4539GHSA-5239-wwwm-4pmq22 Mar 2026

    Pygments has Regular Expression Denial of Service (ReDoS) due to Inefficient Regex for GUID Matching

    Affected
    <2.20.0
    Fixed in
    2.20.0
  • MediumCVE-2022-40896GHSA-mrwq-x4v8-fh7p19 Jul 2023

    Pygments vulnerable to ReDoS

    Affected
    <2.15.0
    Fixed in
    2.15.0

Fixed within 2.7.x, affecting earlier releases

  • HighCVE-2021-20270GHSA-9w8r-397f-prfh20 Apr 2021

    Infinite Loop in Pygments

    Affected
    >=1.5 <2.7.4
    Fixed in
    2.7.4
  • HighCVE-2021-27291GHSA-pq64-v7f5-gqh829 Mar 2021

    Pygments vulnerable to Regular Expression Denial of Service (ReDoS)

    Affected
    >=1.1 <2.7.4
    Fixed in
    2.7.4

Every pygments 2.7.x release

Affected: 2.7.0 to 2.7.4. Latest pygments: 2.21.0.

VersionKnown advisories
pygments 2.7.4CVE-2026-4539, CVE-2022-40896
pygments 2.7.3CVE-2026-4539, CVE-2022-40896, CVE-2021-20270, CVE-2021-27291
pygments 2.7.2CVE-2026-4539, CVE-2022-40896, CVE-2021-20270, CVE-2021-27291
pygments 2.7.1CVE-2026-4539, CVE-2022-40896, CVE-2021-20270, CVE-2021-27291
pygments 2.7.0CVE-2026-4539, CVE-2022-40896, CVE-2021-20270, CVE-2021-27291

Which of your client projects are still on pygments 2.7?

NPMscan reads the lockfiles in every GitHub repo you pick, finds the exact pygments version each one installs, and checks it against these advisories. Each finding comes with the command that fixes it.

Other pygments versions

Advisory data from OSV.dev (opens OSV.dev in a new tab), which includes the GitHub Advisory Database. Release list from the PyPI registry. Refreshed daily.