CVE-2026-32274: 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.
Security readout for executives and security teams
Plain-English summary
Black, a widely used Python formatter, could write its cache file outside the intended cache location when a specific option value is attacker-controlled. This can let an attacker cause file writes with the permissions of the Black process. The issue affects Black 24.3.0 through versions before 26.3.1 and is fixed in 26.3.1.
Executive priority
Prioritize remediation in shared build systems, CI runners, and services that process untrusted code or user settings. For ordinary trusted developer formatting, urgency is lower but upgrade should still be scheduled promptly because the fix is available.
Technical view
CVE-2026-32274 is a CWE-22 path traversal issue in Black cache filename construction. The --python-cell-magics option was included without sanitization, allowing arbitrary cache file writes when an attacker controls that argument. CVSS v4.0 score is 8.7. Affected versions are >=24.3.0 and <26.3.1.
Likely exposure
Most exposed environments are CI/CD, developer automation, hosted formatting services, or tools that pass user-controlled Black options. Local developer use with trusted configuration is lower risk. Check Python dependency locks, containers, build images, and downstream vendor packages for vulnerable Black versions.
Exploitation context
The provided sources do not show active exploitation, and KEV is false. Exploitation requires control over the --python-cell-magics value used by Black. Impact is file integrity: writes occur with the privileges and filesystem access of the Black process.
Researcher notes
Key evidence comes from the GitHub advisory, CVE record, Black release, commits, and Red Hat references. The vulnerability is limited to cache filename handling tied to --python-cell-magics. Sources confirm affected range and fixed version, but do not provide evidence of exploitation in the wild.
Mitigation direction
Upgrade Black to version 26.3.1 or later.
Block untrusted users from controlling Black command-line options.
Review CI/CD and formatting services for option pass-through.
Apply relevant Red Hat errata where Black is vendor-packaged.
Check vendor guidance if upgrades are managed through a distribution.
Validation and detection
Inventory Black versions in dependency locks and virtual environments.
Scan container and CI images for Black >=24.3.0 and <26.3.1.
Review automation for use of --python-cell-magics.
Confirm Black reports version 26.3.1 or later after remediation.
Track Red Hat advisories if using affected downstream packages.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-22: File access and web shell behavior lookup
File traversal and upload weaknesses can lead teams to review file, web shell, execution, and collection telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references file access or upload behavior, so file telemetry and web shell review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-22 · source CWE mapping
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.