# CVE-2026-31900: Black's vulnerable version parsing leads to RCE in GitHub Action

> Attackers can achieve arbitrary code execution in GitHub Actions by manipulating pyproject.toml when the use_pyproject option is enabled.

- **Severity:** High 8.7 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Mar 2026
- **Updated:** 13 Mar 2026
- **Also known as:** CLEANSTART-2026-DV70312, DEBIAN-CVE-2026-31900, GHSA-v53h-f6m7-xcgm, PYSEC-2026-2120, UBUNTU-CVE-2026-31900

## What is CVE-2026-31900?

CVE-2026-31900 is a high-severity code injection vulnerability in psf black, published on 11 Mar 2026. Any signed-in user can exploit it over the network, with no action from the victim.

### Official 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.

Weakness: CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2026-31900?

2 open source packages ship an affected version, including psf/black and black. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `psf/black` | GitHub Actions | All versions | 26.3.0 |
| `black` | PyPI | All versions | 26.3.0 |

Products: Python Black.

## How do I fix CVE-2026-31900?

Upgrade psf/black to 26.3.0 or later.

## Is CVE-2026-31900 being exploited?

There is no known exploitation of CVE-2026-31900 in the wild and no public exploit code.

Public exploit code:

- CVE-2026-31900 Vulnerable Lab - psf/black GitHub Action RCE (github_poc): https://github.com/Batosay1337Lab/cve-2026-31900-lab

## Other vulnerabilities in psf black

- [CVE-2026-32274](https://insights.sbomify.com/CVE-2026-32274/): Black: Arbitrary file writes from unsanitized user input in cache file name (high 8.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-31900 and fix it if it is affected.

What it is: CVE-2026-31900 is a high-severity code injection vulnerability in psf black, published on 11 Mar 2026. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-31900 in the wild and no public exploit code.

Affected packages and fixed versions:
- psf/black (GitHub Actions): affected all versions; fixed in 26.3.0
- black (PyPI): affected all versions; fixed in 26.3.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-31900/ (Markdown: https://insights.sbomify.com/CVE-2026-31900/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-31900
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-31900
- OSV: https://osv.dev/vulnerability/CVE-2026-31900

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-31900/
Summaries are generated and may contain mistakes; the official description above is the record.
