CVE-2026-32274: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in psf black
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.
AI Analysis
Technical Summary
Black writes a cache file with a filename computed from various formatting options. The --python-cell-magics option's value was included in the filename without sanitization, enabling an attacker who controls this argument to write cache files to arbitrary locations on the filesystem. This improper limitation of pathname to a restricted directory (CWE-22) can lead to arbitrary file write vulnerabilities. The vulnerability is addressed in Black 26.3.1.
Potential Impact
An attacker able to control the --python-cell-magics option can write or overwrite files anywhere on the filesystem where the Black process has write permissions. This can lead to integrity violations by modifying or creating critical files, potentially enabling code execution or bypassing security mechanisms. Confidentiality and availability impacts are also possible if sensitive files are overwritten or corrupted. The CVSS v3.1 base score is 8.7 (high severity) with network attack vector, no privileges required, and high integrity impact.
Mitigation Recommendations
A fix is available in Black version 26.3.1. Users should upgrade to this version to remediate the vulnerability. Until upgrading, avoid allowing untrusted user input in the --python-cell-magics option to prevent exploitation. No other effective mitigations meeting ease of use and applicability criteria are currently available according to the vendor advisory.
CVE-2026-32274: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in psf black
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.
CVSS v4.0
Score 8.7high
Affected software
psf
black
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Black writes a cache file with a filename computed from various formatting options. The --python-cell-magics option's value was included in the filename without sanitization, enabling an attacker who controls this argument to write cache files to arbitrary locations on the filesystem. This improper limitation of pathname to a restricted directory (CWE-22) can lead to arbitrary file write vulnerabilities. The vulnerability is addressed in Black 26.3.1.
Potential Impact
An attacker able to control the --python-cell-magics option can write or overwrite files anywhere on the filesystem where the Black process has write permissions. This can lead to integrity violations by modifying or creating critical files, potentially enabling code execution or bypassing security mechanisms. Confidentiality and availability impacts are also possible if sensitive files are overwritten or corrupted. The CVSS v3.1 base score is 8.7 (high severity) with network attack vector, no privileges required, and high integrity impact.
Mitigation Recommendations
A fix is available in Black version 26.3.1. Users should upgrade to this version to remediate the vulnerability. Until upgrading, avoid allowing untrusted user input in the --python-cell-magics option to prevent exploitation. No other effective mitigations meeting ease of use and applicability criteria are currently available according to the vendor advisory.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-03-11T15:05:48.400Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Vendor Advisory Urls
- [{"url":"https://access.redhat.com/security/cve/CVE-2026-32274","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:13553","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:13545","vendor":"Red Hat"},{"url":"https://access.redhat.com/errata/RHSA-2026:10184","vendor":"Red Hat"}]
Threat ID: 69b31b3a2f860ef943e8fcb0
Added to database: 03/12/2026, 19:59:54 UTC
Last enriched: 08/03/2026, 21:23:24 UTC
Last updated: 09/14/2026, 22:01:33 UTC
Views: 473
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.