首页 文章 精选 留言 我的

精选列表

搜索[AI可见性],共10000篇文章
优秀的个人博客,低调大师

Xiuno BBS 审计之问题:插件安装直接 include 可 RCE

此文章为[XIUNOX](https://github.com/domidesign/xiunox)版本重构审计时发现问题,[XIUNOX](https://github.com/domidesign/xiunox)版本已优化修复此问题。分享出来方便后续想基于xiuno bbs4.0.4版本制作维护版本或插件模板等需求的开发者和站长参考。 ## 现象 Xiuno BBS 4.0.4 安装、卸载、升级、设置插件时,会直接 `include _include(APP_PATH."plugin/$dir/install.php")` 等插件自带脚本,且没有任何沙盒、签名校验、函数黑名单。插件作者可以在 `install.php` 中植入任意代码:删库、写马、读取 `conf.php` 中的数据库密码、向远程发送站点密钥。即便禁用插件,install.php 已经执行过一次,后门已落地。 ## 源码证据 文件:`xiunobbs_4.0.4/admin/route/plugin.php` 第 155-175 行(安装时 include install.php) ```javascript } elseif($action == 'install') { plugin_lock_start(); $dir = param_word(2); plugin_check_exists($dir); $name = $plugins[$dir]['name']; // 插件依赖检查 / check plugin dependency plugin_check_dependency($dir, 'install'); // 安装插件 / install plugin plugin_install($dir); $installfile = APP_PATH."plugin/$dir/install.php"; if(is_file($installfile)) { include _include($installfile); // 直接 include 插件提供的 PHP,无沙盒 } plugin_lock_end(); // ... } ``` 文件:`xiunobbs_4.0.4/admin/route/plugin.php` 第 203-223 行(卸载时 include unstall.php) ```javascript } elseif($action == 'unstall') { // ... plugin_unstall($dir); $unstallfile = APP_PATH."plugin/$dir/unstall.php"; if(is_file($unstallfile)) { include _include($unstallfile); // 同样无任何校验 } // ... } ``` 文件:`xiunobbs_4.0.4/admin/route/plugin.php` 第 277-310 行(升级时 include upgrade.php) ```javascript } elseif($action == 'upgrade') { // ... plugin_install($dir); $upgradefile = APP_PATH."plugin/$dir/upgrade.php"; if(is_file($upgradefile)) { include _include($upgradefile); // 升级脚本任意执行 } // ... } ``` 文件:`xiunobbs_4.0.4/admin/route/plugin.php` 第 317-324 行(设置页 include setting.php) ```javascript } elseif($action == 'setting') { $dir = param_word(2); plugin_check_exists($dir); $name = $plugins[$dir]['name']; include _include(APP_PATH."plugin/$dir/setting.php"); // 设置页任意 PHP 执行 } ``` 文件:`xiunobbs_4.0.4/admin/route/plugin.php` 第 388-434 行(plugin_download_unzip 直接解压到 plugin/ 目录,无签名) ```javascript function plugin_download_unzip($dir) { global $conf; // ... $url = PLUGIN_OFFICIAL_URL."plugin-download-$dir-$siteid-$app_url.htm"; $s = http_get($url); // ... $zipfile = $conf['tmp_path'].'plugin_'.$dir.'.zip'; $destpath = APP_PATH."plugin/"; file_put_contents($zipfile, $s); // 清理原来的钩子,防止叠加。 rmdir_recusive(APP_PATH."plugin/$dir/hook/", 1); rmdir_recusive(APP_PATH."plugin/$dir/overwrite/", 1); // 直接覆盖原来的 plugin 目录下的插件目录 xn_unzip($zipfile, $destpath); // 解压即落地,install.php 即可被 include // ... } ``` ## 风险等级与结论 **风险等级:严重(Critical)|生态缺陷** 危害: 1. 安装任意插件 = 执行任意 PHP,无沙盒、无签名、无函数黑名单。 1. install.php 可读取 `conf/conf.php` 中的 DB 密码、`auth_key`,外传给攻击者。 1. install.php 可写文件到 `upload/`、`tmp/`、`view/`,植入持久化 webshell。 1. 官方源 `plugin.xiuno.com` 已失效(见独立缺陷),用户被迫从第三方下载,供应链攻击面巨大。 1. 即便用户事后禁用、卸载插件,install.php 已执行过的副作用(删表、改密码、写马)无法回滚。 修复建议: - 引入插件签名机制:插件包必须附 `conf.json.sig`(Ed25519),`plugin_download_unzip` 解压后立即校验签名,不匹配则拒绝安装。 - install/unstall/upgrade/setting.php 在受限沙盒中执行:禁用 `exec/system/eval/file_put_contents/unlink/mysql_query` 等危险函数(通过 `disable_functions` ini 临时注入)。 - 限制 install.php 只能调用 BBS 提供的 `plugin_install_hook()` API 完成数据库变更,禁止直接 SQL。 - 安装前展示 install.php 源码摘要给管理员审阅,并扫描危险关键字(`eval`、`exec`、`file_put_contents`、`fopen`、`mysql`、`$_POST`、`$_GET`、`base64_decode`)。 - 强制 install.php 通过 `_include()` 编译时附加 `

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

用户登录
用户注册
修改密码
忘记密码