CVE-2022-42969
Python py library <= 1.11.0 vulnerable to remote ReDoS via mishandled InfoSvnCommand argument in Subversion info data
- CVSS 7.5
- CWE-1333 Inefficient Regular Expression Complexity
- Input Validation and Sanitization
- Remote
The py library through 1.11.0 for Python allows remote attackers to conduct a ReDoS (Regular expression Denial of Service) attack via a Subversion repository with crafted info data, because the InfoSvnCommand argument is mishandled.
- CVSS base score
- 7.5
- Published
- 2022-10-16
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- py
- Fixed by upgrading
- Yes
Solution
Update py library to version 1.11.1 or higher.
Vulnerable code sample
import re
def vulnerable_info_svn_command(info_data):
# Vulnerable regex pattern that can cause ReDoS
pattern = re.compile(r'(a+)+b') # This pattern can lead to catastrophic backtracking
if pattern.match(info_data):
# Process the info_data
# ... (rest of the command logic)Patched code sample
import re
def safe_info_svn_command(info_data):
# Use a more restrictive regex pattern to avoid catastrophic backtracking
pattern = re.compile(r'^[a-zA-Z0-9_]+$') # Only allow alphanumeric and underscore
if not pattern.match(info_data):
raise ValueError("Invalid info data provided.")
# Process the info_data safely
# ... (rest of the command logic)Cite this entry
@misc{vaitp:cve202242969,
title = {{Python py library <= 1.11.0 vulnerable to remote ReDoS via mishandled InfoSvnCommand argument in Subversion info data}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2022},
note = {VAITP Python Vulnerability Dataset, entry CVE-2022-42969},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2022-42969/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
