Vulnerability · Published Mar 12, 2026 · Assigned by GitHub_M
CVE-2026-32274Black: Arbitrary file writes from unsanitized user input in cache file name
High 7.5
In plain English
A high-severity path traversal in black from psf. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.6% (higher than 51% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official 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 packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | black | no fix listed | DEBIAN-CVE-2026-32274 |
| Debian:13 | black | 25.1.0-3+deb13u1 | DEBIAN-CVE-2026-32274 |
| Debian:14 | black | 26.3.1-1 | DEBIAN-CVE-2026-32274 |
| PyPI | black | 26.3.1 | GHSA-3936-cmfr-pm3m |
| PyPI | black | 26.3.1 | PYSEC-2026-2121 |
| Ubuntu:22.04:LTS | black | no fix listed | UBUNTU-CVE-2026-32274 |
| Ubuntu:24.04:LTS | black | no fix listed | UBUNTU-CVE-2026-32274 |
| Ubuntu:25.10 | black | no fix listed | UBUNTU-CVE-2026-32274 |
| Ubuntu:26.04:LTS | black | no fix listed | UBUNTU-CVE-2026-32274 |
| Ubuntu:26.10 | black | no fix listed | UBUNTU-CVE-2026-32274 |
Affected products (as reported)
Weakness: CWE-22 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
References
- https://github.com/psf/black/security/advisories/GHSA-3936-cmfr-pm3m x_refsource_CONFIRM
- https://github.com/psf/black/pull/4176 x_refsource_MISC
- https://github.com/psf/black/pull/5038 x_refsource_MISC
- https://github.com/psf/black/commit/4937fe6cf241139ddbfc16b0bdbb5b422798909d x_refsource_MISC
- https://github.com/psf/black/commit/ed770ba4dd50c419148a0fca2b43937a7447e1f9 x_refsource_MISC
- https://access.redhat.com/errata/RHSA-2026:10184 x_refsource_MISC
- https://access.redhat.com/errata/RHSA-2026:13545 x_refsource_MISC
- https://access.redhat.com/errata/RHSA-2026:13553 x_refsource_MISC
- https://access.redhat.com/security/cve/CVE-2026-32274 x_refsource_MISC
- https://bugzilla.redhat.com/show_bug.cgi?id=2447111 x_refsource_MISC
- https://github.com/psf/black/releases/tag/26.3.1 x_refsource_MISC
- https://github.com/pypa/advisory-database/tree/main/vulns/black/PYSEC-2026-2121.yaml x_refsource_MISC
- https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32274.json x_refsource_MISC