Arbitrary File Write via Unescaped --python-cell-magics in Black <26.3.1
CVE-2026-32274 Published on March 12, 2026
Black: Arbitrary file writes from unsanitized user input in cache file name
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.
Vulnerability Analysis
CVE-2026-32274 is exploitable with network access, and does not require authorization privileges or user interaction. This vulnerability is considered to have a low attack complexity. The potential impact of an exploit of this vulnerability is considered to have no impact on confidentiality, a high impact on integrity, and no impact on availability.
Weakness Type
What is a Directory traversal Vulnerability?
The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
CVE-2026-32274 has been classified to as a Directory traversal vulnerability or weakness.
Products Associated with CVE-2026-32274
Want to know whenever a new CVE is published for Red Hat products? stack.watch will email you.
Affected Versions
psf black:- Version >= 24.3.0, < 26.3.1 is affected.
- Version 1777393635 and below * is unaffected.
- Version 1777403872 and below * is unaffected.
- Version 1777390240 and below * is unaffected.
- Version 1777387537 and below * is unaffected.
- Version 1777299023 and below * is unaffected.
- Version 1777387242 and below * is unaffected.
- Version 1777390333 and below * is unaffected.
- Version 1776319193 and below * is unaffected.
- Version 1776319179 and below * is unaffected.
- Version 1776319185 and below * is unaffected.
- Version 1776318795 and below * is unaffected.
- Version 1776319453 and below * is unaffected.
- Version 1776336534 and below * is unaffected.
- Version 1776319275 and below * is unaffected.
Vulnerable Packages
The following package name and versions may be associated with CVE-2026-32274
| Package Manager | Vulnerable Package | Versions | Fixed In |
|---|---|---|---|
| pip | black | < 26.3.1 | 26.3.1 |
Exploit Probability
EPSS (Exploit Prediction Scoring System) scores estimate the probability that a vulnerability will be exploited in the wild within the next 30 days. The percentile shows you how this score compares to all other vulnerabilities.