# CVE-2026-32274: Black: Arbitrary file writes from unsanitized user input in cache file name

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.7
- **CVSS:** 8.7 (v4.0, CNA) `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Attack requirements: None; Privileges required: None; User interaction: None; Confidentiality impact: None; Integrity impact: High; Availability impact: None; Confidentiality impact on other systems: None; Integrity impact on other systems: None; Availability impact on other systems: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.83% (percentile 55, 2026-11-26)
- **CWE:** CWE-22
- **Aliases:** GHSA-3936-cmfr-pm3m, PYSEC-2026-2121
- **Published:** 2026-03-12T18:33:10.000Z
- **Modified:** 2026-09-10T03:50:36.703Z

## Who should check

- Projects that depend on PyPI package black (\>= 24.3.0, \< 26.3.1)
- Anyone running psf black \>= 24.3.0, \< 26.3.1

## Description

Black is the uncompromising Python code formatter. Starting in version 24.3.0 and prior to version 26.3.1, Black writes a cache file, the name of which is computed from various formatting options. The value of the --python-cell-magics option was placed in the filename without sanitization, which allowed an attacker who controls the value of this argument to write cache files to arbitrary file system locations. Fixed in Black 26.3.1.

## Affected and fixed versions

- PyPI `black`: affected \>= 24.3.0, \< 26.3.1; fixed 26.3.1 (osv)
- psf black: \>= 24.3.0, \< 26.3.1 (cvelist)

## Mitigation

- Upgrade black to 26.3.1 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-32274. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-32274.md
Affected: black >= 24.3.0, < 26.3.1
Fixed in: 26.3.1

Steps:
1. Search this machine and project for black (PyPI), psf black: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-32274 being exploited?

There is no confirmed exploitation: CVE-2026-32274 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.83% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2026-32274?

High: CVSS 8.7 (v4.0, scored by CNA). Remote, no login needed.

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

black \>= 24.3.0, \< 26.3.1.

### Is there a fix for CVE-2026-32274?

Yes. Fixed in 26.3.1. Upgrade black to 26.3.1 or later.

### How do I check if I'm affected by CVE-2026-32274?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/psf/black/security/advisories/GHSA-3936-cmfr-pm3m>
- vendor: <https://access.redhat.com/errata/RHSA-2026:10184>
- vendor: <https://access.redhat.com/errata/RHSA-2026:13545>
- vendor: <https://access.redhat.com/errata/RHSA-2026:13553>
- vendor: <https://github.com/psf/black/releases/tag/26.3.1>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2026-32274>
- patch: <https://github.com/psf/black/pull/4176>
- patch: <https://github.com/psf/black/pull/5038>
- patch: <https://github.com/psf/black/commit/4937fe6cf241139ddbfc16b0bdbb5b422798909d>
- patch: <https://github.com/psf/black/commit/ed770ba4dd50c419148a0fca2b43937a7447e1f9>
- other: <https://access.redhat.com/security/cve/CVE-2026-32274>
- other: <https://bugzilla.redhat.com/show_bug.cgi?id=2447111>
- other: <https://github.com/pypa/advisory-database/tree/main/vulns/black/PYSEC-2026-2121.yaml>
- other: <https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32274.json>
- other: <https://github.com/psf/black>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-32274>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-3936-cmfr-pm3m> (license: <https://creativecommons.org/licenses/by/4.0/>)
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/PYSEC-2026-2121> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2026-32274> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-32274>
