ctfshow web21-28 爆破

慢慢打基础

Published
Reading
2 min
Category
CTF
Tags
爆破ctfshowphp
On this page
  1. web21
  2. web22
  3. web23
  4. web24
  5. web25
  6. web26
  7. web27
  8. web28

web21

随便输入账密,抓个包看看

image-20260117180139202

解码一下,发现我们刚才输入的账密,是以”账号:密码”格式传输的

image-20260117180100526

在BP导入题目给的字典,然后记得处理payload,把url编码选项关掉

image-20260117180243241

最后发送YWRtaW46c2hhcms2Mw== ,得到flag

web22

这道题考的是域名爆破,其实也算是信息收集

image-20260117181806227

使用工具(如Layer),爆破域名,找到某个网址得到flag

题目已经失效

web23

源码:

<?php

error_reporting(0);

include('flag.php');
if(isset($_GET['token'])){
    $token = md5($_GET['token']);
    if(substr($token, 1,1)===substr($token, 14,1) && substr($token, 14,1) ===substr($token, 17,1)){
        if((intval(substr($token, 1,1))+intval(substr($token, 14,1))+substr($token, 17,1))/substr($token, 1,1)===intval(substr($token, 31,1))){
            echo $flag;
        }
    }
}else{
    highlight_file(__FILE__);

}
?>

GET一个参数token,然后转化为md5值,要求md5值某些位数满足一些条件就输出flag

运行脚本:

import hashlib

def solve():
    # 暴力破解:尝试从 0 开始的数字字符串
    for i in range(10000000):
        token_str = str(i)
        md5_res = hashlib.md5(token_str.encode()).hexdigest()
        
        # 提取关键位置字符
        pos1 = md5_res[1]
        pos14 = md5_res[14]
        pos17 = md5_res[17]
        pos31 = md5_res[31]
        
        # 排除非数字的情况,防止 intval 为 0 或除以 0
        if not (pos1.isdigit() and pos1 != '0'):
            continue
            
        # 条件 1: 位置 1, 14, 17 字符相等
        if pos1 == pos14 == pos17:
            # 条件 2: (a+b+c)/a == d => (a+a+a)/a = 3,所以 d 必须是 '3'
            if pos31 == '3':
                print(f"找到匹配的 Token: {token_str}")
                print(f"对应的 MD5 值: {md5_res}")
                print(f"Payload: ?token={token_str}")
                return

if __name__ == "__main__":
    solve()

得出来的结果为422,还有其他的,如3j

payload:

?token=422

web24

源码:

<?php

error_reporting(0);
include("flag.php");
if(isset($_GET['r'])){
    $r = $_GET['r'];
    mt_srand(372619038);
    if(intval($r)===intval(mt_rand())){
        echo $flag;
    }
}else{
    highlight_file(__FILE__);
    echo system('cat /proc/version');
}

?>

GET一个参数r,生成一个随机数与其比较。由于之前使用了 mt_srand 设置了固定的种子,生成的随机数是伪随机的。

运行脚本:

<?php
mt_srand(372619038);
$target_value = mt_rand();
echo "?r=" . $target_value;
?>

这里得到?r=999695185

传参,没回显,不对

刚刚使用的是PHP5.5.9,下面切换成7.3.4再试试

image-20260117230743505

得到?r=1155388967

传参,得到flag

web25

 <?php

error_reporting(0);
include("flag.php");
if(isset($_GET['r'])){
    $r = $_GET['r'];
    mt_srand(hexdec(substr(md5($flag), 0,8)));
    $rand = intval($r)-intval(mt_rand());
    if((!$rand)){
        if($_COOKIE['token']==(mt_rand()+mt_rand())){
            echo $flag;
        }
    }else{
        echo $rand;
    }
}else{
    highlight_file(__FILE__);
    echo system('cat /proc/version');
}

这一题的种子也是固定的,然后当我传参进去,如果值和种子不一样,会输出相减后的差,这样当我们输入0进去后,就能获取第一个生成随机数的相反数,再使用工具爆破出种子的值。

当Cookie中token等于第二和第三个随机数相加的值,就会输出flag。

?r=0

得到 -1862750894

使用php_mt_seed

image-20260118001424694

值我们选择 3953760046(这里要一个一个试PHP版本为7.1.0+的值)

<?php
mt_srand(3953760046);
mt_rand();
echo mt_rand() + mt_rand();
?>

结果为 3163022853

?r=1862750894 设置Cookie:token=3163022853

得到flagimage-20260118002139983

web26

把抓到的包重发就得到flag了

image-20260118003156675

web27

这教务系统

image-20260118003406452

下载录取名单

image-20260118003628943

打开录取查询

image-20260118003858065

要干什么很明显了,打开BP爆破身份证号

image-20260118005942642

身份证号为:621022199002015237

查询后得知学号和密码,登录后获得flag

image-20260118004752510

web28

爆破目录

image-20260118011230108

得到flag

image-20260118011414553

Author
YU030X
Published

Images are sourced from the internet. Please contact me for removal if necessary.

Comments

Type to search posts and pages.

K to open · esc to closeSearch by Pagefind