Skip to content
Heist/ feed
Back to feed
High

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

Type: advisorySources: OSV

Black is the uncompromising Python code formatter. Starting in version 24.3.0 and prior to version 26.3.1, 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. Fixed in Black 26.3.1.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-32274
Confirmed fixed CVEs
Not specified
Updated in this feed
5 Nov 2026, 01:20 UTC · Revision 1

Source evidence

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

core-osv · Original source

Published 12 Mar 2026, 19:47 UTC

Black is the uncompromising Python code formatter. Starting in version 24.3.0 and prior to version 26.3.1, 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. Fixed in Black 26.3.1.

osv:CVE-2026-32274
Complete source record
{
  "id": "30de03a406979e5d58a6fc2ed3f1a480db091f58db1dd51ed1fd8dc2c60bbfd1",
  "url": "https://osv.dev/vulnerability/CVE-2026-32274",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Black: Arbitrary file writes from unsanitized user input in cache file name",
    "summary": "Black is the uncompromising Python code formatter. Starting in version 24.3.0 and prior to version 26.3.1, 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. Fixed in Black 26.3.1.",
    "evidence": "osv:CVE-2026-32274",
    "products": [],
    "severity": "high",
    "structured": {
      "id": "CVE-2026-32274",
      "aliases": [
        "CVE-2026-32274",
        "GHSA-3936-cmfr-pm3m",
        "PYSEC-2026-2121"
      ],
      "metrics": [
        {
          "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"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://github.com/psf/black",
              "type": "GIT",
              "events": [
                {
                  "introduced": "552baf822992936134cbd31a38f69c8cfe7c0f05"
                },
                {
                  "fixed": "c6755bb741b6481d6b3d3bb563c83fa060db96c9"
                },
                {
                  "fixed": "4937fe6cf241139ddbfc16b0bdbb5b422798909d"
                },
                {
                  "fixed": "ed770ba4dd50c419148a0fca2b43937a7447e1f9"
                }
              ],
              "database_specific": {
                "extracted_events": [
                  {
                    "range": [
                      {
                        "introduced": "24.3.0"
                      },
                      {
                        "fixed": "26.3.1"
                      }
                    ],
                    "source": "AFFECTED_FIELD",
                    "strategy": "StringRangeExpression"
                  },
                  {
                    "range": [
                      {
                        "fixed": "4937fe6cf241139ddbfc16b0bdbb5b422798909d"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  },
                  {
                    "range": [
                      {
                        "fixed": "ed770ba4dd50c419148a0fca2b43937a7447e1f9"
                      }
                    ],
                    "source": "REFERENCES_COMMIT"
                  },
                  {
                    "range": [
                      {
                        "fixed": "c6755bb741b6481d6b3d3bb563c83fa060db96c9"
                      }
                    ],
                    "source": "REFERENCES_TAG",
                    "original_tag": "26.3.1"
                  }
                ]
              }
            }
          ],
          "versions": [
            "26.3.0",
            "26.1.0",
            "25.12.0",
            "25.11.0",
            "25.9.0",
            "25.1.0",
            "24.10.0",
            "24.8.0",
            "24.4.2",
            "24.4.1",
            "24.4.0",
            "24.3.0"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-32274.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:41.597341815Z",
      "provider": "osv",
      "references": [
        "https://access.redhat.com/security/cve/CVE-2026-32274",
        "https://github.com/psf/black/releases/tag/26.3.1",
        "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32274.json",
        "https://access.redhat.com/errata/RHSA-2026:10184",
        "https://access.redhat.com/errata/RHSA-2026:13545",
        "https://access.redhat.com/errata/RHSA-2026:13553",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/32xxx/CVE-2026-32274.json",
        "https://github.com/psf/black/security/advisories/GHSA-3936-cmfr-pm3m",
        "https://github.com/pypa/advisory-database/tree/main/vulns/black/PYSEC-2026-2121.yaml",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-32274",
        "https://bugzilla.redhat.com/show_bug.cgi?id=2447111",
        "https://github.com/psf/black/commit/4937fe6cf241139ddbfc16b0bdbb5b422798909d",
        "https://github.com/psf/black/commit/ed770ba4dd50c419148a0fca2b43937a7447e1f9",
        "https://github.com/psf/black/pull/4176",
        "https://github.com/psf/black/pull/5038"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-22"
        ],
        "cna_assigner": "GitHub_M",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/32xxx/CVE-2026-32274.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-32274",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 509016,
  "published_at": "2026-03-12T19:47:07.464+00:00"
}