51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

wordpress IP验证不当漏洞修复

wordpress /wp-includes/http.php文件中的wp_http_validate_url函数对输入IP验证不当,导致黑客可构造类似于012.10.10.10这样的畸形IP绕过验证,进行SSRF。

解决方案:

在网站目录中找到这个wp-includes/http.php文件,编辑http.php

查找
$same_host = strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] );

|---|--------------------------------------------------------------------------------------------| | 1 | $same_host = strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ); |

替换成
if ( isset( $parsed_home['host'] ) ) { $same_host = ( strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ) || 'localhost' === strtolower( $parsed_url['host'] ) ); } else { $same_host = false; };

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 | if ( isset( $parsed_home['host'] ) ) { $same_host = ( strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] ) || 'localhost' === strtolower( $parsed_url['host'] ) ); } else { $same_host = false; }; |

查找
if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0]

|---|-------------------------------------------------------------------------| | 1 | if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0] |

改成
if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0] || 0 === $parts[0]

|---|------------------------------------------------------------------------------------------------| | 1 | if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0] || 0 === $parts[0] |

最后保存退出即可修复

赞(1)
未经允许不得转载:工具盒子 » wordpress IP验证不当漏洞修复