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. 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.
AI Analysis
Technical Summary
Black, a Python code formatter, prior to version 26.3.1, improperly handled the --python-cell-magics option by incorporating its value directly into cache file names without sanitization. This allowed an attacker who can control this option to perform path traversal and write cache files to arbitrary locations on the filesystem. The vulnerability is classified as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory). The issue is fixed in Black 26.3.1. The CVSS 4.0 base score is 8.7, indicating high severity, with network attack vector, low attack complexity, no privileges or user interaction required, and high impact on integrity.
Potential Impact
An attacker able to control the --python-cell-magics option can write cache files to arbitrary filesystem locations, potentially overwriting or creating files outside the intended cache directory. This could lead to unauthorized file modification or code execution depending on the environment and usage context. The vulnerability affects system integrity but does not require privileges or user interaction to exploit.
Mitigation Recommendations
Upgrade Black to version 26.3.1 or later, where this vulnerability is fixed. There are no vendor advisories indicating alternative mitigations or that no action is required. Patch status is confirmed fixed in 26.3.1.
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. 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.
CVSS v4.0
Score 8.7high
Affected software
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, a Python code formatter, prior to version 26.3.1, improperly handled the --python-cell-magics option by incorporating its value directly into cache file names without sanitization. This allowed an attacker who can control this option to perform path traversal and write cache files to arbitrary locations on the filesystem. The vulnerability is classified as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory). The issue is fixed in Black 26.3.1. The CVSS 4.0 base score is 8.7, indicating high severity, with network attack vector, low attack complexity, no privileges or user interaction required, and high impact on integrity.
Potential Impact
An attacker able to control the --python-cell-magics option can write cache files to arbitrary filesystem locations, potentially overwriting or creating files outside the intended cache directory. This could lead to unauthorized file modification or code execution depending on the environment and usage context. The vulnerability affects system integrity but does not require privileges or user interaction to exploit.
Mitigation Recommendations
Upgrade Black to version 26.3.1 or later, where this vulnerability is fixed. There are no vendor advisories indicating alternative mitigations or that no action is required. Patch status is confirmed fixed in 26.3.1.
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: 07/15/2026, 08:55:31 UTC
Last updated: 07/31/2026, 19:22:58 UTC
Views: 439
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.