Live threats

All CVEs / python_software_foundation

CVE-2024-21503python_software_foundation black

Medium 5.3 No auth needed

Priority
47
CVSS 3.1
5.3
EPSS
1.1%
probability of exploitation in 30 days · percentile 66
Auth required
No
Published
Mar 19, 2024
Updated
Jun 17, 2026
Category
Application · Cross-platform
Weakness (CWE)
CWE-1333, CWE-75
SSVC (CISA)
Exploitation: proof of concept · Automatable: yes · Technical impact: partial
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

What happens

Versions of the package black before 24.3.0 are vulnerable to Regular Expression Denial of Service (ReDoS) via the lines_with_leading_tabs_expanded function in the strings.py file. An attacker could exploit this vulnerability by crafting a malicious input that causes a denial of service. Exploiting this vulnerability is possible when running Black on untrusted input, or if you habitually put thousands of leading tab characters in your docstrings.

Original NVD text.

What to do

  1. Apply the vendor's security update for black.
  2. It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.

Affected packages

EcosystemPackageAffected versionsFixed inHow to upgrade
PyPI black < 24.3.0 24.3.0 pip install "black>=24.3.0"
PyPI black < 24.3.0 24.3.0 pip install "black>=24.3.0"

Per OSV / GitHub Advisories (GHSA-fj7x-q9j7-g6q6, PYSEC-2024-48). Check the version in your lockfile before upgrading.

Affected products

As reported by the CNA that published the CVE. NVD has not added CPEs with versions yet.

Official advisories

Vendor, CERT and distribution advisories that name this CVE. Original titles.

Official sources

References

Links published by the sources. Open them with care.