CVE-2026-31900
JSON

8.7high

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

Severity
8.7high CVSS:4.0 by GitHub_M
Exploit likelihood
0.52% (higher than 45% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-v53h-f6m7-xcgmPYSEC-2026-2120

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.

Affected

Product or packageVersionsReported by
psf black< 26.3.0CVE List
psf/black (GitHub Actions)before 26.3.0GitHub Advisory Database
python blackbefore 26.3.0NVD
black (PyPI)before 26.3.0PyPA Advisory Database

All scores

GitHub_M8.7high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
NVD9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
PyPA Advisory Database9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-20

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

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.

GitHub Advisory Database
Impact

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.

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.

NVD (es)

Black es el formateador de código Python intransigente. Black proporciona una acción de GitHub para formatear código. Esta acción admite una opción, use_pyproject: true, para leer la versión de Black a utilizar desde el archivo pyproject.toml del repositorio. Una solicitud de extracción maliciosa podría editar pyproject.toml para usar una referencia de URL directa a un repositorio malicioso. Esto podría conducir a la ejecución de código arbitrario en el contexto de la Acción de GitHub. Los atacantes podrían entonces obtener acceso a secretos o permisos disponibles en el contexto de la acción. La versión 26.3.0 corrige esta vulnerabilidad.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-31900 changed 2026-03-13CVE Terms of Use
GitHub Advisory DatabaseGHSA-v53h-f6m7-xcgm changed 2026-07-13CC-BY-4.0
NVDCVE-2026-31900 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2026-2120 changed 2026-07-13CC-BY-4.0