Upload_Labs_pass_4

Posted delongzhang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Upload_Labs_pass_4相关的知识,希望对你有一定的参考价值。

做法和pass3相同;

技术图片

 

 存在后缀名黑名单;

采用类似的拓展名来混淆;

技术图片

 

 

http://127.0.0.1/upload-labs-master/upload/shell.php23

技术图片

 

 成功;

本pass禁止上传.php|.php5|.php4|.php3|.php2|php1|.html|.htm|.phtml|.pHp|.pHp5|.pHp4|.pHp3|.pHp2|pHp1|
.Html|.Htm|.pHtml|.jsp|.jspa|.jspx|.jsw|.jsv|.jspf|.jtml|.jSp|.jSpx|.jSpa|.jSw|.jSv|.jSpf|.jHtml|
.asp|.aspx|.asa|.asax|.ascx|.ashx|.asmx|.cer|.aSp|.aSpx|.aSa|.aSax|.aScx|.aShx|.aSmx|.cEr|.sWf|.swf后缀文件!
$is_upload = false;
$msg = null;
if (isset($_POST[‘submit‘])) {
    if (file_exists(UPLOAD_PATH)) {
        $deny_ext = array(".php",".php5",".php4",".php3",".php2",".php1",".html",".htm",".phtml",".pht",".pHp",".pHp5",".pHp4",".pHp3",".pHp2",".pHp1",".Html",".Htm",".pHtml",".jsp",".jspa",".jspx",".jsw",".jsv",".jspf",".jtml",".jSp",".jSpx",".jSpa",".jSw",".jSv",".jSpf",".jHtml",".asp",".aspx",".asa",".asax",".ascx",".ashx",".asmx",".cer",".aSp",".aSpx",".aSa",".aSax",".aScx",".aShx",".aSmx",".cEr",".sWf",".swf",".ini");
        $file_name = trim($_FILES[‘upload_file‘][‘name‘]);
        $file_name = deldot($file_name);//删除文件名末尾的点
        $file_ext = strrchr($file_name, ‘.‘);
        $file_ext = strtolower($file_ext); //转换为小写
        $file_ext = str_ireplace(‘::$DATA‘, ‘‘, $file_ext);//去除字符串::$DATA
        $file_ext = trim($file_ext); //收尾去空

        if (!in_array($file_ext, $deny_ext)) {
            $temp_file = $_FILES[‘upload_file‘][‘tmp_name‘];
            $img_path = UPLOAD_PATH.‘/‘.$file_name;
            if (move_uploaded_file($temp_file, $img_path)) {
                $is_upload = true;
            } else {
                $msg = ‘上传出错!‘;
            }
        } else {
            $msg = ‘此文件不允许上传!‘;
        }
    } else {
        $msg = UPLOAD_PATH . ‘文件夹不存在,请手工创建!‘;
    }
}

以上是关于Upload_Labs_pass_4的主要内容,如果未能解决你的问题,请参考以下文章

imgwarp.cpp:3143: error: (-215:Assertion failed) _src.total() > 0 in function ‘warpPerspective‘(代码片段

这些 C++ 代码片段有啥作用?

[AndroidStudio]_[初级]_[配置自动完成的代码片段]

VSCode 配置 用户自定义代码片段 自定义自动代码补充

[AndroidStudio]_[初级]_[配置自动完成的代码片段]

[AndroidStudio]_[初级]_[配置自动完成的代码片段]