Skip to content

About

How CrowdStrike Falcon detects ETW tampering, where its tripwire ends, and a PoC that blinds ETW without ever touching what it watches

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Blinding-The-Falcon

How CrowdStrike Falcon detects ETW tampering, where its tripwire ends, and a PoC that blinds ETW without ever touching what it watches

Blinding the Falcon: How CrowdStrike Really Detects ETW Tampering, and Where the Tripwire Ends

Conventional ETW patching has been around for several years, and EDRs have adapted. One of the earliest records of this is Adam Chester's Hiding your .NET – ETW (March 2020): resolve EtwEventWrite in ntdll, flip the page writable, overwrite the prologue with a ret, and every CLR event the process would have sent dies silently. EtwEventWriteFull and NtTraceEvent followed as patch points, and there have been many variations since.

EDRs have come a long way in detecting tampering, as a lot of telemetry is derived from ETW and is needed for a more comprehensive picture of the binary it is monitoring.

When thinking of new bypass methods, I figured a good start would be to start by reversing an EDR to see if I could find anything. Naturally, I figured a good start would be CrowdStrike for their popularity & maturity.

I wasn't prepared for the absolute goldmine of knowledge I would come across, and to my benefit, about halfway through CSFalconService.exe, it was revealed how it catches tampering to ETW.


ETW Recap

