安全加固: 为 UpgradeController::down() 增加文件类型白名单和路径校验#58
Closed
nilm61 wants to merge 1 commit into
Closed
Conversation
- 新增文件扩展名白名单,只允许下载官方更新所需的文件类型 - 禁止以 / 开头的绝对路径 - 新增敏感系统文件黑名单(Kernel.php、Check.php、start.php、admin.php、index.php) - 增加安全审计日志,记录违规操作 修复 CWE-22(路径遍历)和 CWE-434(任意文件下载)漏洞 基于 PbootCMS 3.2.15 安全性评估报告
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
UpgradeController::down()方法用于从远程服务器下载更新文件。原实现仅过滤了../路径遍历序列,但存在以下安全隐患:/admin.php)攻击者在获取后台权限后,可利用此功能下载任意文件进行信息收集。
修复内容
$allowedExts文件扩展名白名单,只允许下载官方更新所需的文件类型/开头的绝对路径测试验证
已测试以下场景:
list=/admin.php→ 被拒绝(绝对路径)list=/../../etc/passwd→ 被拒绝(绝对路径)list=core/basic/Kernel.php→ 被拒绝(敏感文件)list=apps/home/controller/IndexController.php→ 允许(合法的更新文件)关联
基于 PbootCMS 3.2.15 安全性评估报告:升级系统功能仍可作为攻击入口,需要额外加固。