CVE-2026-31900: Psf/black Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-v53h-f6m7-xcgm
CWE-20
Published
Advisory Summary

CVE-2026-31900 is a HIGH remote code execution vulnerability (CWE-20: Improper Input Validation) affecting Psf/black libraries in the GitHub Actions ecosystem. The issue involves black's vulnerable version parsing leads to rce in github action. Remediation is available by upgrading affected packages to version 26.3.0.

CVE-2026-31900 at a Glance

CVE Identifier CVE-2026-31900
GHSA Identifier GHSA-v53h-f6m7-xcgm
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-20: Improper Input Validation
Affected Product Psf/black
Package Ecosystem GitHub Actions
Published Date
Last Updated

How to Fix CVE-2026-31900

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

psf/black fixed: 26.3.0
Upgrade psf/black to 26.3.0
Verify Direct and Transitive Dependencies

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

inspect dependencies for psf/black

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-31900, inspect your project dependencies for Psf/black:

inspect dependencies for psf/black

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

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Psf/black, 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

### Impact Black provides a [GitHub action](https://black.readthedocs.io/en/stable/integrations/github_actions.html) for formatting code. This action supports an option, `use_pyproject: true`, for reading the version of Black to use from the repository `pyproject.toml`. A malicious pull request could edit pyproject.toml to use a direct URL reference to a malicious repository. This could lead to arbitrary code execution in the context of the GitHub Action. Attackers could then gain access to secrets or permissions available in the context of the action. ### Patches Version 26.3.0 fixes this vulnerability by tightening the validation of the `version` field. Users who use the GitHub Action as `psf/black@stable` will automatically pick up this update. ### Workarounds Do not use the `use_pyproject: true` option in the psf/black GitHub Action.

CVE-2026-31900 Affected Psf/black Versions

1 component(s)
Fixed Versions:
26.3.0
Product / Package Ecosystem Affected Versions Fixed Version
psf/black
GitHub Actions
< 26.3.0
26.3.0

References

Frequently Asked Questions

What is CVE-2026-31900?
CVE-2026-31900 is a security vulnerability in Psf/black involving Black's vulnerable version parsing leads to RCE in GitHub Action under CWE-20: Improper Input Validation.
Which Psf/black versions are affected?
Affected versions include releases prior to 26.3.0 across affected packages: psf/black.
What version fixes CVE-2026-31900?
Upgrading to 26.3.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is psf/black affected?
Yes, psf/black is affected in releases prior to 26.3.0. Upgrade your dependency to 26.3.0 or later.
What CWE is associated with CVE-2026-31900?
CVE-2026-31900 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check GitHub Actions dependencies for CVE-2026-31900?
Run the dependency tree command: 'inspect dependencies for psf/black'. 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-v53h-f6m7-xcgm",
  "modified" : "2026-03-11T21:37:22Z",
  "published" : "2026-03-07T02:32:27Z",
  "aliases" : [ "CVE-2026-31900" ],
  "summary" : "Black's vulnerable version parsing leads to RCE in GitHub Action",
  "details" : "### Impact\n\nBlack provides a [GitHub action](https://black.readthedocs.io/en/stable/integrations/github_actions.html) for formatting code. This action supports an option, `use_pyproject: true`, for reading the version of Black to use from the repository `pyproject.toml`. A malicious pull request could edit pyproject.toml to use a direct URL reference to a malicious repository. This could lead to arbitrary code execution in the context of the GitHub Action. Attackers could then gain access to secrets or permissions available in the context of the action.\n\n### Patches\n\nVersion 26.3.0 fixes this vulnerability by tightening the validation of the `version` field. Users who use the GitHub Action as `psf/black@stable` will automatically pick up this update.\n\n### Workarounds\n\nDo not use the `use_pyproject: true` option in the psf/black GitHub Action.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "GitHub Actions",
      "name" : "psf/black"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "26.3.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/psf/black/security/advisories/GHSA-v53h-f6m7-xcgm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-31900"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/psf/black/commit/0a2560b981364dde4c8cf8ce9d164c40669a8611"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/psf/black"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-07T02:32:27Z",
    "nvd_published_at" : "2026-03-11T20:16:15Z"
  }
}