Vulnerability · Published Mar 19, 2024 · Assigned by snyk

CVE-2024-21503

Medium 5.3

In plain English

A medium-severity regular-expression denial of service in black. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 1.0% (higher than 62% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)5.3Medium
Exploit odds (30 days)1.0%top 37.6% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

Official description

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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Alpine:v3.20black24.3.0-r0ALPINE-CVE-2024-21503
Alpine:v3.21black24.3.0-r0ALPINE-CVE-2024-21503
Alpine:v3.22black24.3.0-r0ALPINE-CVE-2024-21503
Alpine:v3.23black24.3.0-r0ALPINE-CVE-2024-21503
Alpine:v3.24black24.3.0-r0ALPINE-CVE-2024-21503
Debian:12blackno fix listedDEBIAN-CVE-2024-21503
Debian:13black24.4.0-1DEBIAN-CVE-2024-21503
Debian:14black24.4.0-1DEBIAN-CVE-2024-21503
PyPIblack24.3.0PYSEC-2024-48
PyPIblack24.3.0GHSA-fj7x-q9j7-g6q6
Ubuntu:22.04:LTSblackno fix listedUBUNTU-CVE-2024-21503
Ubuntu:24.04:LTSblackno fix listedUBUNTU-CVE-2024-21503
Ubuntu:25.10blackno fix listedUBUNTU-CVE-2024-21503
Ubuntu:26.04:LTSblackno fix listedUBUNTU-CVE-2024-21503
Ubuntu:26.10blackno fix listedUBUNTU-CVE-2024-21503

Affected products (as reported)

VendorProductVersions
n/a black 0 – before 24.3.0

Weakness: CWE-1333, CWE-75 · Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L/E:P

References