Description
Black is the uncompromising Python code formatter. Prior to 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.
Published: 2026-03-12
Score: 8.7 High
EPSS: < 1% Very Low
KEV: No
Impact: Arbitrary File Write
Action: Apply Patch
AI Analysis

Impact

Black, a popular Python code formatter, generates a cache file whose name incorporates the value of the --python-cell-magics option. Before version 26.3.1, this option was added to the filename without sanitization, allowing an attacker who can control the option value to write cache files to arbitrary filesystem locations. This vulnerability is a classic example of an operating‑system path traversal leading to arbitrary file writes (CWE‑22). The attacker could overwrite critical files, inject malicious code, or otherwise compromise the integrity of the systems where Black is executed.

Affected Systems

Vendors affected are Python Software Foundation (psf) Black. The issue exists in all releases of Black older than 26.3.1. Users running any such version on any platform are potentially exposed.

Risk and Exploitability

The vulnerability carries a high CVSS base score of 8.7, indicating significant impact. The EPSS score is &lt; 1 %, suggesting exploitation is currently rare, and it is not listed in the CISA KEV catalog. Likely attack vectors are local or in contexts where an attacker can influence the command‑line arguments or configuration of Black, enabling them to supply a specially crafted --python-cell-magics value. While not immediately exploitable remotely, the potential for file overwrite makes it a serious risk in environments where Black runs with elevated privileges.

Generated by OpenCVE AI on March 18, 2026 at 15:30 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Black to 26.3.1 or later.

Generated by OpenCVE AI on March 18, 2026 at 15:30 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-3936-cmfr-pm3m Black: Arbitrary file writes from unsanitized user input in cache file name
History

Wed, 18 Mar 2026 14:15:00 +0000

Type Values Removed Values Added
First Time appeared Python
Python black
CPEs cpe:2.3:a:python:black:*:*:*:*:*:python:*:*
Vendors & Products Python
Python black

Fri, 13 Mar 2026 16:15:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Fri, 13 Mar 2026 10:00:00 +0000

Type Values Removed Values Added
First Time appeared Psf
Psf black
Vendors & Products Psf
Psf black

Fri, 13 Mar 2026 00:15:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N'}

threat_severity

Important


Thu, 12 Mar 2026 20:00:00 +0000

Type Values Removed Values Added
Description Black is the uncompromising Python code formatter. Prior to 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.
Title Black: Arbitrary file writes from unsanitized user input in cache file name
Weaknesses CWE-22
References
Metrics cvssV4_0

{'score': 8.7, 'vector': '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'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-03-13T16:10:51.448Z

Reserved: 2026-03-11T15:05:48.400Z

Link: CVE-2026-32274

cve-icon Vulnrichment

Updated: 2026-03-13T16:10:48.119Z

cve-icon NVD

Status : Analyzed

Published: 2026-03-12T20:16:06.350

Modified: 2026-03-18T14:12:39.793

Link: CVE-2026-32274

cve-icon Redhat

Severity : Important

Publid Date: 2026-03-12T19:47:07Z

Links: CVE-2026-32274 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-03-23T09:54:48Z

Weaknesses