Skip to main content
CVE-2024-21503VulnerabilityPublished Updated

Versions of the package black before 24.3.0 are vulnerable to Regular Expression Denial of Service (ReDoS) via the

Affects blackSource GCVE Database

0
Compare

Not known to be exploited · CVSS 5.3 Medium · fixed in 24.3.0 : update black when convenient.

Data as of 9 Nov 2026, 14:35 UTC

CVSS 3.1 base score
5.3Medium
How severe the flaw is on the 0–10 CVSS scale.
Patch
Available – fixed in 24.3.0
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 19 Mar 2024

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponized: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 9 Nov 2026.

What to do

Affected software

ProductAffectedFixed in
Ubuntu 26.10blackpkg:deb/ubuntu/black?arch=source&distro=stonkingOther threatsAffected
  • =26.3.1-1
  • =26.5.1-1
Fixed in–
Ubuntu 25.10blackpkg:deb/ubuntu/black?arch=source&distro=questingOther threatsAffected
  • =25.1.0-2
  • =25.1.0-3
Fixed in–
Ubuntu 24.04 LTSblackpkg:deb/ubuntu/black?arch=source&distro=nobleOther threatsAffected
  • 23.7.0-1 – 24.2.0-1ubuntu1
4 affected builds
Fixed in–
Ubuntu 22.04 LTSblackpkg:deb/ubuntu/black?arch=source&distro=jammyOther threatsAffected
  • 20.8b1-4 – 21.12b0-1
4 affected builds
Fixed in–
Ubuntu 20.04 LTSblackpkg:deb/ubuntu/black?arch=source&distro=focalOther threatsAffected
  • =19.3b0-1
Fixed in–

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

Upgrade Black to version 24.3.0 or later, where this vulnerability is fixed. Avoid running Black on untrusted input or input containing thousands of leading tab characters until patched.

Description

Versions of the Python code formatter Black prior to 24.3.0 contain a Regular Expression Denial of Service (ReDoS) vulnerability in the lines_with_leading_tabs_expanded function within strings.py. This flaw allows an attacker to cause a denial of service by providing malicious input with many leading tab characters. The vulnerability is exploitable when Black processes untrusted input or docstrings with thousands of leading tabs. The issue has a medium severity rating with a CVSS score of 5.3. A fix is available in version 24.3.0.

References

Community reviews

Loading reviews…