oss-sec mailing list archives
Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled
From: Tomas Hoger <thoger () redhat com>
Date: Mon, 9 Jun 2014 12:28:58 +0200
On Tue, 3 Jun 2014 08:27:47 -0700 Tim wrote:
The description in Java API docs is rather brief, xerces docs have more details: http://xerces.apache.org/xerces-j/features.html#create-entity-ref-nodes http://xerces.apache.org/xerces2-j/features.html#dom.create-entity-ref-nodes AFAICS, the feature does not aim to control if entity references are expanded, but only how exactly they appear in the resulting DOM tree.Ok, that makes sense. Of course it is pointless for security if it doesn't affect parameter entities.
Sorry, how is this really relevant? setExpandEntityReferences(false) does not prevent expansion of general entities, so I'm not sure why expansion of parameter entities is the problem.
I did end up releasing my paper recently, which I believe has up-to-date recommendations for Xerces: http://vsecurity.com/download/papers/XMLDTDEntityAttacks.pdf
It continues to mention setExpandEntityReferences, hinting that should be expected to provide security protections (text seems to imply external entities are not expanded in documents, but they are still defined and remote URLs fetched). As previously mentioned, the setting only changes DOM tree layout, and does not disable entity expansion. E.g. parsing the following two inputs (one using internal other external general entity): $ cat test1.xml <?xml version="1.0"?> <!DOCTYPE bleh [ <!ENTITY bar "BAR"> ]> <root>foo &bar; baz</root> $ cat test2.xml <?xml version="1.0"?> <!DOCTYPE bleh [ <!ENTITY bar SYSTEM "test2-bar.txt"> ]> <root>foo &bar; baz</root> $ cat test2-bar.txt BAR Setting setExpandEntityReferences to false changes the tree from: - (Element) <root> - (Text) foo BAR baz to: - (Element) <root> - (Text) foo - (Entity Reference) &bar; - (Text) BAR baz &bar; is expanded to BAR either way. -- Tomas Hoger / Red Hat Security Response Team
Current thread:
- CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Stefan Cornelius (May 06)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Nicolas Grégoire (May 06)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Tomas Hoger (May 06)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Nicolas Grégoire (May 06)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Timoth D. Morgan (May 08)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Tomas Hoger (May 12)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled David Jorm (Jun 02)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Tim (Jun 03)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled David Jorm (Jun 06)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Tomas Hoger (May 06)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Tim (Jun 03)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Tomas Hoger (Jun 09)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Tim (Jun 09)
- Re: CVE-2014-0191 libxml2: external parameter entity loaded when entity substitution is disabled Nicolas Grégoire (May 06)