Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-22205 PoC — GitLab 代码注入漏洞

Source
Associated Vulnerability
Title:GitLab 代码注入漏洞 (CVE-2021-22205)
Description: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.
Readme
## 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
File Snapshot

[4.0K] /data/pocs/de4225d8a346d71ebc816af116dbf09574625f29 ├── [1.9K] exploit.py └── [1.1K] README.md 0 directories, 2 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →