CVE-2020-10799
SVGlib (through 0.9.3) in Python is vulnerable to XXE attacks via svg2rlg
- CVSS 9.8
- CWE-611 Improper Restriction of XML External Entity Reference
- Input Validation and Sanitization
- Remote
The svglib package through 0.9.3 for Python allows XXE attacks via an svg2rlg call.
- CVSS base score
- 9.8
- Published
- 2020-03-20
- 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
- Information Disclosure
- Affected component
- svglib
- Fixed by upgrading
- Yes
Solution
Update svglib to version 0.9.4 or higher.
Vulnerable code sample
import xml.etree.ElementTree as ET
def unsafe_svg2rlg(svg_data):
# This code does not disable DTDs, making it vulnerable to XXE attacks
root = ET.fromstring(svg_data)
# Process the root element and convert to RLG (this part is hypothetical)
return convert_svg_to_rlg(root)
def convert_svg_to_rlg(root):
# Placeholder function for converting SVG to RLG
passPatched code sample
import xml.etree.ElementTree as ET
def safe_svg2rlg(svg_data):
# Disable DTDs to prevent XXE attacks
parser = ET.XMLParser(resolve_entities=False)
root = ET.fromstring(svg_data, parser=parser)
# Process the root element and convert to RLG (this part is hypothetical)
return convert_svg_to_rlg(root)
def convert_svg_to_rlg(root):
# Placeholder function for converting SVG to RLG
passPublished fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Fixes #229 – External entity loading disabled by default (deeplook/svglib)
svglib/svglib.py · load_svg_file,svglib/svglib.py · svg2rlg
Cite this entry
@misc{vaitp:cve202010799,
title = {{SVGlib (through 0.9.3) in Python is vulnerable to XXE attacks via svg2rlg}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2020},
note = {VAITP Python Vulnerability Dataset, entry CVE-2020-10799},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2020-10799/}}
}
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 ::
