5.3medium
Black vulnerable to Regular Expression Denial of Service (ReDoS)
- Severity
- 5.3medium CVSS:3.1 by snyk
- Exploit likelihood
- 0.98% (higher than 63% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- snyk
- Also known as
- GHSA-fj7x-q9j7-g6q6PYSEC-2024-48
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| black | before 24.3.0 | CVE List |
| python_software_foundation black | before 24.3.0 | CVE List |
| black (PyPI) | before 24.3.0, before f00093672628d212b8965a8993cee8bedf5fe9b8 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| snyk | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L/E:P |
| GitHub | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
Classification
What each source says
CVE List
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.
NVD (es)
Las versiones del paquete black anteriores a la 24.3.0 son vulnerables a la denegación de servicio de expresión regular (ReDoS) a través de la funciónlines_with_leading_tabs_expanded en el archivo strings.py. Un atacante podría aprovechar esta vulnerabilidad creando una entrada maliciosa que provoque una denegación de servicio. Es posible explotar esta vulnerabilidad cuando se ejecuta Black en entradas que no son de confianza o si habitualmente coloca miles de caracteres de tabulación iniciales en sus cadenas de documentación.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2024-21503 changed 2024-08-01 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-fj7x-q9j7-g6q6 changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2024-21503 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2024-48 changed 2026-06-10 | CC-BY-4.0 |