EasyTalk处理用户上传头像的代码有问题,若判断用户上传的头像不合法,则根据参数$_POST['imgpath']的路径删除用户上传的非法头像文件。 漏洞 出在EasyTalk对$_POST['imgpath']处理不当上,没有对用户提交的参数进行判断就直接删除imgpath指向的文件。 在SettingAction.class.php 101行的函数doface2中:
public function doface2() { $ysw=$_POST[ 'ysw']; if ($ysw>460) { $zoom=intval($ysw)/460; } else { $zoom=1; } $x=$_POST[ 'x']*$zoom; $y=$_POST[ 'y']*$zoom; $w=$_POST[ 'w']*$zoom; $h=$_POST[ 'h']*$zoom; $imgpath=ET_ROOT.$_POST[ 'imgpath'];//与ET_ROOT连结成为imgpath $ext=strtolower( getExtensionName($imgpath));//提取后缀
import( "@.ORG.IoHandler"); $IoHandler = new IoHandler(); if($ext!='jpg' && $ext!='jpeg' && $ext!= 'gif' && $ext!='png' ) { //若后缀是非法后缀,就删除刚上传的文件 $IoHandler->DeleteFile($imgpath); Cookie:: set('setok','face2'); header( 'location:'.SITE_URL.'/Setting/face' ); exit; } ........ }
删除index.php
修复方案: 判断用户的输入,过滤 作者 头子
查看更多关于EasyTalk微博X2.0.2 前台任意文件删除漏洞及修复的详细内容...