CVE-2024-21503

psf/black: ReDoS via the lines_with_leading_tabs_expanded() function in strings.py file

Published Mar 19, 2024 CVSS 3.1 · 5.3 Medium EPSS < 1% KEV · Not listed
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
EUVD EUVD EUVD-2024-0019 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.\r\rExploiting this vulnerability is possible when running Black on untrusted input, or if you habitually put thousands of leading tab characters in your docstrings.
Github GHSA Github GHSA GHSA-fj7x-q9j7-g6q6 Black vulnerable to Regular Expression Denial of Service (ReDoS)
History
Type Values Removed Values Added
Metrics epss

{'score': 0.0006}

epss

{'score': 0.00062}

Type Values Removed Values Added
Metrics epss

{'score': 0.00044}

epss

{'score': 0.0006}

Weaknesses

Sources

Status
PUBLISHED
Assigner
snyk
Published
Updated
Aug 1, 2024, 10:20 PM
Reserved
Dec 22, 2023, 12:33 PM
Status
Deferred
Published
Mar 19, 2024, 5:15 AM
Modified
Jun 17, 2026, 7:09 AM
Severity
Moderate
Public date
Mar 19, 2024, 12:00 AM