0xjbb/EyYoEtwWhereYouAt

GitHub: 0xjbb/EyYoEtwWhereYouAt

通过关联内核通知与ETW事件缺失来检测ETW Patching的Windows内核驱动PoC工具

Stars: 0 | Forks: 0

# EyYoEtwWhereYouAt 概念验证工具,用于监控内核事件(镜像加载、进程创建、线程创建)并识别对应的 ETW 遥测中异常的缺失。当系统活动发生但没有产生预期的 ETW 事件时,即表明存在 ETW Patching。 它有一个非常明显的绕过方法,即可以通过 Hook EtwWriteEvent 或 NtTraceEvent,仅修改部分事件数据并将其发送出去。针对这种情况可能的解决方法是,建立一个应存在事件的数据库,对可哈希的事件进行哈希处理,并在 ETW 消费端对其进行匹配。 虽然这能有效检测 ETW Patching,但仍然存在一些误报 (FPs),分析逻辑还有很大的改进空间。 误报通常是那些花费大量时间等待的进程,增加分析间隔的时间,甚至记录最后 X 个周期的情况可能会更好。 ### 前置条件 - 系统管理员权限 - 禁用 Secure Boot(安全启动) - 启用驱动程序测试签名 - CMake - MSVC 2022(2026 目前不兼容驱动程序) - 虚拟机 - 必须使用,这只是一个 PoC。 ### 编译 生成构建文件 ``` > mkdir build > cd build build> cmake .. -- Building for: Visual Studio 18 2026 -- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.26200. -- The C compiler identification is MSVC 19.50.35725.0 -- The CXX compiler identification is MSVC 19.50.35725.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools/MSVC/14.50.35717/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done (5.0s) -- Generating done (0.1s) -- Build files have been written to: C:/Users/dev/CLionProjects/EyYoEtwWhereYouAt/build ``` 编译 ``` build> cmake --build . MSBuild version 18.3.0-release-26070-10+3972042b7 for .NET Framework 1>Checking Build System Building Custom Rule C:/Users/dev/CLionProjects/EyYoEtwWhereYouAt/CMakeLists.txt Scanning sources for module dependencies... Logger.cc App.cc Ipc.cc Storage.cc Process.cc Thread.cc AlertContainer.cc Util.cc ObserverManager.cc AlertMemoryObserver.cc LogDebug.cc AnalysisEngine.cc logStdout.cc config.cc Compiling... Thread.cc App.cc Storage.cc Ipc.cc Process.cc Logger.cc Util.cc LogDebug.cc AnalysisEngine.cc AlertContainer.cc AlertMemoryObserver.cc ObserverManager.cc config.cc logStdout.cc EyYoEtwWhereYouAt.vcxproj -> C:\Users\dev\CLionProjects\EyYoEtwWhereYouAt\build\Debug\EyYoEtwWhereYouAt.lib Building Custom Rule C:/Users/dev/CLionProjects/EyYoEtwWhereYouAt/CMakeLists.txt Scanning sources for module dependencies... main.cpp Compiling... main.cpp etw_exe.vcxproj -> C:\Users\dev\CLionProjects\EyYoEtwWhereYouAt\build\Debug\etw_exe.exe Building Custom Rule C:/Users/dev/CLionProjects/EyYoEtwWhereYouAt/CMakeLists.txt PS C:\Users\dev\CLionProjects\EyYoEtwWhereYouAt\build> ``` ### 使用说明 - 使用 `sc.exe create EtwDriver type= kernel binPath=C:\path\to\driver` 安装驱动 - 以本地管理员身份运行编译好的 exe 文件。 - 启动驱动 `sc.exe start EtwDriver` - 运行带有 ETW Patching 的应用程序。 ### 截图 使用 x64dbg Patch NtTraceEvent ![Patch](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/b99e640c95184552.jpg) 来自应用程序的警报。 ![Alert](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/bd063608c6184559.jpg) ### 注意事项: - 驱动可能会崩溃,这是我第一次编写驱动程序。 - 包含一些未使用的代码,因为我原本打算将其做成一个更大的项目,但后来决定放弃。 - 可能会有一些误报 (FPs),我没有在分析“引擎”上投入太多精力,还有待改进。 - 我做了一些重构,但没有费心去更新单元测试。
标签:Bash脚本, C++, CMake, EDR, ETW, ETW Patching, PoC, RFI远程文件包含, rootkit 检测, URL发现, Windows 内核, Windows 安全, 事件跟踪, 代码共享, 内核驱动, 安全意识培训, 安全检测, 异常检测, 数据擦除, 映像加载, 暴力破解, 线程创建, 网络协议, 脆弱性评估, 进程创建, 遥测完整性, 防御规避检测