CVE-2026-31900: Black's vulnerable version parsing leads to RCE in GitHub Action

Published Mar 7, 2026
·
Updated

Impact

Black provides a GitHub action for formatting code. This action supports an option, usepyproject: 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.

Patches

Version 26.3.0 fixes this vulnerability by tightening the validation of the version field. Users who use the GitHub Action as psf/black@stable will automatically pick up this update.

Workarounds

Do not use the usepyproject: true option in the psf/black GitHub Action.

Other sources

Black is the uncompromising Python code formatter. Black provides a GitHub action for formatting code. This action supports an option, usepyproject: 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.

MITRE

Affected Software

3 affected componentsFixes available
actions/psf/black<26.3.0
26.3.0
Python Black<26.3.0
IBM Concert Software<=1.0.0-2.3.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade actions/psf/black to a version that resolves this vulnerability.

    Fixed in 26.3.0
  2. Upgrade

    Upgrade psf/black to a version that resolves this vulnerability.

    Fixed in 26.3.0
  3. Configuration

    Do not use the `use_pyproject: true` option in the psf/black GitHub Action; avoid reading the Black version from repository `pyproject.toml`.

    psf/black GitHub Action use_pyproject = false

Event History

Mar 7, 2026
Advisory Published
via GitHub·02:32 AM
Data Sourced
via GitHub·02:32 AM
DescriptionWeaknessAffected Software
Mar 11, 2026
CVE Published
via MITRE·07:15 PM
Data Sourced
via MITRE·07:15 PM
DescriptionWeakness
Data Sourced
via NVD·08:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:16 PM
RemedyAffected Software
Aug 27, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

What is the severity of CVE-2026-31900?

CVE-2026-31900 is classified as a critical vulnerability due to its potential for remote code execution.

2

How do I fix CVE-2026-31900?

To mitigate CVE-2026-31900, upgrade to Black version 26.3.0 or later.

3

What is affected by CVE-2026-31900?

CVE-2026-31900 affects versions of Black prior to 26.3.0 when using the GitHub action with the 'use_pyproject' option.

4

What types of systems are vulnerable to CVE-2026-31900?

CVE-2026-31900 impacts systems utilizing affected versions of the Black formatter in GitHub actions.

5

What is the main impact of CVE-2026-31900?

The main impact of CVE-2026-31900 is the potential for attackers to execute arbitrary code on systems using vulnerable versions of Black.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203