VAITP Dataset

← Back to the dataset

CVE-2019-1010017

Libnmap < v0.6.3: XML Injection DoS

  • CVSS 7.5
  • CWE-91 XML Injection (aka Blind XPath Injection)
  • Input Validation and Sanitization
  • Remote

libnmap < v0.6.3 is affected by: XML Injection. The impact is: Denial of service (DoS) by consuming resources. The component is: XML Parsing. The attack vector is: Specially crafted XML payload.

CVSS base score
7.5
Published
2019-07-15
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
libnmap
Fixed by upgrading
Yes

Solution

Update libnmap to version 0.6.3 or higher.

Vulnerable code sample

import xml.etree.ElementTree as ET

def parse_xml(xml_string):
    try:
        root = ET.fromstring(xml_string)
        return root
    except ET.ParseError as e:
        print("XML parsing error:", e)
        return None

xml_payload = "<root><data><![CDATA[<attack>]]></data><data>Some data</data></root>"
parsed_xml = parse_xml(xml_payload)
if parsed_xml is not None:
    print("XML parsed successfully:", ET.tostring(parsed_xml).decode())
else:
    print("Failed to parse XML.")

Patched code sample

from lxml import etree

def parse_xml(xml_string):
    try:
        parser = etree.XMLParser(resolve_entities=False, no_network=True)
        root = etree.fromstring(xml_string, parser=parser)
        return root
    except etree.XMLSyntaxError as e:
        print("XML parsing error:", e)
        return None

xml_payload = "<root><data><![CDATA[<attack>]]></data><data>Some data</data></root>"
parsed_xml = parse_xml(xml_payload)
if parsed_xml is not None:
    print("XML parsed successfully:", etree.tostring(parsed_xml).decode())
else:
    print("Failed to parse XML.")

Published 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.

  • fixed issue #87 (savon-noir/python-libnmap)
    libnmap/parser.py, libnmap/parser.py · NmapParser.__format_attributes, libnmap/parser.py · NmapParser.__format_element

Cite this entry

@misc{vaitp:cve20191010017,
  title        = {{Libnmap < v0.6.3: XML Injection DoS}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2019},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2019-1010017},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-1010017/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.