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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2023-7028 PoC — Weak Password Recovery Mechanism for Forgotten Password in GitLab

Source
Associated Vulnerability
Title:Weak Password Recovery Mechanism for Forgotten Password in GitLab (CVE-2023-7028)
Description:An issue has been discovered in GitLab CE/EE affecting all versions from 16.1 prior to 16.1.6, 16.2 prior to 16.2.9, 16.3 prior to 16.3.7, 16.4 prior to 16.4.5, 16.5 prior to 16.5.6, 16.6 prior to 16.6.4, and 16.7 prior to 16.7.2 in which user account password reset emails could be delivered to an unverified email address.
Readme
### Giới thiệu

- `GitLab` là trình quản lý kho dữ liệu lưu trữ trên web được áp dụng rộng rãi, cung cấp nền tảng toàn diện để quản lý mã nguồn, tích hợp, duy trì và cộng tác trong các dự án phát triển phần mềm
- `CVE-2023-7028` là lỗ hổng cho phép attacker chiếm được tài khoản người dùng `(Account TakeOver)` thông qua form `reset password`
- Lỗ hổng nằm trong các `phiên bản` sau của GitLab:
    - 16.1 to 16.1.5
    - 16.2 to 16.2.8
    - 16.3 to 16.3.6
    - 16.4 to 16.4.4
    - 16.5 to 16.5.5
    - 16.6 to 16.6.3
    - 16.7 to 16.7.1

### Phân tích lỗ hổng

- Lỗ hổng nằm tại form `reset password` cụ thể là API endpoint `POST /users/password` của GitLab, Attacker khai thác lỗ hổng trong trường email addres bypass kiểm tra sai format dẫn tới việc attacker có thể chèn email của mình vào và khi đó GitLab gửi `reset token` tới cho email của attacker
- Phân tích lỗ hổng:
    - Dựa vào [đoạn code](https://gitlab.com/gitlab-org/gitlab-foss/-/commit/21f32835ac7ca8c7ef57a93746dac7697341acc0) GitLab cung cấp ta nhận thấy như sau:
        
        ![1](https://github.com/thanhlam-attt/CVE-2023-7028/assets/79523444/f01bdb76-1c45-4516-b123-25eb8f4cf577)

        
        - Phần xử lý yêu cầu Reset Password nằm tại file **`spec/controllers/passwords_controller_spec.rb`,** cho phép nhập vào nhiều email từ input nhưng không có bất cứ cơ chế xác thực email nào để xác nhận rằng đó là email của user
        - Phía server chỉ yêu cầu `authenticity_token` (đây là hidden token để chống CSRF) từ phía attacker trong form submit để gửi request reset passwd
            
            ![2](https://github.com/thanhlam-attt/CVE-2023-7028/assets/79523444/6774da10-d9fd-4bd4-8b68-937aa824ea39)

            
        
         → Ta có thể chèn email của mình vào để nhận `reset token` reset passwd của email nạn nhân từ đó chiếm được tài khoản người dùng
        

### Khai thác lỗ hổng

- Bắt request reset password ta được như sau:
    
    ![3](https://github.com/thanhlam-attt/CVE-2023-7028/assets/79523444/5bdc4438-9870-487b-b900-d6c13a2ba9fe)

    
    - Form bao gồm một `authenticity_token` được sử dụng để chống CSRF, tên email của user được reset passwd được đặt trong biến `user[email]`
- Add thêm email của attacker theo payload như sau `&user[email][]=victim_email&user[email][]=attacker_email` và gửi request:
    
    ![4](https://github.com/thanhlam-attt/CVE-2023-7028/assets/79523444/a8516953-7454-40fb-ba43-d287fc3eb02d)

    
    → Check email của attacker nhận thấy rằng reset password token đã được gửi tới và có thể truy cập để thay đổi passwd
    
    ![5](https://github.com/thanhlam-attt/CVE-2023-7028/assets/79523444/092b750d-4884-4d4c-9b5c-682ad0ed15ea)

    
    ![6](https://github.com/thanhlam-attt/CVE-2023-7028/assets/79523444/009d2548-4fb2-4e94-9423-cd8e0290de67)
File Snapshot

[4.0K] /data/pocs/40aa41d003c8331402128ecc7beb374c4da98a0b ├── [3.2K] CVE-2023-7028 PoC.py └── [3.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 →