{"id":"GHSA-3936-cmfr-pm3m","summary":"Black: Arbitrary file writes from unsanitized user input in cache file name","details":"### Impact\n\nBlack 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. \n\n### Patches\n\nFixed in Black 26.3.1.\n\n### Workarounds\n\nDo not allow untrusted user input into the value of the `--python-cell-magics` option.","aliases":["CVE-2026-32274","PYSEC-2026-2121"],"modified":"2026-09-10T03:50:36.703011526Z","published":"2026-03-12T18:33:10Z","database_specific":{"severity":"HIGH","github_reviewed":true,"github_reviewed_at":"2026-03-12T18:33:10Z","nvd_published_at":"2026-03-12T20:16:06Z","cwe_ids":["CWE-22"]},"references":[{"type":"WEB","url":"https://github.com/psf/black/security/advisories/GHSA-3936-cmfr-pm3m"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-32274"},{"type":"WEB","url":"https://github.com/psf/black/pull/4176"},{"type":"WEB","url":"https://github.com/psf/black/pull/5038"},{"type":"WEB","url":"https://github.com/psf/black/commit/4937fe6cf241139ddbfc16b0bdbb5b422798909d"},{"type":"WEB","url":"https://github.com/psf/black/commit/ed770ba4dd50c419148a0fca2b43937a7447e1f9"},{"type":"WEB","url":"https://access.redhat.com/errata/RHSA-2026:10184"},{"type":"WEB","url":"https://access.redhat.com/errata/RHSA-2026:13545"},{"type":"WEB","url":"https://access.redhat.com/errata/RHSA-2026:13553"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2026-32274"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2447111"},{"type":"PACKAGE","url":"https://github.com/psf/black"},{"type":"WEB","url":"https://github.com/psf/black/releases/tag/26.3.1"},{"type":"WEB","url":"https://github.com/pypa/advisory-database/tree/main/vulns/black/PYSEC-2026-2121.yaml"},{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32274.json"}],"affected":[{"package":{"name":"black","ecosystem":"PyPI","purl":"pkg:pypi/black"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"24.3.0"},{"fixed":"26.3.1"}]}],"versions":["24.10.0","24.3.0","24.4.0","24.4.1","24.4.2","24.8.0","25.1.0","25.11.0","25.12.0","25.9.0","26.1.0","26.1a1","26.3.0"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-3936-cmfr-pm3m/GHSA-3936-cmfr-pm3m.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"},{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N"}]}