Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
EhTrace — ATrace 是一个用于在 Windows 上追踪二进制文件执行的工具。 | Kitploit
工具/GitHubGitHub/k2/ehtrace
动态分析 (沙盒)代码分析漏洞利用逆向工程调试器模糊测试二进制分析
GitHubk2/ehtrace

EhTrace

ATrace 是一个用于在 Windows 上追踪二进制文件执行的工具。

查看仓库
2435039个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

EhTrace

LOGO

EhTrace(发音为"ATrace")是一个高性能的Windows二进制跟踪与插桩框架。它能够在无需源代码、无需修改二进制文件、无需传统调试的情况下,对Windows可执行文件进行深入的运行时分析。

概述

EhTrace利用Windows向量化异常处理(VEH)和块步进技术,以极低的开销提供全面的执行跟踪。与传统的调试或插桩工具不同,EhTrace完全在进程内运行,无需对目标二进制文件进行任何修补。

关键特性

  • 零二进制修改:无需修改目标二进制文件即可跟踪执行
  • 高性能:块步进代替单步执行,每秒约处理4300万事件
  • 完整代码覆盖:自动检测和跟踪基本块
  • 寄存器状态监控:在执行过程中捕获和分析寄存器状态
  • 无需调试模式:无需启用CPU调试/跟踪MSR能力
  • 进程内操作:与传统调试器相比,上下文切换开销极小
  • 多种插桩模式:支持多种跟踪和分析场景

核心能力

  • 执行流分析:跟踪程序执行路径和控制流
  • 代码覆盖映射:生成全面的代码覆盖报告
  • RoP防御:通过调用/返回平衡检测和防止面向返回编程攻击
  • 密钥托管:加密密钥拦截和托管能力
  • 模糊测试集成:兼容AFL的模糊测试插桩(AWinAFL)
  • 符号解析:通过DIA2自动加载和解析符号

架构

root@kitploit:~
flowchart TB
    subgraph Target["🎯 目标进程"]
        direction TB
        APP[应用程序代码]
        VEH[向量化异常处理程序]
        style APP fill:#e1f5ff,stroke:#01579b,stroke-width:3px,color:#000
        style VEH fill:#fff3e0,stroke:#e65100,stroke-width:3px,color:#000
    end
    
    subgraph EhTrace["⚡ EhTrace 引擎"]
        direction TB
        BLOCK[块步进器]
        DISASM[Capstone 反汇编器]
        FIGHTERS[BlockFighters]
        CTX[上下文管理器]
        style BLOCK fill:#f3e5f5,stroke:#4a148c,stroke-width:3px,color:#000
        style DISASM fill:#e8f5e9,stroke:#1b5e20,stroke-width:3px,color:#000
        style FIGHTERS fill:#ffebee,stroke:#b71c1c,stroke-width:3px,color:#000
        style CTX fill:#e0f2f1,stroke:#004d40,stroke-width:3px,color:#000
    end
    
    subgraph Output["📊 分析输出"]
        direction TB
        SHMEM[共享内存日志]
        GRAPHS[可视化图表]
        REPORTS[覆盖报告]
        style SHMEM fill:#fce4ec,stroke:#880e4f,stroke-width:3px,color:#000
        style GRAPHS fill:#f1f8e9,stroke:#33691e,stroke-width:3px,color:#000
        style REPORTS fill:#fff8e1,stroke:#f57f17,stroke-width:3px,color:#000
    end
    
    APP -->|异常| VEH
    VEH -->|单步执行| BLOCK
    BLOCK -->|指令| DISASM
    DISASM -->|分析| FIGHTERS
    FIGHTERS -->|状态| CTX
    CTX -->|事件| SHMEM
    SHMEM -->|数据| GRAPHS
    SHMEM -->|数据| REPORTS
    
    style Target fill:#e3f2fd,stroke:#0d47a1,stroke-width:4px
    style EhTrace fill:#f3e5f5,stroke:#6a1b9a,stroke-width:4px
    style Output fill:#e8f5e9,stroke:#2e7d32,stroke-width:4px

核心工作原理

EhTrace通过一个复杂的流水线工作:

  1. 🛡️ 异常处理:注册一个向量化异常处理程序(VEH)
  2. 👣 块步进:在基本块边界使用单步异常
  3. 🔍 反汇编:利用Capstone进行即时指令分析
  4. 📝 日志记录:将执行事件写入共享内存以供外部分析
  5. ⚔️ 战斗:应用可配置的"BlockFighters"执行安全和分析任务

