Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

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

0
High
VulnerabilityCVE-2026-32274cvecve-2026-32274cwe-22
Published: Thu Mar 12 2026 (03/12/2026, 19:47:07 UTC)
Source: CVE Database V5
Vendor/Project: psf
Product: black

Description

CVE-2026-32274 is a high-severity path traversal vulnerability in the Python code formatter Black (psf black) versions prior to 26. 3. 1. The issue arises because the --python-cell-magics option value is unsanitized and incorporated into the cache filename, allowing an attacker controlling this argument to write cache files to arbitrary filesystem locations. This vulnerability requires no authentication or user interaction and can be exploited remotely. The flaw impacts confidentiality and integrity by enabling unauthorized file writes, potentially leading to code execution or system compromise. The vulnerability has a CVSS 4. 0 base score of 8. 7, reflecting its critical nature. Organizations using Black for automated code formatting, especially in CI/CD pipelines or shared environments, are at risk.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 03/20/2026, 02:36:31 UTC

Technical Analysis

CVE-2026-32274 is a path traversal vulnerability classified under CWE-22 found in the Python code formatter Black, maintained by the Python Software Foundation (psf). Black versions prior to 26.3.1 generate cache filenames based on various formatting options, including the --python-cell-magics argument. The vulnerability stems from the failure to sanitize the value of this argument before incorporating it into the cache filename. An attacker who can control the --python-cell-magics option can craft input that traverses directories (e.g., using '../') to write cache files outside the intended restricted cache directory. This arbitrary file write capability can be leveraged to overwrite critical files, inject malicious code, or disrupt system operations. The vulnerability does not require any authentication or user interaction and can be exploited remotely if an attacker can influence the command-line arguments passed to Black. The CVSS 4.0 vector indicates network attack vector, low attack complexity, no privileges required, no user interaction, and high impact on integrity, with no impact on confidentiality or availability. Although no known exploits are reported in the wild yet, the high severity score and ease of exploitation make this a critical issue for developers and organizations relying on Black for automated code formatting. The vulnerability was fixed in Black version 26.3.1 by properly sanitizing the --python-cell-magics input before using it in filenames, preventing directory traversal and unauthorized file writes.

Potential Impact

The primary impact of CVE-2026-32274 is unauthorized file write capability due to path traversal, which threatens the integrity of affected systems. Attackers can overwrite or create files in arbitrary locations, potentially leading to code injection, privilege escalation, or disruption of development environments. This can compromise build pipelines, continuous integration systems, or developer workstations that use Black for formatting Python code. The vulnerability could facilitate supply chain attacks if exploited in automated environments, impacting software integrity and trust. Although confidentiality and availability impacts are minimal, the integrity breach can have cascading effects, including execution of malicious code or denial of service through corrupted files. Organizations worldwide that incorporate Black into their development workflows face risks of compromised codebases and operational disruptions. The lack of required privileges or user interaction lowers the barrier for exploitation, increasing the threat surface.

Mitigation Recommendations

To mitigate CVE-2026-32274, organizations should immediately upgrade Black to version 26.3.1 or later, which includes the fix for proper input sanitization. Review and restrict access to systems where Black is used, especially in automated CI/CD pipelines, to prevent unauthorized manipulation of command-line arguments. Implement strict input validation and sanitization for any user-controllable parameters passed to development tools. Monitor filesystem changes in directories used by Black for caching to detect suspicious file writes or modifications. Employ application whitelisting and endpoint protection to detect and block unauthorized file operations. Educate developers and DevOps teams about the risks of unsanitized inputs in tooling and enforce secure coding and deployment practices. Regularly audit and update development dependencies to incorporate security patches promptly.

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

Threat ID: 69b31b3a2f860ef943e8fcb0

Added to database: 3/12/2026, 7:59:54 PM

Last enriched: 3/20/2026, 2:36:31 AM

Last updated: 4/27/2026, 1:27:24 AM

Views: 211

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