前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >渗透干货分享:spring-boot-actuator-logview 文件包含漏洞复现

渗透干货分享:spring-boot-actuator-logview 文件包含漏洞复现

原创
作者头像
雨笋教育
修改2021-07-29 18:02:51
1.1K0
修改2021-07-29 18:02:51
举报
文章被收录于专栏:雨笋教育雨笋教育

雨笋教育小编又来分享干货了,常见文件包含漏洞复现分析:

前言

日常搬砖过程中在github发现的一个CVE,https://github.com/ARPSyndicate/kenzer-templates/blob/1f1dd550ddbde72cbe378452973b93b3e62003f5/jaeles/cvescan/medium/CVE-2021-21234.yam 看着带了springboot就分析了下

环境搭建

git clone https://github.com/cristianeph/vulnerability-actuator-log-viewer

启动之后访问 //localhost:8887/manage/log/

漏洞复现分析

根据springboot启动日志发现/log/view 对应的方法为eu.hinsch.spring.boot.actuator.logview.LogViewEndpoint.view

对应代码

@RequestMapping("/view")

public void view(@RequestParam String filename,

@RequestParam(required = false) String base,

@RequestParam(required = false) Integer tailLines,

HttpServletResponse response) throws IOException {

securityCheck(filename);

response.setContentType(MediaType.TEXT_PLAIN_VALUE);

Path path = loggingPath(base);

FileProvider fileProvider = getFileProvider(path);

if (tailLines != null) {

fileProvider.tailContent(path, filename, response.getOutputStream(), tailLines);

}

else {

fileProvider.streamContent(path, filename, response.getOutputStream());

}

}

先从RequestParam获取filename参数,然后调用securityCheck进行检查,判断filename是否包含..

安全检查通过之后,将application.properties中logging.path和base拼接,返回path,base从RequestParam获取,并未经过securityCheck

然后生成fileProvider 在调用 streamContent

将path和base拼接,然后用fileinputstream打开,造成任意文件读取

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
漏洞扫描服务
漏洞扫描服务(Vulnerability Scan Service,VSS) 是一款自动探测企业网络资产并识别其风险的产品。依托腾讯二十年累积的安全能力,漏洞扫描服务能够对企业的网络设备及应用服务的可用性、安全性与合规性等进行定期的安全扫描、持续性风险预警和漏洞检测,并且为企业提供专业的修复建议,降低企业安全风险。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档