WordPress <4.5 SSRF 分析

没穿底裤 2020年1月1日05:18:26评论664 views字数 1124阅读3分44秒阅读模式
摘要

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

近日,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.

WordPress <4.5 SSRF 分析

10.10.10.129 is victim

WordPress <4.5 SSRF 分析

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
没穿底裤
  • 本文由 发表于 2020年1月1日05:18:26
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   WordPress <4.5 SSRF 分析http://cn-sec.com/archives/76802.html

发表评论

匿名网友 填写信息