abcEditor上傳繞過

來源:互聯網
上載者:User

標籤:style   class   blog   code   http   ext   

<?php$fileup   = 0; //上傳功能開關 0開啟 1關閉$filesize = 200; //檔案大小單位KB 1M=1024KB$filepath = ‘./pic/‘; //檔案儲存目錄 後面要加斜杠/header(‘Content-Type: text/html; charset=UTF-8‘);//頁面編碼if(isset($_GET[‘up‘])){    if($fileup) exit (‘上傳功能已關閉!‘);    $fileend = end(explode(‘.‘,basename($_FILES[‘file‘][‘name‘])));//取得尾碼名    //判斷檔案類型和大小    if(        (        ($_FILES["file"]["type"] == "image/gif")        ||        ($_FILES["file"]["type"] == "image/jpeg")        ||        ($_FILES["file"]["type"] == "image/pjpeg")        ||        ($_FILES["file"]["type"] == "image/x-png")        ||        ($_FILES["file"]["type"] == "image/bmp")        )        &&        $_FILES[‘file‘][‘size‘] < 1024*$filesize    ){        if(!file_exists($filepath)) mkdir ($filepath);//判斷檔案儲存目錄是否存在 沒有則建立        date_default_timezone_set(‘PRC‘);//中國時間        $fileurl = $filepath.date(‘YmdHis.‘).$fileend;//檔案路徑 使用年月日時分秒作為檔案名稱        move_uploaded_file($_FILES[‘file‘][‘tmp_name‘],$fileurl);//移動檔案到指定路徑    }else{        exit(‘<script>alert("檔案大小或類型錯誤!");location="?";</script>‘);    }}?>

檔案只是驗證了$_FILES["file"]["type"]。沒有其他地方進行驗證。

可以修改POST資訊中的$_FILES["file"]["type"]檔案類型為圖片的類型就可繞過。

 提交POST後,關閉代理,就能發現成功上傳了PHP了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.