vulnhub靶机-XXE
1.下载靶机,启动靶机,扫描地址
下载地址:vulnhub–XXE
nmap -sS 192.168.2.0/24 //这里我是虚拟机192.168.2.0网段
扫描出来发现主机IP
nmap -sS -sV 192.168.2.143//再对主机进行详细服务的扫描
扫描出来只发现了web服务
2.打开主页发现是apache默认页面,探测一下有无其他目录
robots.txt发现有东西
两个地址 http://ip/xxe/index.php http://ip/xxe/admin.php
3.抓包登录发现是xml数据,尝试xxe注入
读取数据成功
4.admin.php中发现敏感数据。password md5解密得到密码为admin@123
5.登录后台,点击flag浏览器直接访问失败,尝试XXE读取
base64解码:
<?php
$flag = "<!-- the flag in (JQZFMMCZPE4HKWTNPBUFU6JVO5QUQQJ5) -->";//32个字符,猜测是base32编码
echo $flag;
?>
6.先base32解码再base64解码得到结果/etc/.flag.php
7.读取flag
$_[]++;$_[]=$_._;$_____=$_[(++$__[])][(++$__[])+(++$__[])+(++$__[])];$_=$_[$_[+_]];$___=$__=$_[++$__[]];$____=$_=$_[+_];$_++;$_++;$_++;$_=$____.++$___.$___.++$_.$__.++$___;$__=$_;$_=$_____;$_++;$_++;$_++;$_++;$_++;$_++;$_++;$_++;$_++;$_++;$___=+_;$___.=$__;$___=++$_^$___[+_];$À=+_;$Á=$Â=$Ã=$Ä=$Æ=$È=$É=$Ê=$Ë=++$Á[];$Â++;$Ã++;$Ã++;$Ä++;$Ä++;$Ä++;$Æ++;$Æ++;$Æ++;$Æ++;$È++;$È++;$È++;$È++;$È++;$É++;$É++;$É++;$É++;$É++;$É++;$Ê++;$Ê++;$Ê++;$Ê++;$Ê++;$Ê++;$Ê++;$Ë++;$Ë++;$Ë++;$Ë++;$Ë++;$Ë++;$Ë++;$__('$_="'.$___.$Á.$Â.$Ã.$___.$Á.$À.$Á.$___.$Á.$À.$È.$___.$Á.$À.$Ã.$___.$Á.$Â.$Ã.$___.$Á.$Â.$À.$___.$Á.$É.$Ã.$___.$Á.$É.$À.$___.$Á.$É.$À.$___.$Á.$Ä.$Æ.$___.$Á.$Ã.$É.$___.$Á.$Æ.$Á.$___.$Á.$È.$Ã.$___.$Á.$Ã.$É.$___.$Á.$È.$Ã.$___.$Á.$Æ.$É.$___.$Á.$Ã.$É.$___.$Á.$Ä.$Æ.$___.$Á.$Ä.$Á.$___.$Á.$È.$Ã.$___.$Á.$É.$Á.$___.$Á.$É.$Æ.'"');$__($_);
8.放到php运行(版本为5,7运行不了)
运行代码得到
9.flag
SAFCSP{xxe_is_so_easy}
总结
基本上考察XXE注入基础知识,如何结合伪协议读取数据