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 package | Versions | Reported by |
|---|---|---|
| psf black | < 26.3.0 | CVE List |
| psf/black (GitHub Actions) | before 26.3.0 | GitHub Advisory Database |
| python black | before 26.3.0 | NVD |
| black (PyPI) | before 26.3.0 | PyPA Advisory Database |
All scores
| GitHub_M | 8.7high CVSS:4.0 | 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 |
| GitHub | high CVSS:4.0 | 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 |
| NVD | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| PyPA Advisory Database | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Classification
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
| https://github.com/psf/black/security/advisories/GHSA-v53h-f6m7-xcgm | advisory, mitigation, vendor-advisory, web | |
| https://github.com/psf/black/commit/0a2560b981364dde4c8cf8ce9d164c40669a8611 | fix, patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-31900 | advisory | |
| https://github.com/psf/black | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-31900 changed 2026-03-13 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-v53h-f6m7-xcgm changed 2026-07-13 | CC-BY-4.0 |
| NVD | CVE-2026-31900 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2026-2120 changed 2026-07-13 | CC-BY-4.0 |