CVE-2026-4539: Pygments Denial of Service Vulnerability

LOW
Advisory Identifier: GHSA-5239-wwwm-4pmq
CVSS 3.3
CWE-400 CWE-1333
Published
Advisory Summary

CVE-2026-4539 is a LOW (CVSS 3.3) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Pygments libraries in the PyPI ecosystem. The issue involves pygments has regular expression denial of service (redos) due to inefficient regex for guid matching. Remediation is available by upgrading affected packages to version 2.20.0.

CVE-2026-4539 at a Glance

CVE Identifier CVE-2026-4539
GHSA Identifier GHSA-5239-wwwm-4pmq
Severity LOW
CVSS v3.1 Base Score 3.3
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Pygments
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 3.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2026-4539

To remediate this vulnerability, upgrade all affected Pygments dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

Pygments fixed: 2.20.0
pip install Pygments>=2.20.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show Pygments

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-4539, inspect your installed packages using pip:

pip show Pygments

Analyze the terminal output to locate any version of Pygments in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.20.0), your application is affected.

Note: The pip show Pygments command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Pygments, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2026-4539 Affected Pygments Versions

1 component(s)
Fixed Versions:
2.20.0
Product / Package Ecosystem Affected Versions Fixed Version
Pygments
PyPI
< 2.20.0
2.20.0

References

Frequently Asked Questions

What is CVE-2026-4539?
CVE-2026-4539 is a security vulnerability in Pygments involving Pygments has Regular Expression Denial of Service (ReDoS) due to Inefficient Regex for GUID Matching under CWE-400: Uncontrolled Resource Consumption.
Which Pygments versions are affected?
Affected versions include releases prior to 2.20.0 across affected packages: Pygments.
What version fixes CVE-2026-4539?
Upgrading to 2.20.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Pygments affected?
Yes, Pygments is affected in releases prior to 2.20.0. Upgrade your dependency to 2.20.0 or later.
What is the CVSS score of CVE-2026-4539?
CVE-2026-4539 has a CVSS v3.1 base score of 3.3 (LOW) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2026-4539?
CVE-2026-4539 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for CVE-2026-4539?
Run the dependency tree command: 'pip show Pygments'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5239-wwwm-4pmq",
  "modified" : "2026-03-30T14:40:28Z",
  "published" : "2026-03-22T06:30:15Z",
  "aliases" : [ "CVE-2026-4539" ],
  "summary" : "Pygments has Regular Expression Denial of Service (ReDoS) due to Inefficient Regex for GUID Matching",
  "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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Pygments"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.20.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-4539"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pygments/pygments/issues/3058"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pygments/pygments/pull/3064"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pygments/pygments/commit/24b8aa76c6cd6d70f39c6dd605cce319c98e2ccc"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pygments/pygments"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pygments/pygments/releases/tag/2.20.0"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?ctiid.352327"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?id.352327"
  }, {
    "type" : "WEB",
    "url" : "https://vuldb.com/?submit.774685"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333", "CWE-400" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-24T20:33:39Z",
    "nvd_published_at" : "2026-03-22T06:16:20Z"
  }
}