CVE-2019-1010017: Python libnmap XML Injection Vulnerability

HIGH
Advisory Identifier: GHSA-9ccv-p7fg-m73x
CVSS 7.5
CWE-91
Published
Advisory Summary

CVE-2019-1010017 is a HIGH (CVSS 7.5) xml injection vulnerability (CWE-91: XML Injection (aka Blind XPath Injection)) affecting Python libnmap libraries in the PyPI ecosystem. The issue involves xml injection in python-libnmap. Remediation is available by upgrading affected packages to version 0.7.2.

CVE-2019-1010017 at a Glance

CVE Identifier CVE-2019-1010017
GHSA Identifier GHSA-9ccv-p7fg-m73x
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-91: XML Injection (aka Blind XPath Injection)
Affected Product Python libnmap
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2019-1010017

To remediate this vulnerability, upgrade all affected Python libnmap dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

python-libnmap fixed: 0.7.2
pip install python-libnmap>=0.7.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show python-libnmap

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2019-1010017, inspect your installed packages using pip:

pip show python-libnmap

Analyze the terminal output to locate any version of Python libnmap in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.7.2), your application is affected.

Note: The pip show python-libnmap command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-91: XML Injection (aka Blind XPath Injection), where the product does not properly neutralize special elements that are used in xml, allowing attackers to modify the syntax, content, or commands of the xml before it is processed by an end system. In Python libnmap, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Description python-libnmap is affected by a Billion-Laughs -style XML injection vulnerability. ### PoC ```python ty = NmapParser() payload = """ <!DOCTYPE lolz [ <!ENTITY lol "lol"> <!ELEMENT lolz (#PCDATA)> <!ENTITY lol1 "&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;"> <!ENTITY lol2 "&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;"> <!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;"> ]> <lolz><hello>&lol3;</hello></lolz> """ ty.parse(payload) ```

CVE-2019-1010017 Affected Python libnmap Versions

1 component(s)
Fixed Versions:
0.7.2
Product / Package Ecosystem Affected Versions Fixed Version
python-libnmap
PyPI
< 0.7.2
0.7.2

References

Frequently Asked Questions

What is CVE-2019-1010017?
CVE-2019-1010017 is a security vulnerability in Python libnmap involving XML Injection in python-libnmap under CWE-91: XML Injection (aka Blind XPath Injection).
Which Python libnmap versions are affected?
Affected versions include releases prior to 0.7.2 across affected packages: python-libnmap.
What version fixes CVE-2019-1010017?
Upgrading to 0.7.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is python-libnmap affected?
Yes, python-libnmap is affected in releases prior to 0.7.2. Upgrade your dependency to 0.7.2 or later.
What is the CVSS score of CVE-2019-1010017?
CVE-2019-1010017 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2019-1010017?
CVE-2019-1010017 is classified under CWE-91: XML Injection (aka Blind XPath Injection) (The product does not properly neutralize special elements that are used in XML, allowing attackers to modify the syntax, content, or commands of the XML before it is processed by an end system.).
How can I check PyPI dependencies for CVE-2019-1010017?
Run the dependency tree command: 'pip show python-libnmap'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9ccv-p7fg-m73x",
  "modified" : "2024-10-15T16:43:37Z",
  "published" : "2019-07-18T15:38:41Z",
  "aliases" : [ "CVE-2019-1010017" ],
  "summary" : "XML Injection in python-libnmap",
  "details" : "### Description\n\npython-libnmap is affected by a Billion-Laughs -style XML injection vulnerability.\n\n### PoC\n\n```python\nty = NmapParser()\n\npayload = \"\"\"\n<!DOCTYPE lolz [\n <!ENTITY lol \"lol\">\n <!ELEMENT lolz (#PCDATA)>\n <!ENTITY lol1 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\">\n <!ENTITY lol2 \"&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;\">\n <!ENTITY lol3 \"&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;\">\n]>\n<lolz><hello>&lol3;</hello></lolz>\n\"\"\"\n\nty.parse(payload)\n```",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "python-libnmap"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.7.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-1010017"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/savon-noir/python-libnmap/issues/87"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/savon-noir/python-libnmap/commit/71b707758851e4b622f87d9a73266e06f60aeab4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/python-libnmap/PYSEC-2019-218.yaml"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/savon-noir/python-libnmap"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-91" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2019-07-18T15:38:22Z",
    "nvd_published_at" : "2019-07-15T03:15:00Z"
  }
}