HighGHSA-3936-cmfr-pm3mCVE-2026-32274PYSEC-2026-2121

Black: Arbitrary file writes from unsanitized user input in cache file name

Published 12 Mar 2026 · Updated 10 Sept 2026

Is your project on an affected black?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

blackPyPI
Affected
>=24.3.0 <26.3.1
Fixed in
26.3.1
Update to the fixed version for your release line, for example:pip install 'black>=26.3.1'

Details

Impact

Black writes a cache file, the name of which is computed from various formatting options. The value of the --python-cell-magics option was placed in the filename without sanitization, which allowed an attacker who controls the value of this argument to write cache files to arbitrary file system locations.

Patches

Fixed in Black 26.3.1.

Workarounds

Do not allow untrusted user input into the value of the --python-cell-magics option.

Is GHSA-3936-cmfr-pm3m in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected black, and gives you the command that fixes it.

More advisories for black

  • HighCVE-2026-114134Black: GitHub Action installs unvalidated required-version from pyproject.toml · 22 Oct 2026
  • LowCVE-2026-31900No summary published · 11 Mar 2026
  • MediumCVE-2024-21503Black vulnerable to Regular Expression Denial of Service (ReDoS) · 19 Mar 2024
black security overview

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.