### 简要描述: * tipask可以调整头像保存并删除原始头像 * 在删除原始头像时使用了post提交的参数 * 造成任意文件删除漏洞 ### 详细说明: ``` function onsaveimg() { $x1 = $this-> post['x1' ]; $y1 = $this-> post['y1' ]; $x2 = $this-> post['x2' ]; $y2 = $this-> post['y2' ]; $w = $this-> post['w' ]; $h = $this-> post['h' ]; $ext = $this-> post['ext' ]; $upload_tmp_file = TIPASK_ROOT . "/data/tmp/" . 'bigavatar' . $this->user['uid' ] . $ext; $avatardir = "/data/avatar/"; //图片存放目录 $scale = 100 / $w; resizeThumbnailImage( $smallimg, $upload_tmp_file, $w, $h, $x1, $y1, $scale); copy($upload_tmp_file, TIPASK_ROOT . $dir3 . '/big_' . $uid . $ext); is_file($upload_tmp_file) && unlink($upload_tmp_file); $_ENV[ 'user']->update_avatar($smallimg); $this->message( '头像设置成功!' , 'user/editimg' ); } ``` 可以看到onsaveimg函数直接调用post的ext参数并传入到$upload_tmp_file中,最后进入unlink。造成任意文件删除漏洞。 ### 漏洞证明: 删除根目录下的test.php post ext=/../../../test.php 到?user/saveimg.html 其实可以删除install.lock你们懂的
### 简要描述: * tipask可以调整头像保存并删除原始头像 * 在删除原始头像时使用了post提交的参数 * 造成任意文件删除漏洞 ### 详细说明: ``` function onsaveimg() { $x1 = $this-> post['x1' ]; $y1 = $this-> post['y1' ]; $x2 = $this-> post['x2' ]; $y2 = $this-> post['y2' ]; $w = $this-> post['w' ]; $h = $this-> post['h' ]; $ext = $this-> post['ext' ]; $upload_tmp_file = TIPASK_ROOT . "/data/tmp/" . 'bigavatar' . $this->user['uid' ] . $ext; $avatardir = "/data/avatar/"; //图片存放目录 $scale = 100 / $w; resizeThumbnailImage( $smallimg, $upload_tmp_file, $w, $h, $x1, $y1, $scale); copy($upload_tmp_file, TIPASK_ROOT . $dir3 . '/big_' . $uid . $ext); is_file($upload_tmp_file) && unlink($upload_tmp_file); $_ENV[ 'user']->update_avatar($smallimg); $this->message( '头像设置成功!' , 'user/editimg' ); } ``` 可以看到onsaveimg函数直接调用post的ext参数并传入到$upload_tmp_file中,最后进入unlink。造成任意文件删除漏洞。 ### 漏洞证明: 删除根目录下的test.php post ext=/../../../test.php 到?user/saveimg.html 其实可以删除install.lock你们懂的