在会员头像上传处
public function avatar() { if(checksubmit('dosubmit')) { if(empty($_GET['avatar'])) { showmessage('请上传头像','',0); } $avatar = $_GET['avatar']; $x = (int) $_GET['x']; $y = (int) $_GET['y']; $w = (int) $_GET['w']; $h = (int) $_GET['h']; if(is_file($avatar) && file_exists($avatar)) { $ext = strtolower(pathinfo($avatar, PATHINFO_EXTENSION)); $name = basename($avatar, '.'.$ext); $dir = dirname($avatar); if(in_array($ext, array('gif','jpg','jpeg','bmp','png'))) { $name = $name.'_crop_200_200.'.$ext; $file = $dir.'/'.$name; $image = new image($avatar); $image->crop($w, $h, $x, $y, 200, 200); $image->save($file); if(file_exists($file)) { $avatar = getavatar($this->member['id'], false); dir::create(dirname($avatar)); @rename($file, $avatar); showmessage('头像更换成功','',1); } else { showmessage('头像数据裁剪失败','',0); } } else { showmessage('请勿上传非法图片','',0); } } else { showmessage('头像数据异常','',0); } } else { $SEO = seo('修改头像 - 会员中心'); $attachment_init = attachment_init(array('module' => 'member', 'mid' => $this->member['id'])); include template('account_avatar'); } } }
可以看到上传的头像跟
$avatar = $_GET['avatar'];有关切只验证上传文件的后缀
那么xx.php%00.jpg gif都可以
这里只能上传一个图片马,单单的php代码会被渲染
修改两处,可以看到成功截断了.
海盗云商:http://www.haidao.la/
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论