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-31900: CWE-20: Improper Input Validation in psf black

0
High
VulnerabilityCVE-2026-31900cvecve-2026-31900cwe-20
Published: Wed Mar 11 2026 (03/11/2026, 19:15:20 UTC)
Source: CVE Database V5
Vendor/Project: psf
Product: black

Description

Black is the uncompromising Python code formatter. Black provides a GitHub action for formatting code. This action supports an option, use_pyproject: true, for reading the version of Black to use from the repository pyproject.toml. A malicious pull request could edit pyproject.toml to use a direct URL reference to a malicious repository. This could lead to arbitrary code execution in the context of the GitHub Action. Attackers could then gain access to secrets or permissions available in the context of the action. Version 26.3.0 fixes this vulnerability.

AI-Powered Analysis

AILast updated: 03/11/2026, 19:59:31 UTC

Technical Analysis

Black is a widely used Python code formatter that offers a GitHub Action integration to automate code formatting workflows. This GitHub Action supports an option, use_pyproject: true, which instructs it to read the Black version from the repository's pyproject.toml file. The vulnerability arises because the action does not properly validate the contents of pyproject.toml, allowing a malicious actor to craft a pull request that alters this file to specify a direct URL pointing to a malicious repository. When the GitHub Action runs, it fetches and executes code from this untrusted source, resulting in arbitrary code execution within the GitHub Actions runner environment. This execution context often has access to repository secrets and permissions, enabling attackers to exfiltrate sensitive data or perform unauthorized operations. The root cause is improper input validation (CWE-20) of user-controlled configuration data. The vulnerability affects all versions of Black prior to 26.3.0, which includes the vulnerable GitHub Action implementation. The CVSS 4.0 base score is 8.7, reflecting a high severity due to network attack vector, no required privileges or user interaction, and high impact on confidentiality, integrity, and availability. Although no exploits have been reported in the wild yet, the potential impact is significant given the widespread use of Black and GitHub Actions in software development pipelines. The issue was publicly disclosed on March 11, 2026, and fixed in version 26.3.0.

Potential Impact

The vulnerability enables attackers to execute arbitrary code within the GitHub Actions runner environment by manipulating the pyproject.toml file in a pull request. This can lead to unauthorized access to repository secrets such as API tokens, credentials, and deployment keys, potentially compromising the entire software supply chain. Organizations relying on automated CI/CD pipelines with Black's GitHub Action are at risk of code injection attacks that could result in data breaches, unauthorized deployments, or lateral movement within their infrastructure. The impact extends beyond confidentiality to integrity and availability, as attackers could alter code, disrupt build processes, or introduce malicious payloads. Given the ease of exploitation—no authentication or user interaction is required—and the common use of GitHub Actions globally, the threat poses a significant risk to software development organizations, open source projects, and enterprises using Black for code formatting automation.

Mitigation Recommendations

To mitigate this vulnerability, organizations should immediately upgrade Black to version 26.3.0 or later, which includes the fix for this issue. Additionally, implement strict pull request review policies to detect and block unauthorized changes to configuration files such as pyproject.toml. Limit the scope and permissions of GitHub Actions workflows by using least privilege principles, including restricting access to secrets and using environment protection rules. Employ branch protection rules to require manual approval for pull requests that modify workflow or configuration files. Monitor GitHub Actions logs for unusual activity and consider using ephemeral runners or isolated environments to reduce the impact of potential code execution. Finally, educate developers and DevOps teams about the risks of supply chain attacks and the importance of validating third-party code and configuration changes.

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-09T21:59:02.689Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 69b1c6312f860ef9436c35dc

Added to database: 3/11/2026, 7:44:49 PM

Last enriched: 3/11/2026, 7:59:31 PM

Last updated: 3/14/2026, 3:18:43 AM

Views: 35

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 in Console -> Billing 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