ETW Bypass - Blinding Windows Telemetry

What is ETW and Why it Matters

Event Tracing for Windows (ETW) is the high-performance logging infrastructure of Windows, operating from the kernel all the way up to userland. It is the underlying mechanism for a wide variety of visibility tools: Process Monitor, Windows Defender, EDRs like CrowdStrike and SentinelOne, and Microsoft Defender for Endpoint itself — all consume ETW events to detect malicious behavior in real time.

Unlike what many assume, ETW is not just "logging." It is a real-time telemetry channel where instrumented providers emit events to consumers (including the kernel), which can act on those events immediately — for example, terminating a suspicious process.

For offensive operations, neutralizing or degrading ETW means drastically reducing defenders' visibility into code execution, module loading, memory allocation, and network behavior.


ETW Architecture

┌─────────────────────────────────────────────────────────────────────┐
│                     ETW Architecture — Overview                     │
│                                                                     │
│  ┌────────────────────────────────────────────────────┐             │
│  │                   KERNEL SPACE                     │             │
│  │  ┌─────────────────┐    ┌────────────────────────┐ │             │
│  │  │  ETW Kernel     │    │  WMI / Security        │ │             │
│  │  │  Providers      │    │  Audit Providers       │ │             │
│  │  └────────┬────────┘    └───────────┬────────────┘ │             │
│  │           │                         │              │             │
│  │           ▼                         ▼              │             │
│  │      ┌──────────────────────────────────┐          │             │
│  │      │       ETW Session (kernel)       │          │             │
│  │      └──────────────────┬───────────────┘          │             │
│  └─────────────────────────│────────────────────────── ┘            │
│                            │                                        │
│  ┌─────────────────────────│────────────────────────────┐           │
│  │                USER SPACE│                            │           │
│  │  ┌──────────────────────▼───────────────────────────┐│           │
│  │  │  ntdll!NtTraceEvent / EtwEventWrite              ││           │
│  │  └──────────────────────┬───────────────────────────┘│           │
│  │                         │                            │           │
│  │  ┌──────────────────────▼───────────────────────────┐│           │
│  │  │  Userland Providers (CLR, PowerShell, AMSI...)   ││           │
│  │  └───────────────────────────────────────────────── ┘│           │
│  │                                                       │           │
│  │  Consumers: EDR, WEF, Sysmon, Defender               │           │
│  └───────────────────────────────────────────────────── ┘           │
└─────────────────────────────────────────────────────────────────────┘

Every ETW event emission in userland passes through EtwEventWrite in ntdll.dll. This function serializes the event and calls NtTraceEvent (syscall), which delivers it to the kernel ETW subsystem.

If we break this path — particularly at EtwEventWrite — userland providers such as PowerShell (Microsoft-Windows-PowerShell) and the CLR (.NET runtime) stop emitting events entirely.


Technique 1: EtwEventWrite Patch in ntdll

The most direct approach. EtwEventWrite in ntdll.dll can be patched to return immediately without emitting any event.

Identifying the Prologue

On x64, the first bytes of EtwEventWrite typically look like:

The patch overwrites these with xor eax, eax; ret (return with ERROR_SUCCESS = 0):

Implementation in C

Important note: This patch only affects the current process. Each process has its own copy of ntdll.dll mapped in its address space. The patch does not propagate to other processes and does not persist across reboots.


Technique 2: Patch via Direct Syscall (avoiding VirtualProtect hooks)

EDRs frequently hook VirtualProtect to detect permission changes on system module pages. To avoid this detection, we can perform the patch using direct syscalls.


Technique 3: Disabling a Specific Provider via ETW Session Registration

Instead of patching code, we can manipulate ETW session settings to disable specific providers. The logman cmdlet or the ControlTrace API can be used to pause or stop sessions.

In C, via API:


Technique 4: Neutralize CLR (.NET) Provider via Environment Variable

The CLR runtime reads an environment variable and registry keys to determine whether to enable profiling and diagnostic ETW events. Setting COMPlus_ETWEnabled=0 before loading the CLR suppresses all runtime events (.NET assembly loading, JIT compilation, etc.).

Or via command line before launching a child process:


Technique 5: Thread-Specific ETW Suppression via NtSetInformationThread

A subtler technique uses NtSetInformationThread with the class ThreadHideFromDebugger (value 17). This flag, originally intended for anti-debugging, also suppresses ETW events emitted by the affected thread in some older Windows versions. On modern versions this technique has reduced effectiveness but still produces interesting behavior in certain EDR implementations.


Operational Impact and Limitations

Critical limitations:

  • Userland patches do not affect kernel-space providers. Events like process creation (PsSetCreateProcessNotifyRoutine) continue to be generated regardless.

  • Modern EDRs with kernel drivers (like CrowdStrike Falcon) can detect the absence of expected ETW events as an anomaly — the "silence" itself becomes an indicator.

  • Windows Defender for Endpoint implements ETW with kernel callbacks that cannot be suppressed by userland patches.


References

  • Adam Chester, "Hiding Your .NET – ETW" — xpnsec.com (2019)

  • modexp, "Disabling Windows Event Tracing" — modexp.is (2019)

  • CyberArk Labs, "Fantastic Red-Team Attacks and How to Find Them" (2019)

  • Matt Graeber, "Subverting Trust in Windows" — DEFCON 25

  • Microsoft Docs, "About Event Tracing" — docs.microsoft.com/en-us/windows/win32/etw/

  • Sektor7 Institute, "Malware Development: Intermediate" — sektor7.net

  • Elastic Security, "Detecting ETW Bypass" — elastic.co/security-labs (2022)

  • Red Canary, "Detecting ETW Tampering" — redcanary.com (2023)

Last updated