Nicholas-Kloster/VisorHollow

GitHub: Nicholas-Kloster/VisorHollow

VisorHollow 通过实际执行多种进程注入技术并自动查询 Sysmon 事件日志,以覆盖率矩阵精确展示当前 EDR/SIEM 配置在六层递进式攻击下的检测盲区。

Stars: 1 | Forks: 0

[![Claude Code 友好](https://img.shields.io/badge/Claude_Code-Friendly-blueviolet?logo=anthropic&logoColor=white)](https://claude.ai/code) [![Go 报告卡](https://goreportcard.com/badge/github.com/Nicholas-Kloster/VisorHollow)](https://goreportcard.com/report/github.com/Nicholas-Kloster/VisorHollow) [![许可证:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ``` Process Injection Detection Benchmark · Windows x64 github.com/Nicholas-Kloster/VisorHollow · Nuclide Research ``` **VisorHollow** 是一个基于 Go 语言的 Windows x64 进程注入技术检测基准测试工具。它执行各种注入变体,并查询 Sysmon 事件日志,以确定您的 EDR/SIEM 配置是否成功捕获了它们。针对每个事件 ID 提供通过/失败结果——而非理论推测。 **HollowCorpus** 将其扩展为一个完整的 6 层技术阶梯。只需一条命令即可运行整个阶梯,并获得一个覆盖率矩阵,准确显示您的检测堆栈在哪一层开始失效。 ## 技术 | 标志 | 技术 | 关键 API | 主要检测信号 | |------|-----------|----------|--------------------------| | `section` | NtMapViewOfSection (共享节) | NtCreateSection, NtMapViewOfSection ×2, SetThreadContext | ETW `KERNEL_THREATINT_KEYWORD_MAPVIEW`, Sysmon 事件 25 | | `classic` | VirtualAllocEx + WriteProcessMemory | VirtualAllocEx (RWX), WriteProcessMemory, CreateRemoteThread | Sysmon 事件 8 (CreateRemoteThread), 事件 10 (OpenProcess) | ### `section` — NtMapViewOfSection 变体 ``` 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`——这是大多数 EDR hook 的主要跨进程写入目标。本地→远程的节映射模式意味着 shellcode 字节永远不会通过受监控的系统调用跨越进程边界。其检测依赖于 ETW 威胁情报(`KERNEL_THREATINT_KEYWORD_MAPVIEW`)或行为关联,而非 API hook。 **残留痕迹(仍可检测):** - 匿名 RWX VAD 条目(无后备文件路径) - 线程入口点不在任何已加载的 PE 模块中 - 如果原始镜像被取消映射,会导致 PEB.ImageBaseAddress 不匹配 - Sysmon 事件 25:远程可执行文件映射上的 ProcessTampering ### `classic` — WriteProcessMemory 变体 ``` CreateProcess (suspended) → VirtualAllocEx (RWX) → WriteProcessMemory → CreateRemoteThread (start = allocated RWX region) → ResumeThread ``` 经典的注入技术。动静很大——每个 EDR 都会监控事件 8。可用作基线:如果 `classic` 未被检测到,说明您的 Sysmon 配置存在问题。 ## 构建 ``` # Windows 原生 go build -o visorhollow.exe . # 从 Linux/macOS 交叉编译 GOOS=windows GOARCH=amd64 go build -o visorhollow.exe . ``` 需要 Go 1.21 及以上版本。无 CGO 依赖。单个静态二进制文件。唯一依赖项:`golang.org/x/sys`。 ## HollowCorpus 一个 6 层的注入技术阶梯。每一层都从前一层中去除了一个检测信号,从最容易被发现的路径一直构建到完全绕过用户模式 hook。 ### 层级阶梯 | 层级 | 技术 | API | 增加的规避手段 | 预期事件 | |------|-----------|------|---------------|-----------------| | T1 | WriteProcessMemory + CreateRemoteThread | VirtualAllocEx, WPM, CRT | — | E8, E10 | | T2 | NtMapViewOfSection + SetThreadContext | NtCreateSection, NtMapViewOfSection | 无 NtWriteVirtualMemory | E10, E25 | | T3 | NtMapViewOfSection + QueueUserAPC | NtCreateSection, NtMapViewOfSection, QueueUserAPC | 无 CreateRemoteThread | E10, E25 | | T4 | 线程上下文劫持 | OpenThread, SuspendThread, WPM, STC | 无新进程,无节对象 | E10 | | T5 | 模块踩踏 | VirtualProtectEx, WPM, CRT | 无匿名 RWX VAD,对 E25 不可见 | E8, E10 | | T6 | 直接系统调用 | NtCreateSection (直接), NtMapViewOfSection (直接) | 完全绕过 ntdll 用户模式 hook | E10, E25 | ### 命令 ``` visorhollow corpus list # show all techniques with metadata visorhollow corpus run # run all 6 tiers visorhollow corpus run --tier 1-3 # run tiers 1-3 only visorhollow corpus run --id T1055-04-hijack # run a single technique by ID visorhollow corpus run --target calc.exe # use a different target process ``` ### 输出示例 ``` 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 ... ═══════════════════════════════════════════════════════════════════════ 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` 意味着您的 Sysmon/EDR 配置能捕获直到(并包括)线程劫持预期事件在内的所有内容——但 T4 本身会漏网。修复方法:为来自非系统进程且带有 `PROCESS_ALL_ACCESS` 的 `OpenProcess` 增加事件 10 覆盖,并确保为 T6 启用了 ETW 威胁情报。 ## 用法 ``` COMMANDS: hollow Inject shellcode into a spawned target process check Query Sysmon event log for post-injection detection artifacts FLAGS (hollow): --technique section | classic (default: section) --target process to spawn (default: notepad.exe) --check run check automatically after injection completes ``` ### 连续运行两种技术并自动检查 ``` visorhollow hollow --technique section --target notepad.exe --check visorhollow hollow --technique classic --target calc.exe --check ``` ### 独立运行检查(手动测试后) ``` visorhollow check --since 10m --technique section ``` ### 输出示例 ``` 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 ``` ## Sysmon 配置(最低要求) 要捕获 `section` 技术,您的 Sysmon 配置**至少**需要: ``` 0x1FFFFF ``` 对于 `classic` 技术,需添加: ``` ``` **检测缺口:** 如果没有 ProcessTampering(事件 25),仅靠 Sysmon 无法捕获 `section`——该功能在 Sysmon v13 中被加入。如果您正在运行 Sysmon v12 或更早版本,`section` 将会漏报 (MISS)。 ## Payload 默认 payload:通过 PEB 遍历 API 解析执行 `WinExec("calc.exe", SW_SHOW)`。 要使用自定义 shellcode,请替换 `payload/shellcode.go` 中的 `payload.Shellcode`: ``` var Shellcode = []byte{ // your bytes here } ``` 生成其他选项: ``` msfvenom -p windows/x64/exec CMD=calc.exe -f hex -b '\x00' msfvenom -p windows/x64/messagebox TEXT="hollow confirmed" TITLE="VisorHollow" -f hex ``` ## 检测映射 | Sysmon 事件 | 技术 | 触发条件 | |---|---|---| | 8 — CreateRemoteThread | classic | 线程创建时起始地址不在已加载的 PE 中 | | 10 — ProcessAccess | 两者皆有 | 对目标执行 OpenProcess(PROCESS_ALL_ACCESS) | | 25 — ProcessTampering | section | 通过 NtMapViewOfSection 进行远程可执行文件映射 | **ETW 覆盖范围(需要 Defender / 兼容的 EDR):** `KERNEL_THREATINT_KEYWORD_MAPVIEW` 在源进程 != 目标进程时于 NtMapViewOfSection 上触发。当 Sysmon 事件 25 不可用时,这是针对 section 技术的主要检测信号。 ## 生态系统 | 工具 | 作用 | |------|------| | [JAXEN](https://github.com/Nicholas-Kloster/JAXEN) | Shodan 抓取 + empire.db | | [VisorSD](https://github.com/Nicholas-Kloster/VisorSD) | 严重性排序的 AI/LLM 审计 | | [VisorCorpus](https://github.com/Nicholas-Kloster/VisorCorpus) | 对抗性 LLM 提示词语料库 | | [VisorPlus](https://github.com/Nicholas-Kloster/VisorPlus) | 统一的 AI/LLM 侦察协调器 | | [BARE](https://github.com/Nicholas-Kloster/BARE) | 语义漏洞匹配 | | [aimap](https://github.com/Nicholas-Kloster/aimap) | AI/ML 服务枚举器 | ## 与 Claude Code 配合使用 Claude Code 可以交叉编译 VisorHollow,解读 HollowCorpus 覆盖率矩阵,并将检测缺口映射为具体的 Sysmon 配置修复方案。 ``` Cross-compile VisorHollow for Windows with `GOOS=windows GOARCH=amd64 go build -o visorhollow.exe .`. Once I run it and paste the HollowCorpus coverage matrix, analyze every MISS: identify which Sysmon event ID is absent, what the missing coverage means for an attacker, and provide the exact Sysmon XML rule block that would close each gap. ``` ``` I have VisorHollow output showing T4 and T6 as the first undetected tiers. Explain the precise detection gap at each tier — what the attacker's technique removes from the signal chain — and recommend whether to address it via Sysmon config, ETW Threat Intelligence, or EDR behavioral rules. ``` ## 许可证 MIT — 参见 [LICENSE](LICENSE)
标签:AMSI绕过, Conpot, EDR测试, ETW, EVTX分析, Go语言, NtMapViewOfSection, SSH蜜罐, Sysmon, Windows安全, WriteProcessMemory, 事件日志, 威胁检测, 安全技术, 数据展示, 日志审计, 检测基准, 程序破解, 端点可见性, 红队, 覆盖率测试, 进程注入