<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.owasp.org/index.php?action=history&amp;feed=atom&amp;title=Talk%3AXML_External_Entity_%28XXE%29_Prevention_Cheat_Sheet</id>
		<title>Talk:XML External Entity (XXE) Prevention Cheat Sheet - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.owasp.org/index.php?action=history&amp;feed=atom&amp;title=Talk%3AXML_External_Entity_%28XXE%29_Prevention_Cheat_Sheet"/>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:XML_External_Entity_(XXE)_Prevention_Cheat_Sheet&amp;action=history"/>
		<updated>2026-04-13T04:06:18Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.2</generator>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:XML_External_Entity_(XXE)_Prevention_Cheat_Sheet&amp;diff=235663&amp;oldid=prev</id>
		<title>Wichers at 02:21, 21 November 2017</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:XML_External_Entity_(XXE)_Prevention_Cheat_Sheet&amp;diff=235663&amp;oldid=prev"/>
				<updated>2017-11-21T02:21:08Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 02:21, 21 November 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following code suffers from XXE despite the (prior to Sept.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following code suffers from XXE despite the (prior to Sept. 2017) [[XML_External_Entity_(XXE)_Prevention_Cheat_Sheet#XMLReader|XMLReader recommendations in OWASP]] that these '''setFeatures''' would resolve it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;2017) [[XML_External_Entity_(XXE)_Prevention_Cheat_Sheet#XMLReader|XMLReader recommendations in OWASP]] that these '''setFeatures''' would resolve it.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;However, this is not true for XOM.nu (tested on version 1.2.5), a third party XML plugin. I don't know how popular it is, but it is used by Jenkins. Not implying Jenkins is vulnerable, merely that a lib it uses doesn't have proper OWASP usage recommendation.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;However, this is not true for XOM.nu (tested on version 1.2.5), a third party XML plugin. I don't know how popular it is, but it is used by Jenkins. Not implying Jenkins is vulnerable, merely that a lib it uses doesn't have proper OWASP usage recommendation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wichers</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:XML_External_Entity_(XXE)_Prevention_Cheat_Sheet&amp;diff=235662&amp;oldid=prev</id>
		<title>Wichers at 02:20, 21 November 2017</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:XML_External_Entity_(XXE)_Prevention_Cheat_Sheet&amp;diff=235662&amp;oldid=prev"/>
				<updated>2017-11-21T02:20:28Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 02:20, 21 November 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following code suffers from XXE despite the [[XML_External_Entity_(XXE)_Prevention_Cheat_Sheet#XMLReader|XMLReader recommendations in OWASP]] that these '''setFeatures''' would resolve it.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The following code suffers from XXE despite the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;(prior to Sept.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; 2017) &lt;/ins&gt;[[XML_External_Entity_(XXE)_Prevention_Cheat_Sheet#XMLReader|XMLReader recommendations in OWASP]] that these '''setFeatures''' would resolve it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;However, this is not true for XOM.nu (tested on version 1.2.5), a third party XML plugin. I don't know how popular it is, but it is used by Jenkins. Not implying Jenkins is vulnerable, merely that a lib it uses doesn't have proper OWASP usage recommendation.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;However, this is not true for XOM.nu (tested on version 1.2.5), a third party XML plugin. I don't know how popular it is, but it is used by Jenkins. Not implying Jenkins is vulnerable, merely that a lib it uses doesn't have proper OWASP usage recommendation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wichers</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:XML_External_Entity_(XXE)_Prevention_Cheat_Sheet&amp;diff=235661&amp;oldid=prev</id>
		<title>Wichers at 02:19, 21 November 2017</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:XML_External_Entity_(XXE)_Prevention_Cheat_Sheet&amp;diff=235661&amp;oldid=prev"/>
				<updated>2017-11-21T02:19:36Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 02:19, 21 November 2017&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l53&quot; &gt;Line 53:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 53:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This leads us (Checkmarx Research Group) to believe the recommendations in OWASP for XMLReader are partial; We actually advise removing direct explicit recommendations entirely and demand devs to adhere to specific platform best practices and documentation, instead.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This leads us (Checkmarx Research Group) to believe the recommendations in OWASP for XMLReader are partial; We actually advise removing direct explicit recommendations entirely and demand devs to adhere to specific platform best practices and documentation, instead.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;NOTE: This missing setting has been fixed in the cheat sheet. I (Dave Wichers) fixed it a few weeks ago before noticing this talk note. Funny how we both independently found/fixed the same thing around the same time.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Wichers</name></author>	</entry>

	<entry>
		<id>https://wiki.owasp.org/index.php?title=Talk:XML_External_Entity_(XXE)_Prevention_Cheat_Sheet&amp;diff=232049&amp;oldid=prev</id>
		<title>ErezYalon: Problematic mitigation advice</title>
		<link rel="alternate" type="text/html" href="https://wiki.owasp.org/index.php?title=Talk:XML_External_Entity_(XXE)_Prevention_Cheat_Sheet&amp;diff=232049&amp;oldid=prev"/>
				<updated>2017-08-07T17:05:53Z</updated>
		
		<summary type="html">&lt;p&gt;Problematic mitigation advice&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The following code suffers from XXE despite the [[XML_External_Entity_(XXE)_Prevention_Cheat_Sheet#XMLReader|XMLReader recommendations in OWASP]] that these '''setFeatures''' would resolve it.&lt;br /&gt;
&lt;br /&gt;
However, this is not true for XOM.nu (tested on version 1.2.5), a third party XML plugin. I don't know how popular it is, but it is used by Jenkins. Not implying Jenkins is vulnerable, merely that a lib it uses doesn't have proper OWASP usage recommendation.&lt;br /&gt;
&lt;br /&gt;
Anyway, assuming the content of c:\test.txt is &amp;quot;'''This is TEXT inside the file C:\test.txt'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    import java.io.InputStream;&lt;br /&gt;
    import org.apache.commons.io.IOUtils;&lt;br /&gt;
    import org.dom4j.io.SAXReader;&lt;br /&gt;
    import org.xml.sax.XMLReader;&lt;br /&gt;
    import org.xml.sax.helpers.XMLReaderFactory;&lt;br /&gt;
    &lt;br /&gt;
    import nu.xom.*;&lt;br /&gt;
    public class helloworld {&lt;br /&gt;
           public static void main(String[] args) throws Exception {&lt;br /&gt;
                  &lt;br /&gt;
                  //To get this to run, the file c:\test.txt must exist and have content. alternatively, change the path in &amp;lt;!ENTITY xxe SYSTEM &amp;quot;file:///[file]&amp;quot; &lt;br /&gt;
                  String newline = System.getProperty(&amp;quot;line.separator&amp;quot;);&lt;br /&gt;
                  String xml = &amp;quot;&amp;lt;?xml version=\&amp;quot;1.0\&amp;quot; encoding=\&amp;quot;UTF-8\&amp;quot; standalone=\&amp;quot;yes\&amp;quot;?&amp;gt;&amp;quot; + newline +&lt;br /&gt;
                               &amp;quot;&amp;lt;!DOCTYPE bar [&amp;quot; + newline +&lt;br /&gt;
                               &amp;quot;&amp;lt;!ENTITY xxe SYSTEM \&amp;quot;file:///c:/test.txt\&amp;quot;&amp;gt;&amp;quot; + newline +&lt;br /&gt;
                               &amp;quot;]&amp;gt;&amp;quot; + newline +&lt;br /&gt;
                               &amp;quot;&amp;lt;book&amp;gt;&amp;quot;+ newline +&lt;br /&gt;
                               &amp;quot;&amp;lt;author&amp;gt;&amp;amp;xxe;&amp;lt;/author&amp;gt;&amp;quot;+ newline +&lt;br /&gt;
                               &amp;quot;&amp;lt;isbn&amp;gt;11112222333&amp;lt;/isbn&amp;gt;&amp;quot;+ newline +&lt;br /&gt;
                               &amp;quot;&amp;lt;title&amp;gt;The Great Big Useless Book of XMLs&amp;lt;/title&amp;gt;&amp;quot;+ newline +&lt;br /&gt;
                               &amp;quot;&amp;lt;/book&amp;gt;&amp;quot;;          // Vulnerable XOM Parser  &lt;br /&gt;
                  XMLReader xerces = XMLReaderFactory.createXMLReader();&lt;br /&gt;
                  //xerces.setFeature(&amp;quot;http://apache.org/xml/features/disallow-doctype-decl&amp;quot;, true);&lt;br /&gt;
                  xerces.setFeature(&amp;quot;http://xml.org/sax/features/external-general-entities&amp;quot;, false);&lt;br /&gt;
                  xerces.setFeature(&amp;quot;http://xml.org/sax/features/external-parameter-entities&amp;quot;, false);&lt;br /&gt;
              &lt;br /&gt;
    xerces.setFeature(&amp;quot;http://apache.org/xml/features/nonvalidating/load-&lt;br /&gt;
    external-dtd&amp;quot;,false);&lt;br /&gt;
                  Builder b = new Builder(xerces);&lt;br /&gt;
                  InputStream is2 = IOUtils.toInputStream(xml, &amp;quot;UTF-8&amp;quot;);&lt;br /&gt;
                  Document d = b.build(is2);&lt;br /&gt;
                  System.out.println(&amp;quot;XOM Reader: &amp;quot; + d.getValue());&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Output:'''&lt;br /&gt;
XOM Reader: &lt;br /&gt;
This is TEXT inside the file C:\test.txt&lt;br /&gt;
11112222333&lt;br /&gt;
The Great Big Useless Book of XMLs&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, by uncommenting&lt;br /&gt;
    //xerces.setFeature(&amp;quot;http://apache.org/xml/features/disallow-doctype-decl&amp;quot;, true);&lt;br /&gt;
a ''''nu.xom.ParsingException'''' is thrown for this XML, preventing exploitation.&lt;br /&gt;
&lt;br /&gt;
This leads us (Checkmarx Research Group) to believe the recommendations in OWASP for XMLReader are partial; We actually advise removing direct explicit recommendations entirely and demand devs to adhere to specific platform best practices and documentation, instead.&lt;/div&gt;</summary>
		<author><name>ErezYalon</name></author>	</entry>

	</feed>