---
id: CVE-2026-31900
aliases:
  - PYSEC-2026-2120
  - GHSA-v53h-f6m7-xcgm
title: >-
  Black is the uncompromising Python code formatter. Black provides a GitHub
  action for formatting code. This action supports an option, us…
summary: >-
  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 mal…
severity: critical
cvss: 9.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'
vendor: black
product: black
ecosystem: pip
affected:
  - black < 26.3.0
patched:
  - black 26.3.0
published: '2026-03-11'
updated: '2026-07-13'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/PYSEC-2026-2120'
references:
  - url: 'https://github.com/psf/black/security/advisories/GHSA-v53h-f6m7-xcgm'
  - url: >-
      https://github.com/psf/black/commit/0a2560b981364dde4c8cf8ce9d164c40669a8611
tags:
  - osv
  - pip
  - exploit-available
epss: 0.00636
epssPercentile: 0.48293
ingestedAt: '2026-07-13T18:58:07.407Z'
exploits:
  github: 1
  githubRepos:
    - 'https://github.com/Batosay1337Lab/cve-2026-31900-lab'
  checkedAt: '2026-09-26T09:05:41.884Z'
exploitAvailable: true
---

## Overview

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.

## Affected packages

- `black < 26.3.0`

## Remediation

Upgrade to a patched release:

- `black 26.3.0`
