### 简要描述:
phpems 最新版本20141103
http://phpems.net/forum/thread-441-1-1.html
上传过滤不严导致任意文件上传。
### 详细说明:
phpems\app\document\api.php
```
public function swfupload()
{
$path = 'files/attach/images/content/'.date('Ymd').'/';
$fileurl = $this->files->uploadFile($this->ev->getFile('Filedata'),$path);
if($this->ev->get('imgwidth') || $this->ev->get('imgheight'))
{
if($this->files->thumb($fileurl,$fileurl.'.png',$this->ev->get('imgwidth'),$this->ev->get('imgheight')))
$thumb = $fileurl.'.png';
else
$thumb = $fileurl;
}
else
$thumb = $fileurl;
exit(json_encode(array('thumb' => $thumb)));
}
```
phpems\lib\ev.cls.php
```
public function getFile($par)
{
if(isset($this->file[$par]))return $this->file[$par];
else return false;
}
```
phpems\lib\files.cls.php
```
public function uploadFile($file,$updir,$sExtension = NULL,$name = NULL)
{
if(!$sExtension)$sExtension = $this->getFileExtName($file['name']);
if(!$name)$name = time().rand(1000,9999);
if(!file_exists($updir))$this->mdir($updir);
$url = $updir.$name.'.'.$sExtension;
if(file_exists($url))unlink($url);
move_uploaded_file( $file['tmp_name'], $url ) ;
if (file_exists($url))
{
$oldumask = umask(0) ;
chmod( $url, 0777 ) ;
umask( $oldumask ) ;
}
return $url;
}
```
后缀名未做任何检测和限制。
直接上传php文件getshell。
### 漏洞证明:
1.注册账号,上传头像抓包。
[<img src="https://images.seebug.org/upload/201412/211645335a02655ae23d9d57c7acd2374b5dc1b3.png" alt="1.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201412/211645335a02655ae23d9d57c7acd2374b5dc1b3.png)
2.官方demo测试成功。
[<img src="https://images.seebug.org/upload/201412/211646580b56677603c4376403a7805abb011070.png" alt="2.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201412/211646580b56677603c4376403a7805abb011070.png)
暂无评论