CVE-2024-21503: Black vulnerable to Regular Expression Denial of Service (ReDoS)
CVE-2024-21503 · Severity: low · CVSS 3.1 · Published 2024-03-19
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.
No. Junglewise Threat Intelligence has no report of CVE-2024-21503 being exploited in the wild.
How severe is CVE-2024-21503?
Low severity, with a CVSS score of 3.1, published 19 March 2024.
Which products and versions are affected?
black (PyPI) ECOSYSTEM:introduced=0,fixed=24.3.0, GIT:introduced=0,fixed=f00093672628d212b8965a8993cee8bedf5fe9b8|ECOSYSTEM:introduced=0,fixed=24.3.0.
Is there a fix for CVE-2024-21503?
Yes. black (PyPI): upgrade to 24.3.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
Am I affected by CVE-2024-21503?
Check whether you run black (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
black (PyPI): upgrade to 24.3.0 or later
pip install "black>=24.3.0"
Affected products
black (PyPI) ECOSYSTEM:introduced=0,fixed=24.3.0, GIT:introduced=0,fixed=f00093672628d212b8965a8993cee8bedf5fe9b8|ECOSYSTEM:introduced=0,fixed=24.3.0