mabj/anti
GitHub: mabj/anti
系统性收录 74 种 Windows 平台反调试与反沙箱技术的 PoC 合集,为恶意软件分析和逆向工程提供教育参考。
Stars: 5 | Forks: 0
# 反分析技术合集
[](https://opensource.org/licenses/MIT)
[](https://en.wikipedia.org/wiki/C_(programming_language))
[](https://www.microsoft.com/windows)
[]()
[](anti-debugging/)
[](anti-sandbox/)
## 关于
本仓库记录了在恶意软件研究和逆向工程过程中发现的 74 种真实的反分析技术。每项技术都作为一个独立的 PoC 实现,并附带源代码、构建说明和详细文档。
**目的**:作为了解恶意软件如何逃避检测和分析工具的教育资源。
**受众**:安全研究人员、恶意软件分析师、逆向工程师和防御性安全专业人士。
**技术分类**:
- 🛡️ **Anti-Debugging**(60 项技术):检测调试器并防止调试
- 🔍 **Anti-Sandbox**(14 项技术):检测沙箱、虚拟机 (VM) 和自动化分析
- 🔒 **Anti-Reversing**(0 项技术):预留给未来的代码保护技术
## 目录
- [反分析技术合集](#anti-analysis-technique-collection)
- [关于](#about)
- [目录](#table-of-contents)
- [快速入门](#quick-start)
- [技术类别](#technique-categories)
- [类别说明](#category-descriptions)
- [技术索引](#technique-index)
- [构建技术](#building-techniques)
- [构建系统概述](#build-system-overview)
- [Docker + MinGW(推荐)](#docker--mingw-recommended)
- [通用构建流程](#general-build-process)
- [构建要求](#build-requirements)
- [疑难解答](#troubleshooting)
- [贡献](#contributing)
- [许可证](#license)
- [资源](#resources)
- [反分析参考资料](#anti-analysis-references)
- [Microsoft 文档](#microsoft-documentation)
- [免责声明](#disclaimer)
## 快速入门
各项技术按类别组织在专门的目录中:
- `anti-debugging/` - 60 项用于检测调试器的技术
- `anti-sandbox/` - 14 项用于检测沙箱和虚拟机的技术
- `anti-reversing/` - 预留给未来的反逆向技术
每项技术都位于其独立的目录中,并带有类别前缀(例如,`anti-sandbox/AS001_SetErrorMode/`,`anti-debugging/AD002_IsDebuggerPresent/`)。要探索某项技术:
1. 导航至类别目录,然后进入技术子目录
2. 阅读 `README.md` 以获取详细说明
3. 查看源代码
4. 按照该技术 README 中的构建说明进行操作
5. 在安全、隔离的环境中测试
## 技术类别
本合集将反分析技术组织为三个主要类别:
```
graph TB
A[Anti-Analysis Techniques
74 Total] --> B[Anti-Debugging
60 techniques
81.1%] A --> C[Anti-Sandbox
14 techniques
18.9%] A --> D[Anti-Reversing
0 techniques
0%] B --> B1[PEB/Process Checks] B --> B2[Exception-Based Detection] B --> B3[Memory/Breakpoint Detection] B --> B4[Self-Protection] C --> C1[Environment Detection] C --> C2[VM/Sandbox Artifacts] C --> C3[Timing Checks] D --> D1[Future: Code Obfuscation] D --> D2[Future: Anti-Disassembly] style A fill:#4A90E2,stroke:#2E5C8A,stroke-width:3px,color:#fff style B fill:#E74C3C,stroke:#C0392B,stroke-width:2px,color:#fff style C fill:#F39C12,stroke:#D68910,stroke-width:2px,color:#fff style D fill:#9B59B6,stroke:#7D3C98,stroke-width:2px,color:#fff ``` ### 类别说明 - **Anti-Debugging**(60 项技术):检测附加到进程或监视进程的调试器的技术。包括 PEB 检查、基于异常的检测、断点扫描和自我保护机制。 - **Anti-Sandbox**(14 项技术):检测系统中的自动化分析环境、虚拟机、沙箱或分析工具的技术。包括环境检查、虚拟机特征检测和基于时间的检测。 - **Anti-Reversing**(0 项技术):预留给未来通过代码混淆、反汇编、控制流平坦化或其他代码保护机制来主动阻碍逆向工程的技术。目前尚未实现任何技术。 有关详细的分类和可视化图表,请参阅 [docs/diagrams/taxonomy.md](docs/diagrams/taxonomy.md) ## 技术索引 | ID | 技术名称 | 类别 | 平台 | 描述 | | --- | --- | --- | --- | --- | | **Anti-Sandbox** | | | | | | [AS001](anti-sandbox/AS001_SetErrorMode/) | SetErrorMode | Anti-Sandbox | Windows | 通过检查 SetErrorMode 的行为来检测是否存在 Hook,从而检测沙箱 | | [AS002](anti-sandbox/AS002_ForcedRaceConditionSleep/) | Forced Race Condition Sleep | Anti-Sandbox | Windows | 强制产生竞争条件以检测 sleep() 行为的变化 | | [AS003](anti-sandbox/AS003_CheckProcessList/) | Check Process List | Anti-Sandbox | Windows | 扫描进程列表以查找已知的分析工具名称 | | [AS004](anti-sandbox/AS004_CheckLoadedModules/) | Check Loaded Modules | Anti-Sandbox | Windows | 检测当前进程中由分析工具注入的 DLL | | [AS005](anti-sandbox/AS005_CheckRegistryKeys/) | Check Device Names | Anti-Sandbox | Windows | 在 Windows 注册表中搜索与虚拟机相关的设备名称 | | [AS006](anti-sandbox/AS006_CopyOfNtdll/) | Copy of ntdll.dll | Anti-Sandbox | Windows | 加载干净的 ntdll.dll 副本以绕过被 Hook 的函数 | | [AS007](anti-sandbox/AS007_SetTimer/) | SetTimer | Anti-Sandbox | Windows | 使用消息驱动的定时器绕过沙箱的时间加速 | | [AS008](anti-sandbox/AS008_BlockInput/) | BlockInput | Anti-Sandbox | Windows | 通过分析 BlockInput 的行为来检测 API Hook | | [AS009](anti-sandbox/AS009_NtDelayExecution/) | NtDelayExecution | Anti-Sandbox | Windows | 通过原生 API 引入较长的执行延迟来逃避沙箱分析 | | [AS010](anti-sandbox/AS010_WaitForSingleObject/) | WaitForSingleObject | Anti-Sandbox | Windows | 利用事件同步超时来绕过沙箱的时间加速 | | [AS011](anti-sandbox/AS011_CreateWaitableTimer/) | CreateWaitableTimer | Anti-Sandbox | Windows | 使用高精度可等待定时器来逃避沙箱的时间加速 | | [AS012](anti-sandbox/AS012_CreateTimerQueueTimer/) | CreateTimerQueueTimer | Anti-Sandbox | Windows | 利用定时器队列回调来绕过沙箱的时间加速 | | [AS013](anti-sandbox/AS013_SleepLoop/) | Sleep Loop | Anti-Sandbox | Windows | 通过将延迟拆分为多次较短的 Sleep 调用来逃避沙箱的时间加速 | | [AS014](anti-sandbox/AS014_RtlSetProcessIsCritical/) | RtlSetProcessIsCritical | Anti-Sandbox | Windows | 通过验证进程的关键标志是否确实被设置来检测 API Hook | | **Anti-Debugging** | | | | | | [AD001](anti-debugging/AD001_CheckProcessDebugPort/) | Check Process Debug Port | Anti-Debugging | Windows | 通过 NtQueryInformationProcess 查询 ProcessDebugPort | | [AD002](anti-debugging/AD002_IsDebuggerPresent/) | IsDebuggerPresent | Anti-Debugging | Windows | 使用 IsDebuggerPresent API 检查 PEB 调试标志 | | [AD003](anti-debugging/AD003_CheckRemoteDebuggerPresent/) | CheckRemoteDebuggerPresent | Anti-Debugging | Windows | 检测附加到特定进程的调试器 | | [AD004](anti-debugging/AD004_ProcessDebugObjectHandle/) | ProcessDebugObjectHandle | Anti-Debugging | Windows | 查询 ProcessDebugObjectHandle 以检测调试 | | [AD005](anti-debugging/AD005_CheckPEB/) | Check PEB | Anti-Debugging | Windows | 直接检查 PEB 结构中的调试标志 | | [AD006](anti-debugging/AD006_SetUnhandledExceptionFilter/) | SetUnhandledExceptionFilter | Anti-Debugging | Windows | 检测调试器对异常处理链的接管 | | [AD007](anti-debugging/AD007_CloseHandle/) | CloseHandle Exception | Anti-Debugging | Windows | 检查 CloseHandle 在遇到无效句柄时是否引发异常 | | [AD008](anti-debugging/AD008_SetHandleInformation/) | SetHandleInformation | Anti-Debugging | Windows | 滥用 HANDLE_FLAG_PROTECT_FROM_CLOSE 来检测调试器 | | [AD009](anti-debugging/AD009_RtlQueryProcessHeapInformation/) | RtlQueryProcessHeapInformation | Anti-Debugging | Windows | 通过检查堆标志来检测调试器 | | [AD010](anti-debugging/AD010_RtlQueryProcessDebugInformation/) | RtlQueryProcessDebugInformation | Anti-Debugging | Windows | 通过 RtlQueryProcessDebugInformation 检查堆标志 | | [AD011](anti-debugging/AD011_DbgPrint/) | DbgPrint Exception | Anti-Debugging | Windows | 通过 DbgPrint 异常行为检测调试器 | | [AD012](anti-debugging/AD012_GetWriteWatch/) | GetWriteWatch | Anti-Debugging | Windows | 监控受保护内存,查看是否被调试器修改 | | [AD013](anti-debugging/AD013_GetThreadContext/) | GetThreadContext | Anti-Debugging | Windows | 检查硬件断点寄存器 (Dr0-Dr7) | | [AD014](anti-debugging/AD014_NtSetInformationThread/) | NtSetInformationThread | Anti-Debugging | Windows | 使用 ThreadHideFromDebugger 对调试器隐藏线程 | | [AD015](anti-debugging/AD015_NtQueryObject/) | NtQueryObject | Anti-Debugging | Windows | 枚举对象类型以查找 DebugObject | | [AD016](anti-debugging/AD016_RaiseException/) | RaiseException DBG_CONTROL_C | Anti-Debugging | Windows | 抛出 DBG_CONTROL_C 以检测异常拦截 | | [AD017](anti-debugging/AD017_SoftwareBreakpoint/) | Memory Breakpoint INT3 | Anti-Debugging | Windows | 扫描函数内存以查找断点 (0xCC) | | [AD018](anti-debugging/AD018_AntiStepOver/) | Anti-Step-Over | Anti-Debugging | Windows | 检查函数返回地址处是否存在断点 | | [AD019](anti-debugging/AD019_MemoryBreakpoint/) | Guard Page | Anti-Debugging | Windows | 使用保护页异常来检测调试器 | | [AD020](anti-debugging/AD020_NtQueryVirtualMemory_WorkingSetList/) | NtQueryVirtualMemory WorkingSetList | Anti-Debugging | Windows | 检查工作集页面属性是否被修改 | | [AD021](anti-debugging/AD021_DbgBreakPoint_patch/) | DbgBreakPoint Patch | Anti-Debugging | Windows | 修补 DbgBreakPoint 以阻止调试器附加 | | [AD022](anti-debugging/AD022_DbgUiRemoteBreakin_hook/) | DbgUiRemoteBreakin Hook | Anti-Debugging | Windows | 修补 DbgUiRemoteBreakin 以阻止调试器附加 | | [AD023](anti-debugging/AD023_INT3/) | INT3 (0xC3) | Anti-Debugging | Windows | 结合 INT3 指令使用向量异常处理 | | [AD024](anti-debugging/AD024_INT3_long/) | INT3 Long Form (0xCD03) | Anti-Debugging | Windows | 使用 INT3 的长指令格式进行调试器检测 | | [AD025](anti-debugging/AD025_INT2D/) | INT 2D | Anti-Debugging | Windows | 用于检测的内核调试器中断 | | [AD026](anti-debugging/AD026_INT1/) | INT1 ICEBP (0xF1) | Anti-Debugging | Windows | 使用 ICEBP 指令进行调试器检测 | | [AD027](anti-debugging/AD027_INT1_long/) | INT1 Long Form (0xCD01) | Anti-Debugging | Windows | 使用 INT 1 的双字节格式进行检测 | | [AD028](anti-debugging/AD028_popfd_trap/) | POPFD Trap Flag | Anti-Debugging | Windows | 通过 POPFD 操纵 Trap Flag 以触发单步执行 | | [AD029](anti-debugging/AD029_INT1_prefix/) | INT1 with Prefixes | Anti-Debugging | Windows | 在 ICEBP 之前使用指令前缀 | | [AD030](anti-debugging/AD030_self_debugging/) | Self-Debugging | Anti-Debugging | Windows | 尝试调试自身以检测已存在的调试器 | | [AD031](anti-debugging/AD031_GenerateConsoleCtrlEvent/) | GenerateConsoleCtrlEvent | Anti-Debugging | Windows | 通过检查控制台控制事件处理来检测调试器 | | [AD032](anti-debugging/AD032_GetShellWindow/) | GetShellWindow | Anti-Debugging | Windows | 将父 PID 与 Explorer 进行比较以检测异常执行 | | [AD033](anti-debugging/AD033_FindWindow/) | FindWindow | Anti-Debugging | Windows | 通过搜索已知的窗口类名来检测调试器 | | [AD034](anti-debugging/AD034_SwitchDesktop/) | SwitchDesktop | Anti-Debugging | Windows | 通过切换到新的桌面将进程对调试器隐藏 | | [AD035](anti-debugging/AD035_GetLocalTime/) | GetLocalTime | Anti-Debugging | Windows | 通过测量已知工作负载的运行时间来检测调试器 | | [AD036](anti-debugging/AD036_GetSystemTime/) | GetSystemTime | Anti-Debugging | Windows | 通过对已知工作负载进行 UTC 时间分析来检测调试器 | | [AD037](anti-debugging/AD037_GetTickCount/) | GetTickCount | Anti-Debugging | Windows | 通过比较工作负载前后的毫秒级滴答计数来检测调试器 | | [AD038](anti-debugging/AD038_QueryPerformanceCounter/) | QueryPerformanceCounter | Anti-Debugging | Windows | 使用高分辨率性能计数器计时来检测调试器 | | [AD039](anti-debugging/AD039_timeGetTime/) | timeGetTime | Anti-Debugging | Windows | 使用多媒体定时器分析来检测调试器 | | [AD040](anti-debugging/AD040_ProcessDebugFlags/) | ProcessDebugFlags | Anti-Debugging | Windows | 通过 NtQueryInformationProcess 查询 ProcessDebugFlags | | [AD041](anti-debugging/AD041_NtGlobalFlag/) | NtGlobalFlag | Anti-Debugging | Windows | 检查 PEB NtGlobalFlag 中由调试器设置的堆调试标志 | | [AD042](anti-debugging/AD042_HeapFlags/) | HeapFlags | Anti-Debugging | Windows | 检查堆 Flags 和 ForceFlags 是否包含调试器设置的值 | | [AD043](anti-debugging/AD043_RDTSC/) | RDTSC | Anti-Debugging | Windows | 使用 CPU 时间戳计数器周期测量来检测调试器 | | [AD044](anti-debugging/AD044_OpenProcess_CSRSS/) | OpenProcess CSRSS | Anti-Debugging | Windows | 通过尝试打开受保护的 csrss.exe 进程来检测具有提升权限的调试器 | | [AD045](anti-debugging/AD045_CodeChecksum/) | Code Checksum | Anti-Debugging | Windows | 持续监控函数校验和以检测断点或代码补丁 | | [AD046](anti-debugging/AD046_CreateFileA_Exclusive/) | CreateFileA Exclusive | Anti-Debugging | Windows | 通过尝试对当前可执行文件进行独占文件访问来检测调试器 | | [AD047](anti-debugging/AD047_SystemKernelDebuggerInformation/) | SystemKernelDebuggerInformation | Anti-Debugging | Windows | 通过查询系统内核调试器标志来检测内核态调试器 | | [AD048](anti-debugging/AD048_LoadLibrary/) | LoadLibrary | Anti-Debugging | Windows | 通过对可执行文件执行 LoadLibraryA 后的文件句柄行为来检测调试器 | | [AD049](anti-debugging/AD049_DetectAPIPatch/) | DetectAPIPatch | Anti-Debugging | Windows | 通过比较跨进程的 API 函数字节来检测调试器 | | [AD050](anti-debugging/AD050_KUSER_SHARED_DATA/) | KUSER_SHARED_DATA | Anti-Debugging | Windows | 从 KUSER_SHARED_DATA 读取 KdDebuggerEnabled 以检测内核调试器 | | [AD051](anti-debugging/AD051_HEAP_TAIL_CHECKING_ENABLED/) | HEAP_TAIL_CHECKING_ENABLED | Anti-Debugging | Windows | 通过检查 0xABABABAB 堆尾部哨兵模式来检测调试器 | | [AD052](anti-debugging/AD052_InstructionCounting/) | Instruction Counting | Anti-Debugging | Windows | 通过计算硬件断点单步执行异常的次数来检测调试器 | | [AD053](anti-debugging/AD053_StackSegment/) | Stack Segment Register | Anti-Debugging | Windows | 通过 SS 寄存器的陷阱抑制来检测单步执行的调试器 | | [AD054](anti-debugging/AD054_EnumWindowsProc/) | EnumWindowsProc | Anti-Debugging | Windows | 通过枚举具有已知工具标题的窗口来检测调试器 | | [AD055](anti-debugging/AD055_DbgSetDebugFilterState/) | DbgSetDebugFilterState | Anti-Debugging | Windows | 通过 NtSetDebugFilterState 的成功执行状态来检测内核调试器 | | [AD056](anti-debugging/AD056_SwitchToThread/) | SwitchToThread | Anti-Debugging | Windows | 利用单步执行期间的线程调度程序行为来检测调试器 | | [AD057](anti-debugging/AD057_TLSCallback/) | TLS Callback | Anti-Debugging | Windows | 使用 Thread Local Storage 回调在主入口点之前执行代码 | | [AD058](anti-debugging/AD058_ProcessJob/) | Process Job | Anti-Debugging | Windows | 通过枚举作业对象中的进程来检测调试器 | | [AD059](anti-debugging/AD059_WudfIsAnyDebuggerPresent/) | WudfIsAnyDebuggerPresent | Anti-Debugging | Windows | 通过 WudfPlatform.dll 中未公开的 UMDF 平台 API 检测调试器 | | [AD060](anti-debugging/AD060_LowFragmentationHeap/) | LowFragmentationHeap | Anti-Debugging | Windows | 通过低碎片堆的前端分配器状态来检测调试器 | ## 构建技术 大多数技术包括: - **源代码**(位于 `src/` 目录中的 `main.c` 或类似文件) - 用于编译的 **Makefile** - 用于容器化构建的 **Dockerfile** - 包含详细说明和参考资料的 **README** ### 构建系统概述 本项目使用 **混合构建系统** 以满足不同的编译需求: #### Docker + MinGW(推荐) 大多数技术使用 Docker 配合 MinGW 交叉编译器进行一致性构建: ``` # 构建 Docker image make build-image # 编译 technique(同时构建 x86 和 x64) make build # 或者如果你已经安装了 MinGW,可以直接 build make ``` 输出的二进制文件放置在 `bin/` 目录中。 ### 通用构建流程 1. **导航至技术目录**: cd anti-sandbox/AS001_SetErrorMode/ # 或 cd anti-debugging/AD002_IsDebuggerPresent/ 2. 在该技术的 README 中**检查构建要求** 3. **使用 Docker 构建**(适用于大多数技术): make build-image # 仅第一次需要 make build 4. **或使用 MinGW 构建**(如果已安装): make 5. 在 `bin/` 目录中**找到编译后的二进制文件** ### 构建要求 - **Docker**:用于容器化构建(推荐) - **MinGW-w64**:用于在 Linux/Mac 上原生构建 Windows 程序 - **GNU Make**:构建自动化工具 ### 疑难解答 - **Docker 不可用**:安装 MinGW 交叉编译器并直接构建 - **MinGW 不可用**:使用 Docker 进行隔离构建 - **构建失败**:检查各个技术的 README 以了解具体要求 - **缺少依赖项**:某些技术可能需要额外的库 有关具体的构建要求和平台兼容性,请参阅各项技术的 README。 ## 许可证 本项目基于 MIT 许可证授权 - 有关详细信息,请参阅 [LICENSE](LICENSE) 文件。 ## 资源 ### 反分析参考资料 - [CheckPoint 反调试技术](https://anti-debug.checkpoint.com/) - [Al-Khaser 反恶意软件扫描器](https://github.com/LordNoteworthy/al-khaser) - [恶意软件分析训练营](https://www.malwaretech.com/) - [终极反调试参考](https://pferrie.epizy.com/papers/antidebug.pdf?i=1) - [Apriorit 带示例的反调试技术](https://www.apriorit.com/dev-blog/367-anti-reverse-engineering-protection-techniques-to-use-before-releasing-software) ### Microsoft 文档 - [Windows API 文档](https://docs.microsoft.com/en-us/windows/win32/api/) - [未公开的 NT 内部结构](http://undocumented.ntinternals.net/) ## 免责声明 本仓库**仅供教育和研究用途**。此处记录的技术是恶意软件作者用来逃避检测的手段。了解这些技术有助于安全专业人士构建更好的防御体系。 **请勿将这些技术用于恶意目的。** **注意**:某些技术可能无法在所有 Windows 版本或所有调试器上运行。在适用的地方,各项技术的文档中均包含了兼容性说明。
74 Total] --> B[Anti-Debugging
60 techniques
81.1%] A --> C[Anti-Sandbox
14 techniques
18.9%] A --> D[Anti-Reversing
0 techniques
0%] B --> B1[PEB/Process Checks] B --> B2[Exception-Based Detection] B --> B3[Memory/Breakpoint Detection] B --> B4[Self-Protection] C --> C1[Environment Detection] C --> C2[VM/Sandbox Artifacts] C --> C3[Timing Checks] D --> D1[Future: Code Obfuscation] D --> D2[Future: Anti-Disassembly] style A fill:#4A90E2,stroke:#2E5C8A,stroke-width:3px,color:#fff style B fill:#E74C3C,stroke:#C0392B,stroke-width:2px,color:#fff style C fill:#F39C12,stroke:#D68910,stroke-width:2px,color:#fff style D fill:#9B59B6,stroke:#7D3C98,stroke-width:2px,color:#fff ``` ### 类别说明 - **Anti-Debugging**(60 项技术):检测附加到进程或监视进程的调试器的技术。包括 PEB 检查、基于异常的检测、断点扫描和自我保护机制。 - **Anti-Sandbox**(14 项技术):检测系统中的自动化分析环境、虚拟机、沙箱或分析工具的技术。包括环境检查、虚拟机特征检测和基于时间的检测。 - **Anti-Reversing**(0 项技术):预留给未来通过代码混淆、反汇编、控制流平坦化或其他代码保护机制来主动阻碍逆向工程的技术。目前尚未实现任何技术。 有关详细的分类和可视化图表,请参阅 [docs/diagrams/taxonomy.md](docs/diagrams/taxonomy.md) ## 技术索引 | ID | 技术名称 | 类别 | 平台 | 描述 | | --- | --- | --- | --- | --- | | **Anti-Sandbox** | | | | | | [AS001](anti-sandbox/AS001_SetErrorMode/) | SetErrorMode | Anti-Sandbox | Windows | 通过检查 SetErrorMode 的行为来检测是否存在 Hook,从而检测沙箱 | | [AS002](anti-sandbox/AS002_ForcedRaceConditionSleep/) | Forced Race Condition Sleep | Anti-Sandbox | Windows | 强制产生竞争条件以检测 sleep() 行为的变化 | | [AS003](anti-sandbox/AS003_CheckProcessList/) | Check Process List | Anti-Sandbox | Windows | 扫描进程列表以查找已知的分析工具名称 | | [AS004](anti-sandbox/AS004_CheckLoadedModules/) | Check Loaded Modules | Anti-Sandbox | Windows | 检测当前进程中由分析工具注入的 DLL | | [AS005](anti-sandbox/AS005_CheckRegistryKeys/) | Check Device Names | Anti-Sandbox | Windows | 在 Windows 注册表中搜索与虚拟机相关的设备名称 | | [AS006](anti-sandbox/AS006_CopyOfNtdll/) | Copy of ntdll.dll | Anti-Sandbox | Windows | 加载干净的 ntdll.dll 副本以绕过被 Hook 的函数 | | [AS007](anti-sandbox/AS007_SetTimer/) | SetTimer | Anti-Sandbox | Windows | 使用消息驱动的定时器绕过沙箱的时间加速 | | [AS008](anti-sandbox/AS008_BlockInput/) | BlockInput | Anti-Sandbox | Windows | 通过分析 BlockInput 的行为来检测 API Hook | | [AS009](anti-sandbox/AS009_NtDelayExecution/) | NtDelayExecution | Anti-Sandbox | Windows | 通过原生 API 引入较长的执行延迟来逃避沙箱分析 | | [AS010](anti-sandbox/AS010_WaitForSingleObject/) | WaitForSingleObject | Anti-Sandbox | Windows | 利用事件同步超时来绕过沙箱的时间加速 | | [AS011](anti-sandbox/AS011_CreateWaitableTimer/) | CreateWaitableTimer | Anti-Sandbox | Windows | 使用高精度可等待定时器来逃避沙箱的时间加速 | | [AS012](anti-sandbox/AS012_CreateTimerQueueTimer/) | CreateTimerQueueTimer | Anti-Sandbox | Windows | 利用定时器队列回调来绕过沙箱的时间加速 | | [AS013](anti-sandbox/AS013_SleepLoop/) | Sleep Loop | Anti-Sandbox | Windows | 通过将延迟拆分为多次较短的 Sleep 调用来逃避沙箱的时间加速 | | [AS014](anti-sandbox/AS014_RtlSetProcessIsCritical/) | RtlSetProcessIsCritical | Anti-Sandbox | Windows | 通过验证进程的关键标志是否确实被设置来检测 API Hook | | **Anti-Debugging** | | | | | | [AD001](anti-debugging/AD001_CheckProcessDebugPort/) | Check Process Debug Port | Anti-Debugging | Windows | 通过 NtQueryInformationProcess 查询 ProcessDebugPort | | [AD002](anti-debugging/AD002_IsDebuggerPresent/) | IsDebuggerPresent | Anti-Debugging | Windows | 使用 IsDebuggerPresent API 检查 PEB 调试标志 | | [AD003](anti-debugging/AD003_CheckRemoteDebuggerPresent/) | CheckRemoteDebuggerPresent | Anti-Debugging | Windows | 检测附加到特定进程的调试器 | | [AD004](anti-debugging/AD004_ProcessDebugObjectHandle/) | ProcessDebugObjectHandle | Anti-Debugging | Windows | 查询 ProcessDebugObjectHandle 以检测调试 | | [AD005](anti-debugging/AD005_CheckPEB/) | Check PEB | Anti-Debugging | Windows | 直接检查 PEB 结构中的调试标志 | | [AD006](anti-debugging/AD006_SetUnhandledExceptionFilter/) | SetUnhandledExceptionFilter | Anti-Debugging | Windows | 检测调试器对异常处理链的接管 | | [AD007](anti-debugging/AD007_CloseHandle/) | CloseHandle Exception | Anti-Debugging | Windows | 检查 CloseHandle 在遇到无效句柄时是否引发异常 | | [AD008](anti-debugging/AD008_SetHandleInformation/) | SetHandleInformation | Anti-Debugging | Windows | 滥用 HANDLE_FLAG_PROTECT_FROM_CLOSE 来检测调试器 | | [AD009](anti-debugging/AD009_RtlQueryProcessHeapInformation/) | RtlQueryProcessHeapInformation | Anti-Debugging | Windows | 通过检查堆标志来检测调试器 | | [AD010](anti-debugging/AD010_RtlQueryProcessDebugInformation/) | RtlQueryProcessDebugInformation | Anti-Debugging | Windows | 通过 RtlQueryProcessDebugInformation 检查堆标志 | | [AD011](anti-debugging/AD011_DbgPrint/) | DbgPrint Exception | Anti-Debugging | Windows | 通过 DbgPrint 异常行为检测调试器 | | [AD012](anti-debugging/AD012_GetWriteWatch/) | GetWriteWatch | Anti-Debugging | Windows | 监控受保护内存,查看是否被调试器修改 | | [AD013](anti-debugging/AD013_GetThreadContext/) | GetThreadContext | Anti-Debugging | Windows | 检查硬件断点寄存器 (Dr0-Dr7) | | [AD014](anti-debugging/AD014_NtSetInformationThread/) | NtSetInformationThread | Anti-Debugging | Windows | 使用 ThreadHideFromDebugger 对调试器隐藏线程 | | [AD015](anti-debugging/AD015_NtQueryObject/) | NtQueryObject | Anti-Debugging | Windows | 枚举对象类型以查找 DebugObject | | [AD016](anti-debugging/AD016_RaiseException/) | RaiseException DBG_CONTROL_C | Anti-Debugging | Windows | 抛出 DBG_CONTROL_C 以检测异常拦截 | | [AD017](anti-debugging/AD017_SoftwareBreakpoint/) | Memory Breakpoint INT3 | Anti-Debugging | Windows | 扫描函数内存以查找断点 (0xCC) | | [AD018](anti-debugging/AD018_AntiStepOver/) | Anti-Step-Over | Anti-Debugging | Windows | 检查函数返回地址处是否存在断点 | | [AD019](anti-debugging/AD019_MemoryBreakpoint/) | Guard Page | Anti-Debugging | Windows | 使用保护页异常来检测调试器 | | [AD020](anti-debugging/AD020_NtQueryVirtualMemory_WorkingSetList/) | NtQueryVirtualMemory WorkingSetList | Anti-Debugging | Windows | 检查工作集页面属性是否被修改 | | [AD021](anti-debugging/AD021_DbgBreakPoint_patch/) | DbgBreakPoint Patch | Anti-Debugging | Windows | 修补 DbgBreakPoint 以阻止调试器附加 | | [AD022](anti-debugging/AD022_DbgUiRemoteBreakin_hook/) | DbgUiRemoteBreakin Hook | Anti-Debugging | Windows | 修补 DbgUiRemoteBreakin 以阻止调试器附加 | | [AD023](anti-debugging/AD023_INT3/) | INT3 (0xC3) | Anti-Debugging | Windows | 结合 INT3 指令使用向量异常处理 | | [AD024](anti-debugging/AD024_INT3_long/) | INT3 Long Form (0xCD03) | Anti-Debugging | Windows | 使用 INT3 的长指令格式进行调试器检测 | | [AD025](anti-debugging/AD025_INT2D/) | INT 2D | Anti-Debugging | Windows | 用于检测的内核调试器中断 | | [AD026](anti-debugging/AD026_INT1/) | INT1 ICEBP (0xF1) | Anti-Debugging | Windows | 使用 ICEBP 指令进行调试器检测 | | [AD027](anti-debugging/AD027_INT1_long/) | INT1 Long Form (0xCD01) | Anti-Debugging | Windows | 使用 INT 1 的双字节格式进行检测 | | [AD028](anti-debugging/AD028_popfd_trap/) | POPFD Trap Flag | Anti-Debugging | Windows | 通过 POPFD 操纵 Trap Flag 以触发单步执行 | | [AD029](anti-debugging/AD029_INT1_prefix/) | INT1 with Prefixes | Anti-Debugging | Windows | 在 ICEBP 之前使用指令前缀 | | [AD030](anti-debugging/AD030_self_debugging/) | Self-Debugging | Anti-Debugging | Windows | 尝试调试自身以检测已存在的调试器 | | [AD031](anti-debugging/AD031_GenerateConsoleCtrlEvent/) | GenerateConsoleCtrlEvent | Anti-Debugging | Windows | 通过检查控制台控制事件处理来检测调试器 | | [AD032](anti-debugging/AD032_GetShellWindow/) | GetShellWindow | Anti-Debugging | Windows | 将父 PID 与 Explorer 进行比较以检测异常执行 | | [AD033](anti-debugging/AD033_FindWindow/) | FindWindow | Anti-Debugging | Windows | 通过搜索已知的窗口类名来检测调试器 | | [AD034](anti-debugging/AD034_SwitchDesktop/) | SwitchDesktop | Anti-Debugging | Windows | 通过切换到新的桌面将进程对调试器隐藏 | | [AD035](anti-debugging/AD035_GetLocalTime/) | GetLocalTime | Anti-Debugging | Windows | 通过测量已知工作负载的运行时间来检测调试器 | | [AD036](anti-debugging/AD036_GetSystemTime/) | GetSystemTime | Anti-Debugging | Windows | 通过对已知工作负载进行 UTC 时间分析来检测调试器 | | [AD037](anti-debugging/AD037_GetTickCount/) | GetTickCount | Anti-Debugging | Windows | 通过比较工作负载前后的毫秒级滴答计数来检测调试器 | | [AD038](anti-debugging/AD038_QueryPerformanceCounter/) | QueryPerformanceCounter | Anti-Debugging | Windows | 使用高分辨率性能计数器计时来检测调试器 | | [AD039](anti-debugging/AD039_timeGetTime/) | timeGetTime | Anti-Debugging | Windows | 使用多媒体定时器分析来检测调试器 | | [AD040](anti-debugging/AD040_ProcessDebugFlags/) | ProcessDebugFlags | Anti-Debugging | Windows | 通过 NtQueryInformationProcess 查询 ProcessDebugFlags | | [AD041](anti-debugging/AD041_NtGlobalFlag/) | NtGlobalFlag | Anti-Debugging | Windows | 检查 PEB NtGlobalFlag 中由调试器设置的堆调试标志 | | [AD042](anti-debugging/AD042_HeapFlags/) | HeapFlags | Anti-Debugging | Windows | 检查堆 Flags 和 ForceFlags 是否包含调试器设置的值 | | [AD043](anti-debugging/AD043_RDTSC/) | RDTSC | Anti-Debugging | Windows | 使用 CPU 时间戳计数器周期测量来检测调试器 | | [AD044](anti-debugging/AD044_OpenProcess_CSRSS/) | OpenProcess CSRSS | Anti-Debugging | Windows | 通过尝试打开受保护的 csrss.exe 进程来检测具有提升权限的调试器 | | [AD045](anti-debugging/AD045_CodeChecksum/) | Code Checksum | Anti-Debugging | Windows | 持续监控函数校验和以检测断点或代码补丁 | | [AD046](anti-debugging/AD046_CreateFileA_Exclusive/) | CreateFileA Exclusive | Anti-Debugging | Windows | 通过尝试对当前可执行文件进行独占文件访问来检测调试器 | | [AD047](anti-debugging/AD047_SystemKernelDebuggerInformation/) | SystemKernelDebuggerInformation | Anti-Debugging | Windows | 通过查询系统内核调试器标志来检测内核态调试器 | | [AD048](anti-debugging/AD048_LoadLibrary/) | LoadLibrary | Anti-Debugging | Windows | 通过对可执行文件执行 LoadLibraryA 后的文件句柄行为来检测调试器 | | [AD049](anti-debugging/AD049_DetectAPIPatch/) | DetectAPIPatch | Anti-Debugging | Windows | 通过比较跨进程的 API 函数字节来检测调试器 | | [AD050](anti-debugging/AD050_KUSER_SHARED_DATA/) | KUSER_SHARED_DATA | Anti-Debugging | Windows | 从 KUSER_SHARED_DATA 读取 KdDebuggerEnabled 以检测内核调试器 | | [AD051](anti-debugging/AD051_HEAP_TAIL_CHECKING_ENABLED/) | HEAP_TAIL_CHECKING_ENABLED | Anti-Debugging | Windows | 通过检查 0xABABABAB 堆尾部哨兵模式来检测调试器 | | [AD052](anti-debugging/AD052_InstructionCounting/) | Instruction Counting | Anti-Debugging | Windows | 通过计算硬件断点单步执行异常的次数来检测调试器 | | [AD053](anti-debugging/AD053_StackSegment/) | Stack Segment Register | Anti-Debugging | Windows | 通过 SS 寄存器的陷阱抑制来检测单步执行的调试器 | | [AD054](anti-debugging/AD054_EnumWindowsProc/) | EnumWindowsProc | Anti-Debugging | Windows | 通过枚举具有已知工具标题的窗口来检测调试器 | | [AD055](anti-debugging/AD055_DbgSetDebugFilterState/) | DbgSetDebugFilterState | Anti-Debugging | Windows | 通过 NtSetDebugFilterState 的成功执行状态来检测内核调试器 | | [AD056](anti-debugging/AD056_SwitchToThread/) | SwitchToThread | Anti-Debugging | Windows | 利用单步执行期间的线程调度程序行为来检测调试器 | | [AD057](anti-debugging/AD057_TLSCallback/) | TLS Callback | Anti-Debugging | Windows | 使用 Thread Local Storage 回调在主入口点之前执行代码 | | [AD058](anti-debugging/AD058_ProcessJob/) | Process Job | Anti-Debugging | Windows | 通过枚举作业对象中的进程来检测调试器 | | [AD059](anti-debugging/AD059_WudfIsAnyDebuggerPresent/) | WudfIsAnyDebuggerPresent | Anti-Debugging | Windows | 通过 WudfPlatform.dll 中未公开的 UMDF 平台 API 检测调试器 | | [AD060](anti-debugging/AD060_LowFragmentationHeap/) | LowFragmentationHeap | Anti-Debugging | Windows | 通过低碎片堆的前端分配器状态来检测调试器 | ## 构建技术 大多数技术包括: - **源代码**(位于 `src/` 目录中的 `main.c` 或类似文件) - 用于编译的 **Makefile** - 用于容器化构建的 **Dockerfile** - 包含详细说明和参考资料的 **README** ### 构建系统概述 本项目使用 **混合构建系统** 以满足不同的编译需求: #### Docker + MinGW(推荐) 大多数技术使用 Docker 配合 MinGW 交叉编译器进行一致性构建: ``` # 构建 Docker image make build-image # 编译 technique(同时构建 x86 和 x64) make build # 或者如果你已经安装了 MinGW,可以直接 build make ``` 输出的二进制文件放置在 `bin/` 目录中。 ### 通用构建流程 1. **导航至技术目录**: cd anti-sandbox/AS001_SetErrorMode/ # 或 cd anti-debugging/AD002_IsDebuggerPresent/ 2. 在该技术的 README 中**检查构建要求** 3. **使用 Docker 构建**(适用于大多数技术): make build-image # 仅第一次需要 make build 4. **或使用 MinGW 构建**(如果已安装): make 5. 在 `bin/` 目录中**找到编译后的二进制文件** ### 构建要求 - **Docker**:用于容器化构建(推荐) - **MinGW-w64**:用于在 Linux/Mac 上原生构建 Windows 程序 - **GNU Make**:构建自动化工具 ### 疑难解答 - **Docker 不可用**:安装 MinGW 交叉编译器并直接构建 - **MinGW 不可用**:使用 Docker 进行隔离构建 - **构建失败**:检查各个技术的 README 以了解具体要求 - **缺少依赖项**:某些技术可能需要额外的库 有关具体的构建要求和平台兼容性,请参阅各项技术的 README。 ## 许可证 本项目基于 MIT 许可证授权 - 有关详细信息,请参阅 [LICENSE](LICENSE) 文件。 ## 资源 ### 反分析参考资料 - [CheckPoint 反调试技术](https://anti-debug.checkpoint.com/) - [Al-Khaser 反恶意软件扫描器](https://github.com/LordNoteworthy/al-khaser) - [恶意软件分析训练营](https://www.malwaretech.com/) - [终极反调试参考](https://pferrie.epizy.com/papers/antidebug.pdf?i=1) - [Apriorit 带示例的反调试技术](https://www.apriorit.com/dev-blog/367-anti-reverse-engineering-protection-techniques-to-use-before-releasing-software) ### Microsoft 文档 - [Windows API 文档](https://docs.microsoft.com/en-us/windows/win32/api/) - [未公开的 NT 内部结构](http://undocumented.ntinternals.net/) ## 免责声明 本仓库**仅供教育和研究用途**。此处记录的技术是恶意软件作者用来逃避检测的手段。了解这些技术有助于安全专业人士构建更好的防御体系。 **请勿将这些技术用于恶意目的。** **注意**:某些技术可能无法在所有 Windows 版本或所有调试器上运行。在适用的地方,各项技术的文档中均包含了兼容性说明。
标签:DAST, DOM解析, Gophish, 云资产清单, 反沙箱, 反调试, 客户端加密, 恶意软件分析, 端点可见性, 请求拦截, 逆向工程