CTFHub -檔案上傳(雙寫字尾)
阿新 • • 發佈:2021-01-27
CTFHub -檔案上傳(雙寫字尾)
檢視原始碼
<!--
$name = basename($_FILES['file']['name']);
$blacklist = array("php", "php5", "php4", "php3", "phtml", "pht", "jsp", "jspa", "jspx", "jsw", "jsv" , "jspf", "jtml", "asp", "aspx", "asa", "asax", "ascx", "ashx", "asmx", "cer", "swf", "htaccess", "ini");
$name = str_ireplace($blacklist, "", $name);
-->
str_ireplace() 函式替換字串中的一些字元(不區分大小寫)
這道題會對上傳檔案的字尾進行檢測,如果是array陣列中的字尾,則會替換為空。
這道題考察的是檔案上傳的雙寫字尾
php 雙寫字尾後 pphphp
上傳一句話木馬 hack.pphphp—通過函式str_ireplace的字元替換—成功上傳檔案hack.php
在通過蟻劍獲得flag。