ETW has four roles:

  • Provider: anything that emits events (the CLR in your process, the kernel's Threat Intelligence provider, your own manifest provider).
  • Controller: anything that starts/configures trace sessions and enables providers into them (logman, an EDR service).
  • Session ("logger"): a kernel buffering pipeline. Events from enabled providers are written into session buffers by the kernel.
  • Consumer: anything that reads events from a session, real time or from file.

Two facts drive everything in this writeup:

  1. Delivery goes through the kernel. If an event is emitted, every session that enabled the provider gets a copy. If it is not emitted (provider disabled, fast-path gate closed), no session gets anything.
  2. The decision to emit is made in the provider's own process. For a provider hosted in your process (CLR, PowerShell, your own), the enable state that gates emission lives in your memory.

An EDR is just a controller + consumer. CrowdStrike's sessions are named cs-etw and cs-etw-sm, and it consumes Eventlog-Security as well. That one is a Windows system session created by the Windows Event Log service, not something CrowdStrike owns. These are standard real time consumer sessions fed by an unusually rich provider set. Session names are specific to the sensor version this research was done on and could possibly change across releases.


CrowdStrike's ETW Footprint

Examining CSFalconService.exe's session setup functions reveals both the offensive opportunities and how deeply the sensor analyzes each stream to catch malicious behavior.

Provider What it feeds the sensor Why we care
Threat Intelligence VM alloc/protect/read/write, QueueApc, SetThreadContext, driver loads The injection tripwire and the anti-tamper tripwire (next section)
CLR (DotNETRuntime) Assembly load/unload: event IDs 151/152/154, opcodes 33/35 Sees in-memory .NET (Assembly.Load, inline C#, some BOF-ish patterns)
Kernel-Process Process start events Lineage, even for short-lived children
Win32k SetWindowsHookEx, GetAsyncKeyState et al. Keylogger/screenshot heuristics
Security Auditing (Eventlog-Security session) 4624/4625/4634/4662/4719/5136 Logons, privilege use, directory changes
WinINet (+capture) URLs, verbs, request/response headers HTTP C2 metadata even from "library" code
DNS Client DNS queries C2 resolution
WMI Activity Incl. event 5861: permanent event subscriptions WMI persistence
Services (SCM/Svchost) Service install/start (105/200) Service persistence, sc.exe
SMB Server / Witness Share access, named pipes Lateral movement
Kernel-Audit-API-Calls Nt* usage by target PID with return codes Direct-syscall flavored telemetry
Microsoft-Windows-Security-Mitigations Mitigation enforcement events Exploit telemetry
WER-Diag CallReturnInstructionBytes, TargetInstructionBytes... crash-report instruction bytes: the ROP/exploit reading is our inference
Audit-CVE, ObTrace, NetLogon-family, SMBWitness, a CS-internal packet-capture provider assorted breadth

One structural note that matters later:

  • The binary collects and the cloud decides. The service binary contains no verdict logic that we found. It subscribes to telemetry, runs its in binary checks (like the ETW tripwire in the next section), and forwards the results. That split is also the boundary of my RE efforts. What the cloud does with each reason is the part that isn't visible.

How CrowdStrike Flags ETW Tampering

Here's what the service actually does when it wants to catch someone tampering with ETW:

When the sensor sets up its Threat Intelligence session, it opens the pristine \KnownDlls\ntdll.dll section, the system's clean copy of ntdll, verifies it's a genuine image and resolves EtwEventWrite and NtTraceEvent inside it. Those values are stored as pristine base, pristine end, and the two function addresses, and these serve as the reference points. They are stored once and never touched again.

From there, every time the Threat Intelligence stream reports a protect or write operation anywhere on the box, the sensor takes that operation's base address and region size and asks exactly three questions in this order:

  • Does the region cover pristine EtwEventWrite? reason 9
  • Does it cover pristine NtTraceEvent? reason 10
  • Does it start anywhere inside the pristine ntdll image? reason 8

A yes on any of them is recorded as a per process "tamper reason". Those are the categories in the table below.

Thus, the entire detection method can be phrased like this: Did your protect/write region cover one of the two classic patch points, or start anywhere inside ntdll?

The reasons, what triggers them, and how they surface:

reason trigger reported as
1 remote MEM_COMMIT + executable alloc (AllocVm handler) telemetry 16778524
2–6 protection-transition classes on VM events (any-exec / write+exec / writable masks) per-process reason bits, cloud-tunable
8 region starts inside the ntdll image first hit: telemetry 8391370 (carries the reason), later summary 25167687
9 region covers EtwEventWrite same
10 region covers NtTraceEvent same

The numbers in the last column are the telemetry IDs: the numeric labels the sensor stamps on the records it uploads. So, 8391370 and 25167687 are how the sensor says "a tamper reason fired for this process".

Also examined was what the detector does not do, because that matters just as much. Those stored reference points have exactly one consumer in the whole TI subsystem, and it's this range check. No byte comparison, no hashing, no periodic rescan. The check fires only when a protect/write event arrives, which is the exact moment tampering has to happen, and the one timer nearby doesn't scan anything. It just flushes already flagged processes to the cloud.

The three range tests in EtwTi_OnProtectVm_AntiTamper: reasons 9, 10, 8, in order

The three range tests in EtwTi_OnProtectVm_AntiTamper. Reasons 9, 10, and 8, in the order the sensor checks them.

Where the reference points come from: EtwTi_ResolvePristineEtwPtrs opening the pristine \KnownDlls\ntdll.dll and computing the two function addresses by live RVA

Where the reference points come from. The EtwTi_ResolvePristineEtwPtrs function opens the pristine \KnownDlls\ntdll.dll and computes both function addresses by live RVA.

The event record, parsed by name: TargetProcessId, BaseAddress, RegionSize, and the protection masks

The event record parsed by name. TargetProcessId, BaseAddress, RegionSize, and the protection masks.

Reason bits accumulate per process (1 << (reason-1)) in a per process tracker node. The first time a reason fires for a process, the sensor uploads a record (telemetry ID 8391370) carrying that reason. A timer pump later sends a summary record (ID 25167687) for the flagged process, and two of the event types in the stream (the ones numbered 22 and 27) also get a complete report of the protect/write operation itself, whichever reason fired.

The part that matters most: reason policy is tunable per process from the cloud. The backend can send the sensor control records that name a process and a reason (in the record schema those are field 4115, the process key, and field 4971, the reason), and tighten or loosen what gets flagged for that specific process, with no sensor update required. The soft reasons (2–6) are not free passes, they're signals whose weight we can't see. Anything that generates a reason is a loss.

Two more scoping facts:

  • The TI subscription is version gated. TI is only consumed on sensor builds above a minimum version (0xA003AD7), and the event set expands at 0xA0042EE / 0xA004563 / 0xA0047BA. A technique that's invisible on an old build can be covered on a new one.
  • The same subscription covers the rest of the injection menu. AllocVm / WriteVm, QueueUserAPC, SetThreadContext, and driver loads each have their own TI handler. If a technique needs any of those primitives, it's safe to assume the telemetry for that exists.

How do we blind ETW when we can't touch ntdll?

The tripwire guards three addresses. That single fact turns "how do we blind ETW" into a very specific question: how do you kill the telemetry when the obvious move (VirtualProtect + a patch on ntdll) is the exact thing the detector watches for?

The bypass constraints:

  1. Nothing that writes to or reprotects ntdll. Reasons 8–10 don't care who writes, what bytes, or why. Restoring, or "unhooking", counts the same as patching. There is no benign version of writing to ntdll.
  2. No remote VM operations. Even outside ntdll, remote alloc/write/protect produce TI events and the soft reasons 2–6. At most a couple of protects on our own module's pages, done once at init, and even those are soft signals.
  3. No thread manipulation. SetThreadContext and APC based redirection are consumed by the same TI subscription. The hardware breakpoint + VEH family dies with them.
  4. No session meddling. Stopping cs-etw needs elevation, and a dead session is its own red flag. Out of scope for low privilege tradecraft.
  5. Syscalls don't help. Direct/indirect syscalls only dodge usermode hooks. TI events are emitted in the kernel which sit below the syscall boundary.
  6. Silence risks becoming a signal. Whatever we blind, the stream has to stay warm. The right move is usually to mislabel or selectively drop instead of going dark.

What that leaves: data only writes to memory we already own. That is not a trick. It is the direct consequence of the detector being an address range overlap on VM events. If a technique needs a protection change or a write on ntdll, it's dead on arrival. Everything else is just finding the right bytes in our own process.


The Bypass

The bypass I have presented here is a slight expansion on a semi known technique. Here is the whole idea, in order. The known way to blind a provider is to zero the enable state bytes inside its registration entry, a structure that lives in your own process heap. That move is documented. kernullist's ETW internals writeup covers the state zeroing family, and it works. Events check those bytes before anything else happens, so zeroing them kills the stream instantly.

The catch is that the blind does not last. Every time the sensor enables the provider, Windows delivers a notification that rewrites those same bytes, and the lights come back on. Anything that stops at zeroing needs a watchdog polling to reapply the blind forever. That is the documented weakness of the technique, and the flaw this POC closes.

This POC adds one step that ends the fight. It kills the delivery channel those notifications travel through. Flip the gates off once and every future reenable dies unread. No watchdog, no polling, no race, and the whole extra move is a single qword write into our own heap.

The machinery that makes it possible: when a process registers an ETW provider, ntdll sets up a delivery pipeline so the kernel can tell it "a session just enabled/disabled you." The kernel is given an event to signal, and a thread-pool wait is armed with a callback (EtwpNotificationThread) that drains the notifications and rewrites the provider's gate bytes. Every reenable a sensor pushes travels down this channel.

The technique: Find the EtwpNotificationThread callback's address in ntdll, scan our own heap for the qword that holds the address, and overwrite it with the address of a ret instruction that already exists inside ntdll's code. Nothing is written to ntdll and nothing trips the constraints listed above. The next notification runs the "callback", returns instantly and never rearms.

EtwpRegisterTpNotificationOnce: the channel's setup, create the event, hire the TP-wait callback, tell the kernel which event to signal

The channel's setup. EtwpRegisterTpNotificationOnce creates the event, hires the TP wait callback, and tells the kernel which event to signal.

EtwpNotificationThread: the drain loop, NtTraceControl(0x10) pulls the block, EtwDeliverDataBlock rewrites the gates, then re-arms

The drain loop. EtwpNotificationThread pulls the notification block with NtTraceControl(0x10), and EtwDeliverDataBlock rewrites the gates.

Combined with the gate flip, zeroing the enable state bytes once makes the blind permanent. The demo proves the resulting split brain. The session disables the provider and EventProviderEnabled still reads TRUE. The session reenables and events flow again while the gates never flicker. The kernel side state keeps moving and the user side state is frozen at registration.

A note on what is strictly required. The demo zeroes the gates because its own test session (and the verifier's) have already lit them. The baseline exists so you can watch telemetry working before it dies. For your own fresh provider, the zeroing can be skipped. Nobody has enabled it, so the gates prime dark at registration, and killing the channel before any session enables it means they can never be lit. But for the providers an EDR actually subscribes to (CLR, DNS, WinINet), the gates are lit before your code ever runs, and flipping them off is the only way down. The demo shows the general case.

Most importantly of this POC: None of it touches ntdll. No VirtualProtect, no writes, no thread manipulation, no VM operation of any kind. Check it against every tripwire described above. The reason 8, 9 and 10 range checks fire on protect and write events, and this technique produces none. The soft reasons 2 through 6 fire on protection transitions, and there are none. The APC and thread handlers watch SetThreadContext and APC traffic, and we use neither. The callback field still points inside ntdll's code, so even a casual scan sees nothing odd.

The dead ends are worth showing too. Each one pins down why the technique has to look like this:

  • suspending "the notification thread" does nothing. There is no thread, it's a thread-pool wait callback
  • re-registering the kernel's event slot is refused. One slot per process
  • poisoning the setup before user code runs loses by design. The channel is initialized before the first user instruction (verified down to a CRT-free exe), so blind-from-birth is architecturally impossible

EtwpRegisterProvider: the EtwpRegisterTpInitOnce InitOnce machinery, already completed before user code runs

The EtwpRegisterTpInitOnce InitOnce machinery, already completed before user code ever runs.

The full demo run side by side: etw_bypass.exe on the left, etw_verifier.exe on the right. The baseline events arrive, the stream dies at the blind and stays dead through all three re-enables, then returns on restore

The full demo run. etw_bypass.exe on the left, etw_verifier.exe on the right. Events arrive, the stream dies at the blind, and it stays dead through all three reenables.

This technique freezes every provider in the process. Per provider selectivity is a different technique. And a sensor that validates the TP_WAIT callback is still EtwpNotificationThread, or watches for gate-vs-session divergence, would catch it.

What the POC does when you run it

etw_bypass/etw_bypass.c is the demo of everything above. One program runing alongside etw_bypass/etw_verifier.c so the effect is visible from outside the process. Here's the sequence the screenshots show:

  1. etw_bypass.exe registers its own throwaway ETW provider. Registering one is the only way a process can emit events, and the demo needs something to blind. It also runs its own real time consumer session, cs-etw-sim, which uses the same delivery path cs-etw does.
  2. baseline. Three events arrive
  3. gate flip. zeroes the enable state bytes in its own registration entry, located by GUID scan and calibrated by diffing the entry when the session enables it. The stream goes dark.
  4. channel kill. repoints the notification wait's callback at a ret borrowed from ntdll
  5. the payoff. the session reenables the provider three times. Every notification dies undelivered, the gates stay dark, the stream stays dead. No watchdog anywhere.
  6. restore. writes the captured state back, events flow again, negative control

What the events actually are. The demo registers its own throwaway ETW provider (GUID {3D0C0DE0-3D0C-4000-8000-3D0C0DE0000C}) and emits a test event, id 1, info level, with a 4 byte payload that is just a sequence number. The actual content is meaningless, as the only thing being tested is whether an event arrives. The verifier is a second, independent process. It does not register a provider of its own. It subscribes to that same provider GUID and receives through the same kernel delivery path cs-etw uses. If the verifier sees an event, a real consumer session would too, and if it sees nothing neither would CrowdStrike's.

To be clear on who does what. Programs only register a provider if they were written to emit events. Most programs never emit anything, and it never happens automatically. The libraries a process loads are usually the ones that speak. The CLR speaks when .NET runs, the DNS and WinINet libraries speak when your code does networking. Your own code can stay silent and the process still has speakers in it, which is exactly why blinding those providers matters. cs-etw is a listener that the CrowdStrike service runs, subscribed to well known providers like the CLR and DNS. The demo registers its own throwaway provider on purpose, with a plain EventRegister call in its source, because it needs a speaker of its own to blind.

The verifier is a second independent process. It does not register a provider of its own. It subscribes to that same provider GUID and receives through the same kernel delivery path cs-etw uses. If the verifier sees an event, a real consumer session would too, and if it sees nothing neither would CrowdStrike's.

The two windows tell different halves of the story. The demo window shows what the program is doing. Every event it emits is printed with its phase ([emit:baseline] #1, [emit:blind] #4, ...). The verifier window shows what actually escaped the process, timestamped, with a heartbeat after the first event that makes the silence visible (last one 12.4s ago).

Phase etw_bypass.exe window etw_verifier.exe window
baseline [emit:baseline] #1..#3, then [baseline] sent 3 events, received 3 - telemetry works EVENT #1..#3 arrive
blind [blind] zeroed N gate bytes in our own heap nothing new
channel kill [channel] notification channel killed: N callback pointer(s) repointed at a ret nothing
re-enable ×3 [emit:re-enable] #7..#9, each followed by session tried to turn the provider back on: it stayed off nothing: the emits never leave the process
result [result] sent 3 events during re-enables, received 3 - stream stayed dead, no watchdog still nothing
restore [emit:restore] #10..#12, then [restore] sent 3 events, received 6 - telemetry works again EVENT lines resume

The two windows disagree during the blind phase. The demo is emitting and the verifier is receiving nothing. That gap is the bypass.

The screenshots in this writeup came from a run of these two files. etw_verifier.exe first, it subscribes to the provider and waits, then etw_bypass.exe in another window. The separate real time session watches the provider from outside the process, so the stream dying and staying dead through the re-enables is visible as it happens. The events themselves are deliberately boring. A synthetic event, id 1, whose 4-byte payload is just a sequence number. The content never matters, only whether it arrives.

gcc -O2 -Wall -o etw_bypass.exe etw_bypass/etw_bypass.c -ladvapi32 -lshell32
gcc -O2 -Wall -o etw_verifier.exe etw_bypass/etw_verifier.c -ladvapi32 -lshell32
etw_verifier.exe      # start this first
etw_bypass.exe        # start second

Additional Notes

  • None of this was verified against a live CrowdStrike agent as I do not have a license. The detector mechanics are reverse engineered and lab verified against Windows ETW infrastructure.
  • This was tested on Windows 11, build 24H2.
  • All code has been run through an AI model. I am not a developer, and my hacky C code I didn't think would be sufficient.

About

How CrowdStrike Falcon detects ETW tampering, where its tripwire ends, and a PoC that blinds ETW without ever touching what it watches

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages