Skip to content

Improper Restriction of XML External Entity Reference

Description

The application uses the `xml.dom.pulldom` package for processing XML, which suffers from various XML parsing vulnerabilities, including Billion laughs / exponential entity expansion and Quadratic blowup entity expansion, allowing an adversary to cause a Denial of Service (DoS) against the application parsing arbitrary XML.

Examples

Insecure Code

python
xml.dom.pulldom.parseString(...)

Secure Code

python
from defusedxml.ElementTree import parse
et = parse('inventory.xml')
root = et.getroot()

Remediation

Use the `defusedxml` library when processing untrusted XML. Replace `xml.dom.pulldom.parseString` or `xml.dom.pulldom.parse` with `defusedxml.ElementTree.parse`.

Rule Details

FieldValue
IDCODE-0177
CategoryInjection
SeverityMEDIUM
CWECWE-611
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsxml, xxe, injection
OWASPA4:2017-XML External Entities (XXE), A03:2021-Injection