代理加盟

2023全新代理计划,一站式模板建站,铜牌代理低至699元送终身VIP,独立代理后台,自营贴牌。

您现在的位置: 麦站网 > PBoot教程 > 常见问题 >

最新pbootcms被挂马终极解决方案

来源:本站原创 发布时间:2023-06-16 08:54:54热度:3006 ℃我要评论(1

麦站模板建站平台(10年经验),服务数万家企业,固定透明报价。域名注册、主机/服务器、网站源码一站式服务。实体公司,专业团队,值得选择!超过1000套模板已登记版权,合规合法建站,规避版权风险!【点击获取方案】

pbootcms被黑挂马,查不到木马病毒文件,pbootcms和其他CMS一样,安全漏洞也是其无法避免的问题。虽然官方不断发布补丁、升级版本,但安全问题依然存在。

今天我们介绍一个病毒:

http://域名/jjjc/90.html?id=52239633.shtml

http://域名/jjjc/89.html?id=52239634.shtml

pbootcms被黑挂马解决办法:

1)替换apps以及core文件,如果本地没有备份保存,那么可以选择升级到最近版本,目前官方也根据这个问题进行了更新处理.

2)修改robots.txt文件添加针对首页问题的拒绝访问规则

# Robots 

Disallow: /admin/*

Disallow: /skin/

Disallow: /template/

Disallow: /static/*

Disallow: /api/*

Disallow: /?*

3) 修改源码,在apps/home/controller/IndexController.php 文件中添加针对首页带参数问题的处理。代码大概在200行以后找到//一级目录这里,在上方添加

1if(strstr(URL,"?")){
2   _404('您访问的路径错误,请核对后重试!');
3}

 

如下:在这里的后方加上else流程,进入主页流程的操作,同时加上urlJump方法(或者升级到最新版本以后再进行修改)

 

urlJump方法

01//首页跳转并过滤注入字符
02    /*
03     * @param $type url模式
04     * @param $isSecSiteDir 是否为二级目录 boolean
05     * */
06    private function urlJump($type, $isSecSiteDir){
07        $http = is_https() ? 'https://' : 'http://';
08        $matches1 = '';
09        switch ($type){
10            //普通模式
11            case 1:
12                $preg1 = '';
13                if($isSecSiteDir === true){
14                    if($_SERVER['REQUEST_URI'] == SITE_DIR . '/index.php'){
15                        $preg1 = '/^/.*?/index.php/';
16                    } elseif($_SERVER['REQUEST_URI'] == '/index.php'){
17                        $preg1 = '/^/index.php/';
18                    }
19                } else {
20                    $preg1 = '/^/index.php/';
21                }
22                preg_match($preg1,$_SERVER['REQUEST_URI'],$matches1);
23                break;
24            //伪静态
25            case 2:
26                $preg2 = '';
27                if($isSecSiteDir === true){
28                    if($_SERVER['REQUEST_URI'] == SITE_DIR . '/'){
29                        $preg2 = '/^/.*/';
30                    } elseif($_SERVER['REQUEST_URI'] == '/'){
31                        $preg2 = '/^/$/';
32                    }
33                } else {
34                    $preg2 = '/^/.*/';
35                }
36                preg_match($preg2,$_SERVER['REQUEST_URI'],$matches1);
37                break;
38            //兼容模式
39            case 3:
40                $preg3 = '';
41                if($isSecSiteDir === true){
42                    if(strpos($_SERVER['REQUEST_URI'], SITE_DIR) === 0){
43                        $preg3 = '/(^/.*?/index.php)|(^/.*)/';
44                    } elseif(strpos($_SERVER['REQUEST_URI'], '/') === 0){
45                        $preg3 = '/(^/index.php)|(^/)/';
46                    }
47                } else {
48                    $preg3 = '/(^/index.php)|(^/)/';
49                }
50                preg_match($preg3,$_SERVER['REQUEST_URI'],$matches1);
51                break;
52        }
53        if($matches1[0]){
54            if($_SERVER['REQUEST_URI'] == $matches1[0]){
55                $this->getIndexPage();
56            } else {
57                header("Location: " . $http . $_SERVER['HTTP_HOST'] . $matches1[0], true, 301);
58            }
59        } else {
60            _404('您访问的页面不存在,请核对后重试!');
61        }
62    }
 

通过以上三步基本上就可以杜绝本次批量被挂马的问题,后续就是要加强服务器上的安全验证的问题了.

=======================分割线。

扩展阅读:

>> Pbootcms安全设置防护教程(更新至2022-05-12)

>> pbootcms网站备份教程

    转载请注明来源网址:https://www.xiuzhanwang.com/pbootcms_wt/5205.html

    发表评论

    评论列表(1条)

       
      QQ在线咨询
      VIP限时特惠