Regular expression denial of service in black
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Denial of service
- Confidentiality · integrity · availability
- None · None · Low
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA, GitHub and Red Hat. Impact type from CWE-1333.
Summary
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- Yes
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | black | before 24.3.0 | 24.3.0 | Patch available | CNA |
| — | black (PyPI) | before 24.3.0 | 24.3.0 | Patch available | GHSA-fj7x-q9j7-g6q6 |
- black Vendor— Affected before 24.3.0 Fixed in 24.3.0 Patch available CNA
- black (PyPI) Vendor— Affected before 24.3.0 Fixed in 24.3.0 Patch available GHSA-fj7x-q9j7-g6q6
CPE names CISA-ADP · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:python_software_foundation:black:*:*:*:*:*:*:*:* | — | — | Python Software Foundation |
- cpe:2.3:a:python_software_foundation:black:*:*:*:*:*:*:*:* Versions — — ·Python Software Foundation
Remediation
- Fix · CNA black Fixed in 24.3.0
- Fix · GHSA-fj7x-q9j7-g6q6 black (PyPI) Fixed in 24.3.0 Advisory →
Red Hat 1 advisory
- RHSA-2024:3781 Released 2024-06-10 · Red Hat rating ModerateRed Hat Ansible Automation Platform 2.4 Product Security and Bug Fix Update
- Red Hat Ansible Automation Platform 2.4 for RHEL 8 automation-controller-venv-tower-4.5.7-1.el8ap, automation-hub-4.9.2-1.el8ap, python39-aiohttp-3.9.5-1.el8ap +25
- Red Hat Ansible Automation Platform 2.4 for RHEL 9 automation-controller-venv-tower-4.5.7-1.el9ap, automation-hub-4.9.2-1.el9ap, python-aiohttp-3.9.5-1.el9ap +25
Vendor assessments
Red Hat
Red Hat rating: Moderate. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Red Hat Ansible Automation Platform 2.4 for RHEL 8 | Fixed | RHSA-2024:3781 |
| Red Hat Ansible Automation Platform 2.4 for RHEL 9 | Fixed | RHSA-2024:3781 |
Not affected: 2 products
- Red Hat Ansible Automation Platform 2.4 for RHEL 8
- Red Hat Ansible Automation Platform 2.4 for RHEL 9
Timeline
- 2026-10-02 Threatist record created from CVE-2024-21503
- 2026-10-03 Alias added: GHSA-fj7x-q9j7-g6q6
References
Sources
- CVE-2024-21503 · CVE Program
- CVE-2024-21503 · NVD
- FIRST EPSS
- GHSA-fj7x-q9j7-g6q6 · GitHub Advisory Database · CC BY 4.0
- CVE-2024-21503 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences