|
发表于 2017-11-15 11:53:55
|
显示全部楼层
|阅读模式
来自 中国–河南–新乡
近期很多使用阿里云的站长收到了阿里云给出的漏洞消息,漏洞名称如下:
Discuz memcache+ssrf GETSHELL漏洞
这里给大家提供一个简单的修复方案!
首先找到这个文件
source/function/function_core.php
搜索代码:
- function output_replace($content) {
- global $_G;
- if(defined('IN_MODCP') || defined('IN_ADMINCP')) return $content;
- if(!empty($_G['setting']['output']['str']['search'])) {
- if(empty($_G['setting']['domain']['app']['default'])) {
- $_G['setting']['output']['str']['replace'] = str_replace('{CURHOST}', $_G['siteurl'], $_G['setting']['output']['str']['replace']);
- }
- $content = str_replace($_G['setting']['output']['str']['search'], $_G['setting']['output']['str']['replace'], $content);
- }
- if(!empty($_G['setting']['output']['preg']['search']) && (empty($_G['setting']['rewriteguest']) || empty($_G['uid']))) {
- if(empty($_G['setting']['domain']['app']['default'])) {
- $_G['setting']['output']['preg']['search'] = str_replace('\{CURHOST\}', preg_quote($_G['siteurl'], '/'), $_G['setting']['output']['preg']['search']);
- $_G['setting']['output']['preg']['replace'] = str_replace('{CURHOST}', $_G['siteurl'], $_G['setting']['output']['preg']['replace']);
- }
-
-
- foreach($_G['setting']['output']['preg']['search'] as $key => $value) {
- $content = preg_replace_callback($value, create_function('$matches', 'return '.$_G['setting']['output']['preg']['replace'][$key].';'), $content);
- }
- }
-
-
- return $content;
复制代码 添加一行代码,如下- function output_replace($content) {
- global $_G;
- if(defined('IN_MODCP') || defined('IN_ADMINCP')) return $content;
- if(!empty($_G['setting']['output']['str']['search'])) {
- if(empty($_G['setting']['domain']['app']['default'])) {
- $_G['setting']['output']['str']['replace'] = str_replace('{CURHOST}', $_G['siteurl'], $_G['setting']['output']['str']['replace']);
- }
- $content = str_replace($_G['setting']['output']['str']['search'], $_G['setting']['output']['str']['replace'], $content);
- }
- if(!empty($_G['setting']['output']['preg']['search']) && (empty($_G['setting']['rewriteguest']) || empty($_G['uid']))) {
- if(empty($_G['setting']['domain']['app']['default'])) {
- $_G['setting']['output']['preg']['search'] = str_replace('\{CURHOST\}', preg_quote($_G['siteurl'], '/'), $_G['setting']['output']['preg']['search']);
- $_G['setting']['output']['preg']['replace'] = str_replace('{CURHOST}', $_G['siteurl'], $_G['setting']['output']['preg']['replace']);
- }
-
- if (preg_match("(/|#|\+|%).*(/|#|\+|%)e", $_G['setting']['output']['preg']['search']) !== FALSE) { die("request error"); }//本行代码为新增代码
-
- foreach($_G['setting']['output']['preg']['search'] as $key => $value) {
- $content = preg_replace_callback($value, create_function('$matches', 'return '.$_G['setting']['output']['preg']['replace'][$key].';'), $content);
- }
- }
-
-
- return $content;
- }
复制代码 然后将修改好的文件保存,上传到服务器目录覆盖一下,然后去阿里云对应漏洞提示后面点击“验证一下”,验证时候漏洞提示就会消失!
问题解决!
|
|