-
Notifications
You must be signed in to change notification settings - Fork 123
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug Description
任意文件上传漏洞
Steps to Reproduce
漏洞目标地址
url地址:POST /api/v1/attachments
存在问题描述:
此类漏洞指由于程序员在开发文件上传功能时,没有考虑对文件格式后缀的合法性进行校验或只考虑在应用前端(Web浏览器端)通过javascript进行后缀校验,攻击者可上传一个包含恶意代码的动态脚本(如jsp、asp、php、aspx文件后缀)到服务器上,攻击者访问该脚本时服务器将对包含恶意代码的动态脚本解析,最终执行相应的恶意代码。该漏洞最终将可能直接影响应用系统的服务器安全,攻击者可通过所上传的脚本完全控制服务器。
Expected Behavior
整改意见:
1、对上传文件类型进行验证,除在前端验证外在后端依然要做验证,后端可以进行扩展名检测,重命名文件,MIME类型检测以及限制上传文件的大小等限制来防御,或是将上传的文件其他文件存储服务器中。 2、严格限制和校验上传的文件,禁止上传恶意代码的文件。同时限制相关上传文件目录的执行权限,防止木马执行。 3、对上传文件格式进行严格校验,防止上传恶意脚本文件; 4、严格限制上传的文件路径。 5、文件扩展名服务端进行最小化白名单校验,仅保留业务所必需的文件扩展名。 6、文件内容服务端校验。 7、上传文件重命名。 8、隐藏上传文件路径。
Actual Behavior
攻击者可上传一个包含恶意代码的动态脚本(如jsp、asp、php、aspx文件后缀)到服务器上
Affected Component
Admin Console
Severity
Critical (System crash, data loss)
Environment
吉利内部测试环境,基于himarket0.5版本Logs and Error Messages
Screenshots
No response
Additional Context
No response
Checklist
- I have searched existing issues to avoid duplicates
- I have included all necessary information above
- I am using the latest version of HiMarket
- I can reproduce this issue consistently
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working