// For flags

CVE-2024-21503

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

Severity Score

5.3
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

0
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

Attend
*SSVC
Descriptions

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.

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.

The python-black package is susceptible to a regular expression denial of service (ReDoS) vulnerability, found in the lines_with_leading_tabs_expanded() function within the strings.py file. This vulnerability could be exploited by running Black on untrusted input or by inserting numerous leading tab characters into docstrings. This flaw allows attackers to craft malicious input to trigger a denial of service.

*Credits: Sajeeb Lohani
CVSS Scores
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low
Attack Vector
Network
Attack Complexity
Low
Authentication
None
Confidentiality
None
Integrity
None
Availability
Complete
* Common Vulnerability Scoring System
SSVC
  • Decision:Attend
Exploitation
Poc
Automatable
Yes
Tech. Impact
Partial
* Organization's Worst-case Scenario
Timeline
  • 2023-12-22 CVE Reserved
  • 2024-03-19 CVE Published
  • 2024-03-19 EPSS Updated
  • 2024-08-01 CVE Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
  • ---------- First Exploit
CWE
  • CWE-75: Failure to Sanitize Special Elements into a Different Plane (Special Element Injection)
  • CWE-1333: Inefficient Regular Expression Complexity
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Python Software Foundation
Search vendor "Python Software Foundation"
Black
Search vendor "Python Software Foundation" for product "Black"
*-
Affected
Redhat
Search vendor "Redhat"
Ansible Automation Platform
Search vendor "Redhat" for product "Ansible Automation Platform"
*-
Affected
Redhat
Search vendor "Redhat"
Ansible Automation Platform Developer
Search vendor "Redhat" for product "Ansible Automation Platform Developer"
*-
Affected
Redhat
Search vendor "Redhat"
Ansible Automation Platform Inside
Search vendor "Redhat" for product "Ansible Automation Platform Inside"
*-
Affected
Opensuse
Search vendor "Opensuse"
Leap
Search vendor "Opensuse" for product "Leap"
*-
Affected
Redhat
Search vendor "Redhat"
Enterprise Linux
Search vendor "Redhat" for product "Enterprise Linux"
*-
Affected