滲透干貨分享:spring-boot-actuator-logview 文件包含漏洞復現


雨筍教育小編又來分享干貨了,常見文件包含漏洞復現分析:

前言

日常搬磚過程中在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打開,造成任意文件讀取

 

 

想要和雨筍的大佬們一起挖漏洞嗎?滲透測試課程等你來報名,趁這個暑假悄悄拔尖

滲透測試零基礎公開課:https://ke.qq.com/course/3383785?quicklink=1

加v:邀請請滲透測試交流群 718860842

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM