Neyrian/payload-dll-injector
GitHub: Neyrian/payload-dll-injector
面向 Windows 10/11 的隐蔽 Payload 注入器,集成 EDR/AV/沙箱规避与二进制混淆技术,用于红队测试中绕过终端防护检测。
Stars: 10 | Forks: 0
# 🚀 具备 EDR/AV/沙箱规避功能的高级 Payload 注入器
## 🔥 概述
本项目实现了一个针对 **Windows 10 和 11** 的**隐蔽 Payload 注入器**,并采用了高级规避技术。它包含了**绕过 EDR、AV 和沙箱检测**的机制,同时使用直接 syscalls、手动 API 解析、PEB walk 和混淆来降低检测率。该注入器会创建一个挂起的进程,注入一个内置的 payload(使用 msfvenom 构建),并以隐蔽的方式执行它。
我仍在完善其隐蔽性:
- 使用简单的 msfvenom msgbox payload:
- 在 [VirusTotal](https://www.virustotal.com/gui/file/53cb4bf5ab8d90710bfd0e7416a17f15c31e862ab8aeb6c3bf50b13f462a75ea?nocache=1) 上为 5/69
- 在 [Hybrid Analysis Sandbox](https://hybrid-analysis.com/sample/53cb4bf5ab8d90710bfd0e7416a17f15c31e862ab8aeb6c3bf50b13f462a75ea) 上被标记为可疑
- 使用简单的 msfvenom windows/x64/meterpreter/reverse_tcp payload
- 在 [VirusTotal](https://www.virustotal.com/gui/file/9f2b5b0ff6aef85fd01223d850a16a588befb045f6ad9e732a85f81770286fd6?nocache=1) 上为 4/70
- 在 [Hybrid Analysis Sandbox](https://hybrid-analysis.com/sample/9f2b5b0ff6aef85fd01223d850a16a588befb045f6ad9e732a85f81770286fd6) 上无特定威胁
## 📌 **功能**
✅ **隐蔽注入:** 创建一个挂起的进程,并在不使用常见 Windows API 调用的情况下注入 payload。
✅ **内置 payload:** 编译时,payload 会被动态嵌入到二进制文件中。
✅ **EDR/AV/沙箱规避:** 实现了多项检查以检测沙箱环境、VM 检测以及 EDR hooks。
✅ **直接 Syscalls:** 绕过 `ntdll.dll` 中的 API hooks。(硬编码 SSN。改进方向:使用 Hell's Gate & SysWhispers)。
✅ **避免从模块中调用函数:** 使用 `PEB walk` 在不加载模块的情况下检索模块中的函数。
✅ **混淆:** 最新:不再是简单的纯字符串 Base64 编码,而是在二进制文件构建完成后对可疑的植入物进行混淆。感谢 [4g3nt47's Obfuscator](https://github.com/4g3nt47/Obfuscator.git)。
✅ **诱饵执行:** 注入器会执行一个诱饵函数,以模仿合法软件的行为。
## 🚀 **用法**
### **1️⃣ 编译**
```
Requirements:
- gcc-mingw-w64-x86-64-win32
- nasm
- gcc
- make
```
使用 **makefile** 或按你的方式编译(别忘了使用混淆器 😊 )
makefile 会执行:
```
1 - Compile the dependencies
2 - Compile the obfuscator
3 - Build the payload (you can modify it directly from the makefile)
4 - Run the payloadObfuscator on the generated payload.h
5 - Compile the payloadinjector.c into injector.exe
6 - Modify the PE section
7 - Run the obfuscator, this will generate obfsinjector.exe
8 - Fix the checksum cause we messed with the PE :)
```
### **2️⃣ 运行注入器**
```
obfsinjector.exe
```
## 🐍 **EDR、AV 和沙箱规避**
### ✅ **EDR 检测 (`detector.c`)**
- 扫描 `C:\Windows\System32\drivers\` 以查找已知的 **EDR 和 AV 驱动**(Carbon Black、CrowdStrike、SentinelOne 等)。
- 如果发现,则执行诱饵程序而不是进行注入。
### ✅ **反沙箱技术**
- **检测虚拟机痕迹**:
- 检查 **VMware**、**VirtualBox** 和 **Hyper-V 文件**。
- **检测 Sleep Patching**:
- 测量 `Sleep(10000)` 的**执行时间**。
- 如果被篡改,则停止执行。
- **检测文件名哈希匹配**:
- 检查**二进制文件名是否与其 MD5 哈希匹配**(常见于加壳的恶意软件中)。
- **检测沙箱 DLL**:
- 检查是否存在沙箱的 DLL。
### ✅ **反调试技术**
- **检测 PEB 中是否存在 NtGlobalFlag。**
- **检测 HEAP 中的调试器标志**
## 📝 **项目结构**
```
📂 Project Folder
│── payloadinjector.c # Main Payload injector
│── detector.c # EDR/AV/Sandbox detection
│── evasion.c # Evasion functions (syscalls, b64decode...) and decoy
│── detector.h # Header file for detection functions
│── evasion.h # Header file for evasion functions and decoy
│── syscalls.asm # Direct Syscalls Functions
|── makefile # easy to compile
│── README.md # This documentation
│── 📂 obfs_obfuscator # Contains the obfuscators c files
│── obfuscator.c # Main program used to obfuscate the build binary
│── binary_obfuscator.c # Contains the obfuscator's functions
│── binary_obfuscator.h # Contains the obfuscator's definition
│── payloadObfuscator.c # Contains the obfuscator's payoad functions
```
## 模块说明
### **主 Payload 注入器:payloadinjector.c**
- 创建一个**挂起**的进程(`SearchProtocolHost.exe`)。
- 使用**直接 syscalls** 来分配内存、写入 payload 并隐蔽地执行 payload。
### **EDR/AV/沙箱检测:detector.c & detector.h**
- 检测 `C:\Windows\System32\drivers` 中的**常见 AV/EDR 驱动**。
- 检查特定于沙箱的 **DLL**,如 `cuckoomon.dll`、`VBox*.dll` 等。
- 使用 `NtQuerySystemInformation` 来确定环境是否为 VM。
- 实现**光标移动和 sleep patching** 以规避自动化沙箱。
### **规避函数与诱饵执行:evasion.c & evasion.h**
- 实现 **Base64 编码与解码** 以隐藏 payload 和函数名。
- **合法的诱饵执行**:注入器执行一个 CPU 密集型函数来模拟合法的软件行为。
- 使用 PEB walk 在不使用 API 的情况下检索模块中的函数。
### **直接 Syscalls:syscalls.asm**
- 使用直接 syscalls 实现 **NtAllocateVirtualMemory, NtWriteVirtualMemory**。
### **混淆器**
- 非本人作品,请参考 [Obfuscator](https://github.com/4g3nt47/Obfuscator.git)。
## **测试**
- [x] Windows 10 (22H2)
- [x] Windows 11 (11 24H2)
- [x] Windows Server 2025 (24H2)
## ⚠️ **法律免责声明**
## 📜 **参考**
- 🔗 **MITRE ATT&CK Framework**:[T1202 - Indirect Command Execution](https://attack.mitre.org/techniques/T1202/)
- 🔗 **AV & EDR 检测**:[Exe_Who GitHub](https://github.com/Nariod/exe_who)
- 🔗 **二进制混淆**:[Obfuscator](https://github.com/4g3nt47/Obfuscator.git)
🚀 **祝您 Hacking 愉快!**
标签:DNS 反向解析, EDR绕过, SSH蜜罐, 客户端加密, 进程注入, 高交互蜜罐, 高危端口监控