项目版本&介绍
V 1.6 2023 9.28发布
Mee-admin 是一個開源的、多用途的後台管理系統,可以用於快速搭建管理後台、內容管理系統(CMS)、控制台等。
idea部署
源码仓库: https://github.com/funnyzpc/mee-admin
环境要求: java17 Postgresql / mysql
如果选择 mysql 最好使用8.x版本,不然导入 SQL 时会有很多不支持的语法。
其余细节请看 https://github.com/funnyzpc/mee-admin/blob/master/README.md
额外说明
此项目采用 dev
运行。
如果需要使用 mysql
数据库,请将 application.properties
驱动更改为:
# 适配 Mysql 8.x
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
以及将 application-dev.properties
中的数据源修改为: (账号密码自己配置)
spring.datasource.url=jdbc:mysql://localhost:3306/mee_admin?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=xxxx
spring.datasource.password=xxxx
最后升级依赖,以支持新驱动
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
<scope>runtime</scope>
</dependency>
目录遍历
可以定位到: src/main/java/com/mee/common/web/CommonFileController.java
此过滤检查,光 setStatus
但是缺少 return
导致触发检查 逻辑链依然不会断。
// 检查 filePath 是否包含目录遍历的非法字符,比如 “..” 或 “./”
if (filePath.contains("..") || filePath.contains("./")) {
// 记录错误日志,打印出被请求的路径和文件名,方便排查
LOG.error("非法访问 filePath:{}, fileName:{}", filePath, fileName);
// 返回 403 Forbidden 状态码,拒绝该请求
response.setStatus(HttpStatus.FORBIDDEN.value());
}
准备好 test.txt 文件测试。可以看到响应码为403,但是读取依然成功。(存在Shiro需要权限验证)