
Exploitable target to CVE-2017-5638
完全基于 https://github.com/piesecurity/apache-struts2-CVE-2017-5638
一个真实场景:将某个框架的参考项目部署到容器中,却引发了严重后果。请查看代码并编译以熟悉它。同时检查 Dockerfile——是否有任何特定内容引起了我们的注意?
展示了日常决策和多个漏洞如何轻易地被串联利用。
前提条件:
准备步骤:
./mvnw clean packagedocker build -t hackme \.docker run -d -p 9080:8080 hackme注意:如果未安装 Docker,可以运行 ./mvnw jetty:run
开始测试 RCE —— 运行 exploit.py 文件:
python exploit.py http://localhost:9080/orders/3 "CMD"java -jar jython*.jar exploit.py http://localhost:9080/orders/3 "CMD"尝试不同的 CMD,例如:
pwd —— 我们在哪里?whoami —— 我们以什么用户身份运行?ls -la —— 我的目录里有什么?ls / —— 我的机器上有什么ls /etc —— 还能找到什么?使用 Nexus Lifecycle 组件信息面板 找出 struts2-core 的无漏洞版本。将 POM 更新到该版本并重新构建。你也可以重新构建 Docker 镜像并运行,再次尝试攻击。
另外,查看此仓库的 Issues 中的 DepShield 发现
https://github.com/apache/struts/tree/master/apps/rest-showcase
README.txt - Rest Showcase Webapp
Rest Showcase is a simple example of REST app build with the REST plugin.
For more on getting started with Struts, see
* http://cwiki.apache.org/WW/home.html
I18N:
=====
Please note that this project was created with the assumption that it will be run
in an environment where the default locale is set to English. This means that
the default messages defined in package.properties are in English. If the default
locale for your server is different, then rename package.properties to package_en.properties
and create a new package.properties with proper values for your default locale.