该框架使用专门的上下文结构维护每个线程的执行状态,并提供可自定义插桩的钩子。

性能

root@kitploit:~
graph LR
    subgraph Traditional["🐌 传统调试器"]
        T1[单步执行]
        T2[上下文切换]
        T3[内核模式]
        T4[~1M 事件/秒]
        style T1 fill:#ffcdd2,stroke:#c62828,stroke-width:2px,color:#000
        style T2 fill:#ffcdd2,stroke:#c62828,stroke-width:2px,color:#000
        style T3 fill:#ffcdd2,stroke:#c62828,stroke-width:2px,color:#000
        style T4 fill:#ef5350,stroke:#b71c1c,stroke-width:3px,color:#fff
    end
    
    subgraph EhTrace["⚡ EhTrace"]
        E1[块步进]
        E2[进程内]
        E3[用户模式]
        E4[~43M 事件/秒]
        style E1 fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px,color:#000
        style E2 fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px,color:#000
        style E3 fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px,color:#000
        style E4 fill:#66bb6a,stroke:#1b5e20,stroke-width:3px,color:#fff
    end
    
    T1 --> T2 --> T3 --> T4
    E1 --> E2 --> E3 --> E4
    
    style Traditional fill:#ffebee,stroke:#d32f2f,stroke-width:3px
    style EhTrace fill:#e8f5e9,stroke:#388e3c,stroke-width:3px

EhTrace通过多项优化实现高性能:

  • 🎯 分支步进 vs 单步执行:仅在基本块边界进行跟踪
  • ⚡ 进程内操作:无调试器上下文切换
  • ⏱️ 时序状态管理:VEH自然维护执行状态
  • 💾 高效日志记录:共享内存缓冲区用于高吞吐量事件记录

📊 基准测试:428,833,152 个事件(每个32字节)在10秒内捕获 = ~43M 事件/秒

输出示例

CSW16 演示跟踪无符号的 notepad.exe:

无符号的火焰图

带 Capstone 反汇编的基本块图:

带反汇编的BB图

代码覆盖可视化:

BB图覆盖

组件

root@kitploit:~
graph TD
    subgraph Core["🎯 核心组件"]
        EH[EhTrace.dll<br/>主插桩库]
        AC[Acleanout<br/>日志导出器]
        AG[Agasm<br/>图生成器]
        style EH fill:#e1bee7,stroke:#6a1b9a,stroke-width:3px,color:#000
        style AC fill:#c5cae9,stroke:#3949ab,stroke-width:3px,color:#000
        style AG fill:#b2dfdb,stroke:#00695c,stroke-width:3px,color:#000
    end
    
    subgraph Tools["🔧 辅助工具"]
        AL[Aload<br/>DLL注入器]
        AP[Aprep<br/>测试可执行文件]
        AS[Astrace<br/>堆栈跟踪器]
        style AL fill:#ffe0b2,stroke:#e65100,stroke-width:3px,color:#000
        style AP fill:#f8bbd0,stroke:#c2185b,stroke-width:3px,color:#000
        style AS fill:#d1c4e9,stroke:#512da8,stroke-width:3px,color:#000
    end
    
    subgraph Fuzzing["🐛 模糊测试集成"]
        AWA[AWinAFL<br/>AFL插桩]
        style AWA fill:#ffccbc,stroke:#d84315,stroke-width:3px,color:#000
    end
    
    subgraph Viz["📊 可视化"]
        WPF[WPFx<br/>图查看器]
        DIA[Dia2Sharp<br/>符号解析器]
        ASF[AStackFolding<br/>火焰图]
        style WPF fill:#c8e6c9,stroke:#2e7d32,stroke-width:3px,color:#000
        style DIA fill:#fff9c4,stroke:#f9a825,stroke-width:3px,color:#000
        style ASF fill:#ffecb3,stroke:#ff8f00,stroke-width:3px,color:#000
    end
    
    EH -->|日志| AC
    AC -->|数据| AG
    AG -->|图| WPF
    AL -->|注入| EH
    DIA -->|符号| AG
    ASF -->|处理| AC
    AWA -->|变体| EH
    
    style Core fill:#f3e5f5,stroke:#7b1fa2,stroke-width:4px
    style Tools fill:#fff3e0,stroke:#ef6c00,stroke-width:4px
    style Fuzzing fill:#fbe9e7,stroke:#bf360c,stroke-width:4px
    style Viz fill:#e8f5e9,stroke:#388e3c,stroke-width:4px

