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

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

缺陷编号:wooyun-2014-086614

漏洞标题:Iwebsns最新版SQL注入第二枚

相关厂商:Jooyea

漏洞作者: 路人甲

提交时间:2014-12-10 17:40

修复时间:2015-03-10 17:42

公开时间:2015-03-10 17:42

漏洞类型:SQL注射漏洞

危害等级:中

自评Rank:10

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

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

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

简要描述:

Iwebsns最新版SQL注入第二枚

详细说明:

在wooyun上看到雨牛提了5个iwebsns的漏洞了( WooYun: Iwebsns sql 第五枚。 ),我来捡捡漏儿吧,已对比,不重复,下载Iwebsns最新的1.1.0来看看。
为了使审核的大大们容易确认是否有重复,我先把存在漏洞的文件和注入参数分别写在这里:/action/album/photo_upl.action.php album_name
下面看看漏洞是怎么产生的
/action/album/album_upl.action.php

无关代码
$album_id=short_check(get_argp('album_name'));
$album_name=short_check(get_argp('album_ufor'));
$user_id=get_sess_userid();
$user_name=get_sess_username();
$uico_url=get_sess_userico();//用户头像
set_session('S_fs',array());
$photos_array=array();//上传图片地址数组
//变量定义区
$t_photo = $tablePreStr."photo";
$t_album = $tablePreStr."album";
$dbo = new dbex;
//读写分离定义函数
dbtarget('w',$dbServs);
//第二步,执行文件上传
$limcount=5;//限制每次上传附件数量
$up_load_num=count($_FILES['attach']['name']);
if($up_load_num > $limcount){
global $a_langpackage;
action_return(0,$a_langpackage->a_upload_maximum.$limcount.$a_langpackage->a_attachments,"-1");
}
//检测上传相片是否都为空
$is_true=0;
for($i=0;$i<count($_FILES['attach']['name']);$i++){
if(!empty($_FILES['attach']['name'][$i]))
$is_true++;
}
if($is_true==0){
action_return(0,$a_langpackage->a_no_pht,"-1");
}
$base_root="uploadfiles/album/";//图片存放目录
$up = new upload();
$up->set_dir($base_root,'{y}/{m}/{d}');//目录设置
$up->set_thumb(180,180); //缩略图设置
$fs = $up->execute();
$i=0;
foreach($fs as $index=>$realtxt){
if($realtxt['flag']==1){
$fileSrcStr=str_replace(dirname(__FILE__),"",$realtxt['dir']).$realtxt['name'];
$thumb_src=str_replace(dirname(__FILE__),"",$realtxt['dir']).$realtxt['thumb'];
$sql = "insert into $t_photo(`user_id`,`add_time`,`photo_src`,`photo_thumb_src`,`album_id`,`user_name`,`privacy`)
values($user_id,'".constant('NOWTIME')."','$fileSrcStr','$thumb_src',$album_id,'$user_name','');";
if($dbo -> exeUpdate($sql)){
$photo_id=mysql_insert_id();
$fs[$index]['photo_id']=$photo_id;
$sql = "update $t_album set photo_num=photo_num+1,update_time='".constant('NOWTIME')."' where album_id=$album_id";
if($dbo -> exeUpdate($sql)){
increase_integral($dbo,$int_photo,$user_id);
}
$photos_array[$i]['id']=$photo_id;
$photos_array[$i]['file']=$thumb_src;
}
$i++;
}else if($realtxt['flag']==-1){
action_return(0,$a_langpackage->a_no_jpg,"-1");
}else if($realtxt['flag']==-2){
action_return(0,$a_langpackage->a_big,"-1");
}
}
无关代码


album_name经过short_check赋值$album_id,来看看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进行注入测试。
猜测管理员用户名的第一个字母时,若错误,延迟2s左右,如下图

猜测错误副本.jpg


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

猜测成功副本.jpg


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

漏洞证明:

见 详细说明

修复方案:

intval

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


漏洞回应

厂商回应:

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