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行以后找到//一級目錄這里,在上方添加
if(strstr(URL,"?")){
???_404('您訪問的路徑錯誤,請核對后重試!');
}
如下:在這里的后方加上else流程,進入主頁流程的操作,同時加上urlJump方法(或者升級到最新版本以后再進行修改)
urlJump方法
//首頁跳轉并過濾注入字符
????/*
?????* @param $type?url模式
?????* @param $isSecSiteDir 是否為二級目錄 boolean
?????* */
????private?function?urlJump($type, $isSecSiteDir){
????????$http = is_https() ??'https://'?:?'http://';
????????$matches1 =?'';
????????switch ($type){
????????????//普通模式
????????????case?1:
????????????????$preg1 =?'';
????????????????if($isSecSiteDir ===?true){
????????????????????if($_SERVER['REQUEST_URI'] == SITE_DIR .?'/index.php'){
????????????????????????$preg1 =?'/^/.*?/index.php/';
????????????????????} elseif($_SERVER['REQUEST_URI'] ==?'/index.php'){
????????????????????????$preg1 =?'/^/index.php/';
????????????????????}
????????????????}?else?{
????????????????????$preg1 =?'/^/index.php/';
????????????????}
????????????????preg_match($preg1,$_SERVER['REQUEST_URI'],$matches1);
????????????????break;
????????????//偽靜態
????????????case?2:
????????????????$preg2 =?'';
????????????????if($isSecSiteDir ===?true){
????????????????????if($_SERVER['REQUEST_URI'] == SITE_DIR .?'/'){
????????????????????????$preg2 =?'/^/.*/';
????????????????????} elseif($_SERVER['REQUEST_URI'] ==?'/'){
????????????????????????$preg2 =?'/^/$/';
????????????????????}
????????????????}?else?{
????????????????????$preg2 =?'/^/.*/';
????????????????}
????????????????preg_match($preg2,$_SERVER['REQUEST_URI'],$matches1);
????????????????break;
????????????//兼容模式
????????????case?3:
????????????????$preg3 =?'';
????????????????if($isSecSiteDir ===?true){
????????????????????if(strpos($_SERVER['REQUEST_URI'], SITE_DIR) === 0){
????????????????????????$preg3 =?'/(^/.*?/index.php)|(^/.*)/';
????????????????????} elseif(strpos($_SERVER['REQUEST_URI'],?'/') === 0){
????????????????????????$preg3 =?'/(^/index.php)|(^/)/';
????????????????????}
????????????????}?else?{
????????????????????$preg3 =?'/(^/index.php)|(^/)/';
????????????????}
????????????????preg_match($preg3,$_SERVER['REQUEST_URI'],$matches1);
????????????????break;
????????}
????????if($matches1[0]){
????????????if($_SERVER['REQUEST_URI'] == $matches1[0]){
????????????????$this->getIndexPage();
????????????}?else?{
????????????????header("Location: "?. $http . $_SERVER['HTTP_HOST'] . $matches1[0],?true, 301);
????????????}
????????}?else?{
????????????_404('您訪問的頁面不存在,請核對后重試!');
????????}
????}
通過以上三步基本上就可以杜絕本次批量被掛馬的問題,后續就是要加強服務器上的安全驗證的問題了.