关联漏洞
标题:
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
介绍
## Unauthenticated RCE on Gitlab version < 13.10.3
Unauthenticated RCE exploit for gitlab version < 13.10.3
**For educational/research purpose only. Use at your own risk**
Root cause:
- When uploading image files, Gitlab Workhorse passes any files with the extensions jpg|jpeg|tiff through to ExifTool to remove any non-whitelisted tags.
- One of the supported formats is DjVu. When parsing the DjVu annotation, the tokens are evaled to "convert C escape sequences".
- Author's write-up: https://devcraft.io/2021/05/04/exiftool-arbitrary-code-execution-cve-2021-22204.html
```
# convert C escape sequences (allowed in quoted text)
$tok = eval qq{"$tok"};
```
### Credits
- Reported by: https://hackerone.com/reports/1154542
- Refered some code from here: https://github.com/CsEnox/GitLab-Wiki-RCE
- Author's write up: https://devcraft.io/2021/05/04/exiftool-arbitrary-code-execution-cve-2021-22204.html
### Usage
Need install `djvumake` & `djvulibre` to work
Install djvulibre ( if you haven't installed it yet)
```
sudo apt-get install -y djvulibre-bin
```
Run exploit
```
python3 exploit.py -t <gitlab_url> -c <command>
```
Tested on version 13.10.1-ce.0
文件快照
[4.0K] /data/pocs/de4225d8a346d71ebc816af116dbf09574625f29
├── [1.9K] exploit.py
└── [1.1K] README.md
0 directories, 2 files
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。