# CVE-2024-21503: Black vulnerable to Regular Expression Denial of Service (ReDoS)

- Severity: Medium 5.3 (CVSS:3.1, scored by snyk) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L/E:P`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.98%, higher than 63% of CVEs (2026-12-01)
- Published: 2024-03-19T05:00:01.474Z
- Modified: 2026-09-10T03:50:10.486Z
- Also known as: GHSA-fj7x-q9j7-g6q6, PYSEC-2024-48
- Weaknesses: CWE-75, CWE-1333
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: snyk

## 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.

(As written by CVE List.)

## Affected

- black: before 24.3.0
- python_software_foundation black: before 24.3.0
- black (PyPI): before 24.3.0; before f00093672628d212b8965a8993cee8bedf5fe9b8

## Every score

- snyk: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L/E:P`
- GitHub: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`

## References

- <https://security.snyk.io/vuln/SNYK-PYTHON-BLACK-6256273> (web)
- <https://github.com/psf/black/releases/tag/24.3.0> (web)
- <https://github.com/psf/black/commit/f00093672628d212b8965a8993cee8bedf5fe9b8> (fix, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2024-21503> (advisory)
- <https://github.com/psf/black> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/black/PYSEC-2024-48.yaml> (web)
- <https://github.com/advisories/GHSA-fj7x-q9j7-g6q6> (advisory)

## Sources

- CVE List: [CVE-2024-21503](https://www.cve.org/CVERecord?id=CVE-2024-21503), CVE Terms of Use, modified 2024-08-01
- GitHub Advisory Database: [GHSA-fj7x-q9j7-g6q6](https://github.com/advisories/GHSA-fj7x-q9j7-g6q6), CC-BY-4.0, modified 2026-09-10
- NVD: [CVE-2024-21503](https://nvd.nist.gov/vuln/detail/CVE-2024-21503), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2024-48](https://osv.dev/vulnerability/PYSEC-2024-48), CC-BY-4.0, modified 2026-06-10

---

Page: https://cve.day/CVE-2024-21503 · Whole record: https://cve.day/CVE-2024-21503.json · Rebuilt by cve.day 2026-11-25T22:58:37.694Z
