• GK2020-CVE签到题 CVE-2020-7066 PHP7.x get_headers()


    前言

      来源 https://security-tracker.debian.org/tracker/CVE-2020-7066

      翻译 https://bugs.php.net/bug.php?id=79329

    get_headers()

      get_headers():可以通过服务器的响应头来判断远程文件是否存在

    array get_headers ( string $url [, int $format = 0 ] )

      判断网站是否存在例子

    <?php
    var_dump( get_headers('https://www.baidu.com'));
    ?>

       get_headers()函数没有设置参数,所以返回的数组中键值都是默认的。

    get_headers()安全

      get_headers()会截断URL中空字符后的内容,这是在php7.3中发现的 ,但是一直有这个漏洞,测试脚本显示这会让恶意脚本获取意外域名的header 。这些header可能泄露敏感信息或者意外地包含攻击者控制的数据。

      在低于7.2.29的PHP版本7.2.x,低于7.3.16的7.3.x和低于7.4.4的7.4.x中,将get_headers()与用户提供的URL一起使用时,如果URL包含零( 0)字符,则URL将被静默地截断。这可能会导致某些软件对get_headers()的目标做出错误的假设,并可能将某些信息发送到错误的服务器。

    <?php
    // user input
    $_GET['url'] = "http://localhost.example.com";
    
    $host = parse_url($_GET['url'], PHP_URL_HOST);
    if (substr($host, -12) !== '.example.com') {
        die();
    }
    $headers = get_headers($_GET['url']);
    var_dump($headers);

      预期结果

     

    GK2020-CVE签到题

      访问题目,给的提示是CVE-2020-7066

       F12得到提示,flag在localhost,localhost不是单指127.0.0.1,而是符合127.0.0.0/24这一网段的IP地址,比如127.0.0.100也可以叫localhost

     

      再点击链接,发现有传参

       综上,就是参数要是localhost且用截断,这里用%00截断

       最后需要123

    参考链接

      https://blog.csdn.net/qq_45521281/article/details/106425266

  • 相关阅读:
    Python面向对象高级编程
    Python面向对象编程
    Anaconda的安装
    Python模块
    Python函数式编程
    Python高级特性
    hdu 3065 病毒侵袭持续中 ac自动机
    hdu 2896 病毒侵袭 ac自动机
    poj 3667 Hotel 线段树
    hdu 4322 Candy 费用流
  • 原文地址:https://www.cnblogs.com/Lee-404/p/13039614.html
Copyright © 2020-2023  润新知