IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    WordPress

    没穿底裤发表于 2016-04-18 09:34:01
    love 0

    近日,Wordpress官网发布了最新版本4.5,在安全方面,更新了之前由Baiduxlab提交的一个SSRF漏洞,先来看下wordpress 4.4.2内置的http请求函数相关代码。

    wp-includes/http.php Line 528

    if ( ! $same_host ) {
    $host = trim( $parsed_url['host'], '.' );
    if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) {
    $ip = $host;
    } else {
    $ip = gethostbyname( $host );
    if ( $ip === $host ) // Error condition for gethostbyname()
    $ip = false;
    }
    if ( $ip ) {
    $parts = array_map( 'intval', explode( '.', $ip ) );
    if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0]
    || ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] )
    || ( 192 === $parts[0] && 168 === $parts[1] )
    ) {
    // If host appears local, reject unless specifically allowed.
    /**
    * Check if HTTP request is external or not.
    *
    * Allows to change and allow external requests for the HTTP request.
    *
    * @since 3.6.0
    *
    * @param bool false Whether HTTP request is external or not.
    * @param string $host IP of the requested host.
    * @param string $url URL of the requested host.
    */
    if ( ! apply_filters( 'http_request_host_is_external', false, $host, $url ) )
    return false;
    }
    }
    }

    代码中12-14行的位置,是用来检测发送的http请求是否为内网地址,而这样的检测是可以通过IP地址的进制转换来绕过的。
    例如:
    内网IP :10.10.10.10 是不被允许的
    我们可以将IP转换为012.10.10.10(八进制)即可通过检测

    众多位置调用了该问题函数,如xmlrpc的接口,可以实现在前台无需登录即可调用该问题函数

    10.10.10.128 is my webserver,send a request to it.

    111111111111111111111111111111[1]

    10.10.10.129 is victim

    222222222222[1]



沪ICP备19023445号-2号
友情链接