CVE-2026-114134
Black Action allows unvalidated tool.black.required-version, enabling code injection.
- CVSS 8.7
- CWE-829
- Input Validation and Sanitization
- Remote
Black is the uncompromising Python code formatter. Prior to 26.10.1, the Black GitHub Action with use_pyproject: true accepts tool.black.required-version from pyproject.toml without validating that it is a released Black version specifier. An attacker who can submit a pull request can change that field to a direct reference to attacker-controlled code, causing the workflow to install and execute the code in the victim repository's GitHub Actions context. This issue is fixed in version 26.10.1.
- CWE
- CWE-829
- CVSS base score
- 8.7
- Published
- 2026-11-05
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Black
- Fixed by upgrading
- Yes
Solution
Upgrade the Black GitHub Action to v26.10.1 or newer.
Vulnerable code sample
import subprocess
import toml
def install_black_from_pyproject(pyproject_path: str) -> None:
"""Read tool.black.required-version and install it."""
data = toml.load(pyproject_path)
# VULNERABLE: directly trusts required-version string, allowing arbitrary package spec
spec = data["tool"]["black"]["required-version"]
subprocess.run(["python", "-m", "pip", "install", spec], check=True)Patched code sample
import subprocess
import toml
def install_black_from_pyproject(pyproject_path: str) -> None:
"""Read tool.black.required-version and install it after validation."""
data = toml.load(pyproject_path)
# FIX: validate that required-version is a proper Black version specifier
spec = data["tool"]["black"]["required-version"]
if not spec.startswith(("==", ">=", "<=", "~=", "!=")):
raise ValueError("Invalid Black version specifier")
subprocess.run(["python", "-m", "pip", "install", f"black{spec}"], check=True)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Action: validate required-version better (#5510) (psf/black)
action/main.py · read_version_specifier_from_pyproject
Cite this entry
@misc{vaitp:cve2026114134,
title = {{Black Action allows unvalidated tool.black.required-version, enabling code injection.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-114134},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-114134/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
