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:RARLAB UnRAR before 6.12 on Linux and UNIX allows directory traversal to write to files during an extract (aka unpack) operation, as demonstrated by creating a ~/.ssh/authorized_keys file. NOTE: WinRAR and Android RAR are unaffected.
Readme
**Phân tích lỗ hổng CVE-2022-30333 – Path Traversal trong UnRAR dẫn đến RCE trong Zimbra**

**1. Tổng quan lỗ hổng**

CVE ID: CVE-2022-30333

CVSS v3.1: 7.5 (High)

Phạm vi ảnh hưởng phần mềm:
UnRAR: tất cả các phiên bản < 6.12 (hoặc bản mã nguồn mở < 6.1.7)

Zimbra Collaboration Suite:

9.0.0 patch ≤ 24

8.8.15 patch ≤ 31

**2. Chi tiết kỹ thuật**

Unrar thực hiện kiểm tra an toàn đường dẫn symbolic link (dựa trên ký tự / – chuẩn Linux), trước khi chuyển đổi đường dẫn từ định dạng Windows (\\) sang Unix (/), thông qua hàm: DosSlashToUnix()

Code minh họa:
\\


    bool IsRelativeSymlinkSafe(const char *targetPath) {
    // Kiểm tra nếu có "../" để ngăn path traversal
    
    if (strstr(targetPath, "../") != nullptr) {
    
        return false;
        
    }
    
    // Sau kiểm tra, mới chuyển đổi định dạng
   
    DosSlashToUnix(targetPath);  // ← lỗi ở đây
   
    return true; }


Điều này tạo ra lỗ hổng logic: một symbolic link dạng ..\..\..\tmp\file bypass được kiểm tra, nhưng sau khi chuyển đổi sẽ trở thành ../../../tmp/file, dẫn tới Path Traversal.

Demo:

Sử dụng metasploit để khai thác lỗ hổng

![image](https://github.com/user-attachments/assets/ce8d827a-dc98-43c9-9637-9fe53ef7b55d)

Cấu hình payload và gửi payload qua mail đến hệ thống

![image](https://github.com/user-attachments/assets/1c575935-577e-412b-954f-d7b3f85e187b)

Zimbra sử dụng Amavisd để scan email và file đính kèm nhằm phát hiện mã độc.

Amavisd tự động gọi lệnh unrar để giải nén các tệp .rar mà không kiểm tra chuẩn hóa đường dẫn symbolic link.

Payload được giải nén tự động với file .unrar trong mục /tmp

![image](https://github.com/user-attachments/assets/54aec06a-6594-43bb-bbe7-0c7636f5792d)

Khai thác thành công lỗ hổng

![image](https://github.com/user-attachments/assets/680012a3-7ca7-48f1-80fd-05d4e42f0fdd)
File Snapshot

[4.0K] /data/pocs/8c7185c8ece193a67f98cd3cb676af16e28b9971 └── [2.0K] README.md 0 directories, 1 file
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 →