EhTrace生态系统包含多个集成项目:

核心组件

  • EhTrace:主插桩 DLL(也可作为 EXE 构建用于测试)
  • Acleanout:从 EhTrace 创建的共享内存中导出跟踪日志
  • Agasm:粘合/反汇编工具,用于生成带符号和 Capstone 集成的图

辅助工具

  • Aload:DLL 注入工具
  • Aprep:测试可执行文件(EhTrace 构建为 EXE)
  • Astrace:堆栈跟踪工具
  • AKeyTest:加密密钥托管测试

模糊测试集成

  • AWinAFL:适用于 Windows 的、兼容 AFL 的模糊测试插桩

可视化

  • WPFx:基于 WPF 的可视化工具,使用 MSAGL 图形库
  • Dia2Sharp:C# DIA2 包装器,用于符号处理
  • TestDump2:Dia2Sharp 的测试应用程序
  • Amerger:日志合并工具
  • AStackFolding:用于生成火焰图的堆栈跟踪折叠

前提条件

构建要求

  • Visual Studio 2015 或更高版本(C++ 工具链)
  • Windows SDK
  • .NET Framework(用于可视化工具)

运行时依赖

  • dbghelp.dll:符号解析(包含在 support 目录中)
  • symsrv.dll:符号服务器支持(包含在 support 目录中)
  • Capstone:反汇编引擎(support 目录中的库)
  • MSAGL:图形可视化(Microsoft Automatic Graph Layout)

构建

  1. 在 Visual Studio 中打开 EhTrace.sln
  2. 选择目标配置(Debug/Release)和平台(x86/x64)
  3. 构建解决方案

详细的构建说明请参见 BUILDING.md

使用方法

基本跟踪

  1. 构建或获取 EhTrace.dll
  2. 使用 Aload 或你偏好的注入方法将 EhTrace.dll 注入目标进程
  3. 运行目标应用程序
  4. 使用 Acleanout 收集跟踪数据
  5. 使用 WPFx 或自定义分析工具可视化结果

示例工作流程

root@kitploit:~
# 构建 EhTrace
msbuild EhTrace.sln /p:Configuration=Release /p:Platform=x64

# 注入目标进程
Aload.exe target.exe EhTrace.dll

# 收集跟踪数据
Acleanout.exe > trace.log

# 使用 Agasm 分析
Agasm.exe trace.log output.graph

完整的使用文档请参见 USAGE.md

配置

EhTrace 通过 BlockFighters 框架支持运行时配置。通过修改构建中的 fighter 配置来配置跟踪行为。

可用的 fighter:

  • RoP Fighter:检测 ROP gadget 链
  • Key Escrow Fighter:拦截加密操作
  • AFL Fighter:提供模糊测试插桩
  • 自定义 Fighter:实现你自己的分析逻辑

开发

项目结构

root@kitploit:~
EhTrace/
├── EhTrace/          # 核心插桩 DLL
├── prep/             # 辅助工具和实用程序
├── vis/              # 可视化组件
├── support/          # 依赖项和资源
├── doc/              # 文档
└── afl-fuzz/         # AFL 模糊测试集成

关键源文件

  • EhTrace.cpp:主 VEH 处理程序和核心逻辑
  • BlockFighters.cpp:Fighter 框架实现
  • Config.cpp:配置和符号管理
  • GlobLog.cpp:共享内存日志记录
  • KeyEscrow.cpp:加密密钥拦截
  • RoP-Defender.cpp:ROP 检测逻辑

许可证

本项目采用 GNU Affero General Public License v3.0 许可 - 详情请参阅 LICENSE 文件。

版权所有 © 2014-2016 Shane Macaulay

贡献

欢迎贡献!请确保你的代码遵循现有风格并包含适当的测试。

作者

Shane Macaulay ([email protected])

致谢

  • Capstone 反汇编框架
  • Microsoft Automatic Graph Layout (MSAGL)
  • AFL 模糊测试框架
  • 安全研究社区

参考

更多技术细节,请参见:

  • ARCHITECTURE.md - 技术架构文档
  • doc/ - 附加文档和演示文稿
下载工具