Skip to main content
EPSS 0.6%top 52%

CVE-2026-32274: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in psf black

0
High
Published: 03/12/2026 (03/12/2026, 19:47:07 UTC)
Source: CVE Database V5
Vendor/Project: psf
Product: 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

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vuln. Confidentiality
None
Vuln. Integrity
High
Vuln. Availability
None
Subsq. Confidentiality
None
Subsq. Integrity
None
Subsq. Availability
None
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

Affected software

psf

black

Affected versions
>=24.3.0 <26.3.1
black
pkg:pypi/black
Affected versions
<26.3.1

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/03/2026, 21:23:24 UTC

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.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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/13/2026, 22:01:33 UTC

Views: 472

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses