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

Goal: 1000 CNY · Raised: 1310 CNY

100%

CVE-2025-49144 PoC — Notepad++ Privilege Escalation in Installer via Uncontrolled Executable Search Path

Source
Associated Vulnerability
Title:Notepad++ Privilege Escalation in Installer via Uncontrolled Executable Search Path (CVE-2025-49144)
Description:Notepad++ is a free and open-source source code editor. In versions 8.8.1 and prior, a privilege escalation vulnerability exists in the Notepad++ v8.8.1 installer that allows unprivileged users to gain SYSTEM-level privileges through insecure executable search paths. An attacker could use social engineering or clickjacking to trick users into downloading both the legitimate installer and a malicious executable to the same directory (typically Downloads folder - which is known as Vulnerable directory). Upon running the installer, the attack executes automatically with SYSTEM privileges. This issue has been fixed and will be released in version 8.8.2.
Description
This is my reproduce PoC for CVE-2025-49144
Readme
## 1. Overall
**CVE-2025-49144** là 1 lỗ hổng **local privilege escalation** trong **installer** của **Notepad++ 8.8.1** do **uncontrolled executable search path** (binary planting).

Trong quá trình cài đặt, installer gọi `regsvr32` **không chỉ định đường dẫn tuyệt đối**, dẫn đến việc ưu tiên tìm trong thư mục hiện tại. Kẻ tấn công chỉ cần đặt một `regsvr32.exe` độc hại cùng file Installer để mã độc được thực thi với đặc quyền cao (admin/SYSTEM tùy ngữ cảnh). 

Lỗi đã được vá ở **8.8.2** bằng cách gọi `regsvr32` từ system dir. 


## 2. Analysis

Chuỗi hành vi cốt lõi được nêu rõ trong advisory Github như sau:

> Installer gọi:
> `ExecWait 'regsvr32 /u /s "$INSTDIR\NppShell_01.dll"'`
>
> thay vì chỉ định tuyệt đối:
> `ExecWait '$SYSDIR\regsvr32.exe /u /s "$INSTDIR\NppShell_01.dll"'`

Để hiểu rõ hơn bug, ta tìm hiểu 1 chút về
điểm mấu chốt là **search order** của Windows: khi không có đường dẫn tuyệt đối, theo Microsoft, Windows sẽ dò theo chuỗi ưu tiên sau (dừng lại ngay khi thấy file khớp, và tự thêm .exe nếu thiếu):

- Thư mục chứa chính tiến trình gọi (application directory – nơi file .exe của installer đang nằm)

- Current directory của tiến trình cha (thường cũng chính là thư mục bạn đang chạy – rất hay trùng Downloads)

- System32 (`%SystemRoot%\System32`)

- System (16-bit)

- Windows directory (`%SystemRoot%`)

- Các thư mục trong PATH (theo thứ tự từ trái sang phải)
### 2.1. Phân tích flow thực thi
```
TLDR:
1. Đặt crafted regsvr32.exe vào thư mục Downloads.

2. Tải và chạy Notepad++ 8.8.1 installer từ cùng thư mục (double-click + chấp nhận UAC).

3. Vì installer gọi regsvr32 không chỉ định đường dẫn, Windows theo search order sẽ chạy regsvr32.exe trong thư mục của installer trước C:\Windows\System32.

4. Kết quả: crafted regsvr32.exe được thực thi với quyền của installer (elevated).

5. Nếu payload có bước lấy token SYSTEM (token duplication) thì attacker có thể spawn shell NT AUTHORITY\SYSTEM; nếu không, payload vẫn chạy với quyền admin của user hiện tại.
```
Đầu tiên, installer Notepad++ 8.8.1 chạy `ExecWait 'regsvr32 /u /s "$INSTDIR\NppShell_01.dll"'` để unregister shell extension cũ.

Tiếp theo, search order kích hoạt binary mà attacker đã planting từ trước:
vì không chỉ định đường dẫn tuyệt đối của binary, Windows dò theo thứ tự mình đã giải thích qua như trên, do đó, nếu có sẵn file `regsvr32.exe` “giả” trong cùng thư mục chạy installer (ví dụ `Downloads`)thì nó sẽ được gọi trước bản nằm trong `C:\Windows\System32\`.

Và vì quyền của installer được elevate qua UAC nên binary mà nó kích hoạt cũng sẽ kế thừa quyền đó.

-> Tới đây, ta cơ bản đã thành công hiểu concept của bug và đã leo quyền thành công.

Trong quá trình mình research, đôi lúc mình có thấy ảnh chụp thể hiện đã lấy được quyền SYSTEM trong PoC thì mình muốn nói thêm rằng, để lấy được quyền `nt authority/system`, ta cần thiết kế binary chuyên cho việc lấy quyền SYSTEM, chứ nếu không làm gì thêm thì ta chỉ lấy được quyền của user chạy installer thôi.

Về phía mình, khi đã có quyền admin, mình thực hiện thêm một bước nữa trong payload để đạt được shell ở mức cao hơn: duplicate token từ một tiến trình chạy dưới SYSTEM (winlogon.exe), rồi gọi `CreateProcessWithTokenW` để khởi tạo một tiến trình cmd.exe mới được gán token đó -> kết quả là một shell chạy dưới NT AUTHORITY\SYSTEM. Đây là phần mở rộng của payload (giai đoạn 2) chứ không phải hành vi mặc định của ExecWait hay reverse shell đơn thuần.

Và để tránh làm treo installer, payload được thiết kế detached / self-reexec: tiến trình cha (được installer gọi) sẽ duplicate token và spawn một tiến trình con độc lập chạy dưới SYSTEM, rồi thoát ngay. Installer thấy `regsvr32.exe` đã kết thúc và tiếp tục cài đặt bình thường, trong khi shell SYSTEM của attacker vẫn tồn tại và có thể tương tác qua listener.


## 3. PoC
Video: 
https://youtu.be/ehYVZ1ZQtAs

## 4. Appendix

1. Source code `regsvr32.c`: https://github.com/havertz2110/CVE-2025-49144/blob/main/regsvr32.c

2. Link tham khảo
- https://www.cyberproof.com/blog/cve-2025-49144-notepad-privilege-escalation-vulnerability-detection-analysis-and-practical-defenses/

- https://github.com/notepad-plus-plus/notepad-plus-plus/security/advisories/GHSA-9vx8-v79m-6m24

- https://github.com/notepad-plus-plus/notepad-plus-plus/security/advisories/GHSA-g5rj-m8mm-cgw6
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
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 →