栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

springboot任意文件读取 CVE-2021-21234

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

springboot任意文件读取 CVE-2021-21234

一、简介 spring-boot-actuator-logview是简单的日志文件查看器作为 Spring Boot 执行器端,允许快速访问 spring-boot web 应用程序日志文件。

二、漏洞复现

项目地址:

链接: https://pan.baidu.com/s/1lm4AZfvLlP-x0GfrdMBKeA 提取码: juq3 

下载该项目,并使用idea运行该项目。

打开网页便能查看日志情况

该漏洞存在LogViewEndpoint中,

只对filename进行了检验,并未对base进行检验,

filename检验函数

构造poc如下

http://localhost:8887/manage/log/view?filename=etc/group&base=../../../../../../

页面访问

修复建议

升级到0.2.13版本

在0.2.13版本对base进行了检验。

private void securityCheck(Path base, String filename) {

        try {

            String canonicalLoggingPath = (filename != null ? new File(base.toFile().toString(), filename) : new File(base.toFile().toString())).getCanonicalPath();

            String baseCanonicalPath = (new File(this.loggingPath)).getCanonicalPath();

            String errorMessage = "File " + base.toString() + "/" + filename + " may not be located outside base path " + this.loggingPath;

            Assert.isTrue(canonicalLoggingPath.startsWith(baseCanonicalPath), errorMessage);

        } catch (IOException var6) {

            throw new IllegalStateException(var6);

        }

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/434886.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号