CVE-2022-37189
DDMAL MEI2Volpiano 0.8.2 vulnerable to XXE, DoS via unsafe XML parsing
- CVSS 7.5
- CWE-611 Improper Restriction of XML External Entity Reference
- Input Validation and Sanitization
- Remote
DDMAL MEI2Volpiano 0.8.2 is vulnerable to XML External Entity (XXE), leading to a Denial of Service. This occurs due to the usage of the unsafe 'xml.etree' library to parse untrusted XML input.
- CVSS base score
- 7.5
- Published
- 2022-09-07
- 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
- xml.etree
- Fixed by upgrading
- Yes
Solution
Update DDMAL MEI2Volpiano to a version that fixes the XXE vulnerability.
Vulnerable code sample
import xml.etree.ElementTree as ET
def vulnerable_parse_xml(xml_input):
# Using xml.etree.ElementTree which is vulnerable to XXE
return ET.fromstring(xml_input)
# Example usage
xml_data = '''<?xml version="1.0"?>
<!DOCTYPE root [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root>
<element>&xxe;</element>
</root>'''
try:
parsed_xml = vulnerable_parse_xml(xml_data)
print(ET.tostring(parsed_xml).decode())
except Exception as e:
print(f"Error parsing XML: {e}")Patched code sample
import xml.etree.ElementTree as ET
def safe_parse_xml(xml_input):
# Use a safer XML parser that disables external entity processing
from lxml import etree
parser = etree.XMLParser(resolve_entities=False)
return etree.fromstring(xml_input, parser)
# Example usage
xml_data = '''<root>
<element>Test</element>
</root>'''
try:
parsed_xml = safe_parse_xml(xml_data)
print(ET.tostring(parsed_xml).decode())
except Exception as e:
print(f"Error parsing XML: {e}")Cite this entry
@misc{vaitp:cve202237189,
title = {{DDMAL MEI2Volpiano 0.8.2 vulnerable to XXE, DoS via unsafe XML parsing}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2022},
note = {VAITP Python Vulnerability Dataset, entry CVE-2022-37189},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2022-37189/}}
}
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 ::
