CVE-2026-31900

Black's vulnerable version parsing leads to RCE in GitHub Action

Published Mar 11, 2026 CVSS 4.0 · 8.7 High EPSS < 1% KEV · Not listed
Description
Black is the uncompromising Python code formatter. Black provides a GitHub action 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. Version 26.3.0 fixes this vulnerability.

Analysis

AI-generated

Technical impact

The vulnerability is in Black's GitHub Action when the use_pyproject option is enabled. The action reads pyproject.toml from the repository and interprets a direct URL as the source of the Black executable. An attacker who can submit a pull request can modify pyproject.toml to point to a malicious repository. This results in arbitrary code execution within the action runtime, allowing the attacker to access secrets or other permissions that the action possesses. The weakness stems from improper input validation (CWE-20).

Affected Systems

Vendor psf: black, product Black code formatter and GitHub Action. The vulnerability affects all deployments that use Black in GitHub Actions with use_pyproject: true and any Black version earlier than 26.3.0. No specific sub-version details are provided beyond the fix in 26.3.0.

Risk and Exploitability

The CVSS score is 8.7, indicating a high severity of potential impact. The EPSS score is less than 1%, suggesting the exploit probability is currently low, and the vulnerability is not listed in CISA’s KEV catalog. The likely attack vector is a malicious pull request that modifies pyproject.toml to reference an attacker-controlled repository. Exploitation requires the attacker to have the ability to forge a pull request, which is feasible for core contributors or attackers with compromised credentials. Once exploited, the attacker can execute arbitrary commands in the action environment.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Black to version 26.3.0 or later. If an upgrade is not immediately possible, disable use_pyproject: true in the GitHub Action workflow or reject pyproject.toml changes that reference external URLs.

Generated by OpenCVE AI on March 16, 2026 at 23:11 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-v53h-f6m7-xcgm Black's vulnerable version parsing leads to RCE in GitHub Action
History
Type Values Removed Values Added
First Time appeared Python
Python black
Weaknesses NVD-CWE-noinfo
CPEs cpe:2.3:a:python:black:*:*:*:*:*:*:*:*
Vendors & Products Python
Python black
Metrics cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Psf
Psf black
Vendors & Products Psf
Psf black
Type Values Removed Values Added
Description Black is the uncompromising Python code formatter. Black provides a GitHub action 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. Version 26.3.0 fixes this vulnerability.
Title Black's vulnerable version parsing leads to RCE in GitHub Action
Weaknesses CWE-20
References
Metrics cvssV4_0

{'score': 8.7, 'vector': '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'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Mar 13, 2026, 3:55 AM
Reserved
Mar 9, 2026, 9:59 PM
Status
Analyzed
Published
Mar 11, 2026, 8:16 PM
Modified
Jun 17, 2026, 10:34 AM