nuclide-research/VisorHollow
GitHub: nuclide-research/VisorHollow
VisorHollow是一款用于Windows x64进程注入检测的基准工具。
Stars: 1 | Forks: 0
# VisorHollow
Windows x64进程注入检测基准:执行两种注入变体,并查询Sysmon事件日志以获取每个事件ID的HIT/MISS。
VisorHollow将shellcode注入到生成的目标进程中,然后询问Sysmon是否注意到。它实现了两种技术(`section`和`classic`),检查Sysmon事件8、10和25,并打印一个基准表,显示哪些事件已触发。HollowCorpus将其扩展到六级阶梯,从最响亮的可能注入路径到直接系统调用EDR绕过,生成一个覆盖矩阵,显示您的检测堆栈在哪个层级停止捕获。
**仅限Windows x64。** 注入和Sysmon查询代码使用Windows API,仅构建`GOOS=windows`。支持从Linux或macOS交叉编译,但生成的二进制文件必须在Windows主机上运行。
## 技术方法
| 标志 | 技术 | 关键API | 检测信号 |
|------|-----------|----------|-------------------|
| `section` | NtMapViewOfSection变体 | NtCreateSection, NtMapViewOfSection x2, SetThreadContext, ResumeThread | ETW `KERNEL_THREATINT_KEYWORD_MAPVIEW`, Sysmon E25, E10 |
| `classic` | VirtualAllocEx + WriteProcessMemory | VirtualAllocEx (RWX), WriteProcessMemory, CreateRemoteThread | Sysmon E8, E10 |
### 章节
```
CreateProcess (suspended)
-> NtCreateSection (anonymous, pagefile-backed, RWX)
-> NtMapViewOfSection -> current process (local RWX mapping)
-> memcpy shellcode into local mapping
-> NtMapViewOfSection -> target process (remote RX mapping)
-> SetThreadContext: RIP = remote mapping address
-> ResumeThread
```
完全避免`NtWriteVirtualMemory`。检测依赖于ETW威胁情报(`KERNEL_THREATINT_KEYWORD_MAPVIEW`)或Sysmon E25(ProcessTampering,在Sysmon v13中添加)。E25需要Sysmon v13+;如果没有它,`section`技术在该信号上为MISS。
### 经典
```
CreateProcess (suspended)
-> VirtualAllocEx (RWX)
-> WriteProcessMemory
-> CreateRemoteThread (start = RWX region)
-> ResumeThread
```
标准技术。在E8上很响亮。作为基线很有用:如果`classic`是MISS,则Sysmon配置已损坏。
## 安装
```
# Windows 原生
go build -o visorhollow.exe .
# 从 Linux 或 macOS 跨编译
GOOS=windows GOARCH=amd64 go build -o visorhollow.exe .
```
Go 1.21+. 单个依赖项:`golang.org/x/sys`。无CGO。
## 使用
```
visorhollow [flags]
COMMANDS:
hollow Inject shellcode into a spawned target process
check Query Sysmon event log for post-injection detection artifacts
corpus Run the full injection technique ladder and output a coverage matrix
```
### hollow标志
| 标志 | 默认值 | 影响 |
|------|---------|--------|
| `--technique` | `section` | `section`或`classic` |
| `--target` | `notepad.exe` | 要生成并注入到其中的进程 |
| `--check` | false | 注入后自动查询Sysmon |
```
visorhollow hollow --technique section --target notepad.exe --check
visorhollow hollow --technique classic --target calc.exe
```
### check标志
| 标志 | 默认值 | 影响 |
|------|---------|--------|
| `--since` | `5m` | 向后查看此持续时间(例如`10m`、`1h`) |
| `--technique` | `section` | 设置预期事件集:`section`或`classic` |
```
visorhollow check --since 10m --technique section
```
### corpus子命令
```
visorhollow corpus list list all 6 techniques with metadata
visorhollow corpus run run all 6 tiers
visorhollow corpus run --tier 1-3 run tiers 1 through 3
visorhollow corpus run --id T1055-04-hijack run one technique by ID
visorhollow corpus run --target calc.exe use a different target process
```
## HollowCorpus阶梯
六种技术,每种技术都从上一级中删除一个检测信号:
| 级别 | ID | 技术 | ExpectEvents | 避免添加 |
|------|----|-----------|--------------|---------------|
| T1 | T1055-01-classic | WriteProcessMemory + CreateRemoteThread | E8, E10 | (基线) |
| T2 | T1055-02-section | NtMapViewOfSection + SetThreadContext | E10, E25 | 无NtWriteVirtualMemory |
| T3 | T1055-03-apc | NtMapViewOfSection + QueueUserAPC | E10, E25 | 无CreateRemoteThread |
| T4 | T1055-04-hijack | 线程上下文劫持(现有线程) | E10 | 无新进程,无section对象 |
| T5 | T1055-05-stomp | 模块踩踏(DLL .text覆盖) | E8, E10 | 无匿名RWX VAD,E25盲 |
| T6 | T1055-06-direct-syscall | 直接系统调用 | E10, E25 | 完全绕过ntdll用户模式钩子 |
## 示例输出
### 使用 --check 进行 hollow
```
VisorHollow — injection starting
[technique] NtMapViewOfSection
[target] notepad.exe
[payload] 271 bytes
[spawned] PID 4812 TID 4816 (suspended)
[section] handle 0x6c
[local map] 0x22b0a4e0000 (RWX, 271 bytes)
[copied] shellcode written to local mapping
[remote map] 0x22b0a4e0000 (RX, PID 4812)
[ctx] RIP -> 0x22b0a4e0000
[resumed] PID 4812 executing at 0x22b0a4e0000
[done] injection complete
[check] waiting 3s for Sysmon events to flush...
Detection Benchmark Results
───────────────────────────────────────────────────────────────
EvtID STATUS COUNT DESCRIPTION
───────────────────────────────────────────────────────────────
10 HIT 1 OpenProcess access from injector (Event 10)
25 HIT 1 Process tampering / remote mapping detected (Event 25)
───────────────────────────────────────────────────────────────
[RESULT] ALL DETECTED — EDR/Sysmon config is catching this technique
```
### 语料库运行覆盖率矩阵
```
HollowCorpus run — 6 techniques — target: notepad.exe
[1/6] T1: WriteProcessMemory + CreateRemoteThread
E8 HIT
E10 HIT
[2/6] T2: NtMapViewOfSection + SetThreadContext
E10 HIT
E25 HIT
[3/6] T3: NtMapViewOfSection + QueueUserAPC
E10 HIT
E25 HIT
[4/6] T4: Thread Context Hijacking
E10 MISS
[5/6] T5: Module Stomping (DLL .text overwrite)
E8 HIT
E10 HIT
[6/6] T6: Direct Syscall (bypass ntdll hooks)
E10 MISS
E25 MISS
═══════════════════════════════════════════════════════════════════════
HollowCorpus Detection Coverage Matrix
═══════════════════════════════════════════════════════════════════════
Tier Technique E8 E10 E25 Score
───────────────────────────────────────────────────────────────────────
T1 WriteProcessMemory + CreateRemoteThread HIT HIT --- 2/2
T2 NtMapViewOfSection + SetThreadContext --- HIT HIT 2/2
T3 NtMapViewOfSection + QueueUserAPC --- HIT HIT 2/2
T4 Thread Context Hijacking --- MISS --- 0/1
T5 Module Stomping (DLL .text overwrite) HIT HIT --- 2/2
T6 Direct Syscall (bypass ntdll hooks) --- MISS MISS 0/2
───────────────────────────────────────────────────────────────────────
Total coverage: 7/10 events detected
[RESULT] First undetected tier: T4
Techniques at T4+ evade your current detection stack.
═══════════════════════════════════════════════════════════════════════
```
`First undetected tier: T4`表示T1-T3都触发了预期的事件,但T4通过了。T5再次被检测到,因为模块踩踏重新引入了E8和E10;T6(直接系统调用)完全绕过了ntdll用户模式钩子,是最难捕获的层级。
## 检测事件参考
| 事件 | 技术 | 触发它的是什么 |
|-------|-----------|-----------------|
| E8 - CreateRemoteThread | classic, stomp | 线程创建,起始地址在已加载的PE之外 |
| E10 - ProcessAccess | 两者 | 从注入器使用`PROCESS_ALL_ACCESS`打开进程 |
| E25 - ProcessTampering | section, apc, direct-syscall | 通过NtMapViewOfSection远程映射可执行文件 |
ETW `KERNEL_THREATINT_KEYWORD_MAPVIEW`在NtMapViewOfSection时触发,当源进程与目标进程不同时。需要Defender或具有ETW威胁情报功能的兼容EDR。
## 最小Sysmon配置
对于`section`技术:
```
0x1FFFFF
```
对于`classic`技术,添加:
```
```
## 默认有效负载
`WinExec("calc.exe", SW_SHOW")`通过PEB-walk API解析。将`payload.Shellcode`在`payload/shellcode.go`中替换为自定义shellcode。
## VisorHollow不是什么
VisorHollow测试主机层检测(Sysmon/EDR)。它不发现攻击面,不提供对抗性提示,也不在Linux或macOS目标上运行。代理信任边界层是VisorAgent;被动侦察层是VisorRAG。VisorHollow是这些工具的Windows检测工程的对应工具。
## 许可证
MIT。NuClide工具链的一部分。联系:[nuclide-research.com](https://nuclide-research.com)
标签:EVTX分析, 日志审计, 端点可见性