{"id":"CVE-2024-21503","aliases":["GHSA-fj7x-q9j7-g6q6","PYSEC-2024-48"],"title":"Black vulnerable to Regular Expression Denial of Service (ReDoS)","summary":"Black vulnerable to Regular Expression Denial of Service (ReDoS)","severity":"medium","cvss":5.3,"cvssVector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","vendor":"black","product":"black","ecosystem":"pip","affected":["black < 24.3.0"],"patched":["black 24.3.0"],"published":"2024-03-19","updated":"2026-09-10","sourceUpdated":"2026-09-10T03:50:10.486429507Z","source":"OSV","sourceUrl":"https://osv.dev/vulnerability/GHSA-fj7x-q9j7-g6q6","references":[{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-21503"},{"url":"https://github.com/psf/black/commit/f00093672628d212b8965a8993cee8bedf5fe9b8"},{"url":"https://github.com/psf/black"},{"url":"https://github.com/psf/black/releases/tag/24.3.0"},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/black/PYSEC-2024-48.yaml"},{"url":"https://security.snyk.io/vuln/SNYK-PYTHON-BLACK-6256273"}],"tags":["osv","pip"],"epss":0.00979,"epssPercentile":0.60679,"ingestedAt":"2026-09-12T03:13:01.692Z","slug":"CVE-2024-21503","body":"## Overview\n\nVersions 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.\n\nExploiting this vulnerability is possible when running Black on untrusted input, or if you habitually put thousands of leading tab characters in your docstrings.\n\n## Affected packages\n\n- `black < 24.3.0`\n\n## Remediation\n\nUpgrade to a patched release:\n\n- `black 24.3.0`","depth":"sunlit","depthScore":29,"depthScoreParts":{"impact":29.2,"likelihood":0.2,"exploitation":0,"ransomware":0},"changes":[]}