How an EDR Works: Architecture and Telemetry Sources
The architecture of an Endpoint Detection and Response sensor on Windows: the kernel-mode sources it relies on (ETW, process, thread, image, registry and object callbacks, file system minifilters, WFP callouts), the user-mode agent that consumes and correlates them, the cloud back end, and how the sensor protects itself and can be verified by a defender.
Introduction
An Endpoint Detection and Response (EDR) product is a sensor installed on each endpoint that collects telemetry about what happens on the system, detects malicious behaviour, and lets an analyst or an automated policy respond: terminate a process, quarantine a file, isolate the host from the network. Unlike a traditional antivirus, which mainly inspects files, an EDR records behaviour: process creations, module loads, registry and file changes, network connections, handle operations, and the relationships between them.
Windows does not let third-party code observe the system arbitrarily. An EDR is built on a set of documented extension points that the kernel and the operating system expose for exactly this purpose. This article describes these sources, the user-mode agent that consumes them, and how a defender can verify that a sensor is healthy.
Architecture overview
An EDR is split across the user/kernel boundary and the network (Figure 1).
flowchart TB
subgraph KM["Kernel mode"]
direction LR
ETW["ETW providers<br/>Kernel-Process, Kernel-File,<br/>Kernel-Registry, Kernel-Network,<br/>Threat-Intelligence"]
CB["Kernel notify routines<br/>process, thread, image,<br/>registry, object callbacks"]
IO["I/O filters<br/>file system minifilter,<br/>WFP callout driver"]
end
subgraph UM["User mode"]
direction LR
APPS["Processes<br/>(optional user-mode hooks)"]
subgraph AGENT["EDR agent service (PPL Antimalware)"]
direction TB
A1["ETW consumer session"]
A2["Driver communication"]
A3["Telemetry engine"]
A4["Detection and response"]
end
end
CLOUD["Cloud console / SIEM"]
ETW -->|"events"| A1
CB -->|"callbacks, via the EDR driver"| A2
IO -->|"file and network operations"| A2
APPS -.->|"API events"| A3
A1 --> A3
A2 --> A3
A3 --> A4
A4 -->|"telemetry, alerts"| CLOUD
CLOUD -->|"policy, response actions"| A4
Figure 1. The components of an EDR sensor and its telemetry sources.
| Layer | Component | Role |
|---|---|---|
| Kernel | EDR driver | Registers callbacks, minifilter and network filters; enforces blocking decisions |
| Kernel | ETW providers | Built-in Windows instrumentation, consumed without a driver |
| User | Agent service | Consumes events, enriches and correlates them, runs detections, executes responses |
| User | Optional in-process component | A DLL loaded into processes to observe API usage |
| Network | Cloud back end | Stores telemetry, correlates across endpoints, hosts the analyst console |
Kernel-mode telemetry sources
Event Tracing for Windows
ETW is the general-purpose tracing facility of Windows. Kernel and user-mode components act as providers and emit events into sessions, which consumers read (see ETW Internals). An EDR agent opens a real-time session and enables the providers it needs:1
| Provider | Events |
|---|---|
Microsoft-Windows-Kernel-Process |
Process and thread start and stop, image loads |
Microsoft-Windows-Kernel-File |
File create, read, write, delete, rename |
Microsoft-Windows-Kernel-Registry |
Registry key and value operations |
Microsoft-Windows-Kernel-Network |
TCP/IP and UDP send, receive, connect |
Microsoft-Windows-Threat-Intelligence |
Security-relevant memory and thread operations, such as allocations and protection changes in remote processes |
Microsoft-Antimalware-Scan-Interface |
Content scanned through AMSI (see AMSI) |
ETW does not need a driver, but it is asynchronous: events are delivered after the fact, through buffers, so ETW can observe but not block. The Threat-Intelligence provider is special: only processes running as PPL Antimalware can consume it (see PP and PPL).2
Kernel notify routines
A kernel driver can register callbacks that the kernel calls synchronously, in the context of the operation, before it completes:3
| Registration API | Called when | Can block? |
|---|---|---|
PsSetCreateProcessNotifyRoutineEx |
A process is created or exits | Yes: the driver can fail process creation |
PsSetCreateThreadNotifyRoutine(Ex) |
A thread is created or exits | No |
PsSetLoadImageNotifyRoutine(Ex) |
An image (EXE or DLL) is mapped | No |
CmRegisterCallbackEx |
A registry operation is performed (pre- and post-operation) | Yes: the operation can be denied |
ObRegisterCallbacks |
A handle to a process, thread or desktop is created or duplicated | Yes: access rights can be removed from the handle |
Synchronous callbacks are what allow an EDR to prevent, not just to
record. The process creation callback receives the image name, the command
line and the parent, and can refuse the creation. The object callbacks see
every OpenProcess and DuplicateHandle on process and thread objects and
can strip rights such as PROCESS_VM_READ or PROCESS_TERMINATE from the
resulting handle; EDRs use them both to detect access to sensitive processes
such as lsass.exe and to protect their own processes (see
The Object Manager).4
File system minifilters
File I/O passes through the Filter Manager (fltmgr.sys), which hosts
minifilter drivers. A minifilter registers with FltRegisterFilter,
starts with FltStartFiltering, and provides pre-operation and
post-operation callbacks for the I/O request types it cares about, such
as IRP_MJ_CREATE, IRP_MJ_READ, IRP_MJ_WRITE and
IRP_MJ_SET_INFORMATION (renames and deletions).5
Minifilters are ordered by altitude, a number assigned by Microsoft that determines their position in the stack; antivirus filters use a dedicated altitude range. A pre-operation callback can deny an operation, for example an attempt to open a file that has just been classified as malicious, or the mass rewriting of files that characterizes ransomware.6
Network filtering
Network visibility and control come from the Windows Filtering Platform
(WFP). A callout driver registers callouts with the filter engine
(FwpsCalloutRegister) and attaches them to filtering layers, such as the
Application Layer Enforcement (ALE) connect and accept layers. At these
layers the callout learns which process opens which connection and can
permit or block it, which is how an EDR isolates a host or blocks
connections to known malicious infrastructure.7
User-mode components
The agent service
The agent is a Windows service that receives events from ETW and from its driver (usually through a filter communication port or IOCTLs) and turns them into usable telemetry:
- the telemetry engine normalizes events and enriches them: process tree, command line, user and logon session, file hashes and signatures;
- the detection layer evaluates rules, behavioural models and reputation against the enriched stream, often across several events (for example, an Office process that spawns a script interpreter, which then connects to the network);
- the response layer executes actions: terminating a process, quarantining a file, collecting artefacts, isolating the host through the WFP driver.
In-process components
Some products also load a DLL into processes and intercept selected API calls in user mode. This gives fine-grained information, such as the arguments of specific calls, but the component runs inside the process it observes, at the same privilege level as the code it monitors. For this reason, modern sensors treat in-process data as supplementary and rely primarily on kernel callbacks and on ETW, in particular the Threat-Intelligence provider, which are outside the reach of a user-mode process.
The cloud back end
Telemetry is sent to a cloud console or to a SIEM, where it is stored, correlated across endpoints and enriched with threat intelligence. Analysts investigate and trigger responses from there, and policy changes flow back to the agents.
Self-protection
A sensor is useful only if it keeps running and reporting. EDRs combine several platform features to protect themselves:
| Feature | Protection |
|---|---|
| Early Launch Antimalware (ELAM) driver | Starts before other boot-start drivers and allows the vendor’s service to run as PPL8 |
| PPL Antimalware service | The agent cannot be injected into or terminated through normal APIs, even by administrators2 |
| Object callbacks | Strip dangerous rights from handles opened to the agent’s processes |
| Registry and file filters | Protect the agent’s configuration and binaries |
| Tamper protection | Prevents local changes to the security configuration |
Verifying a sensor
Experiment: what is watching this system?
The minifilters loaded on the system and their altitudes are listed by
fltmc(elevated):9
1 2 fltmc filters # loaded minifilters, altitudes, instances fltmc instances # which volumes each filter is attached toThe real-time ETW sessions, including those of security products, are listed by
logman:
1 logman query -etsThe protection level of a security service, and the status of Microsoft Defender, can be checked with:
1 2 sc.exe qprotection WinDefend Get-MpComputerStatus | Select-Object AMRunningMode, RealTimeProtectionEnabled, IsTamperProtected
Telemetry about the sensor
Defenders should monitor the sensor itself, since an attacker who wants to operate undetected will try to blind it first:
| Signal | Source |
|---|---|
| The agent service stopped or changed start type | System log 7036, 7040; 4697 for new services |
| A driver loaded, in particular a known vulnerable one | Sysmon 6, Code Integrity log; the Microsoft vulnerable driver blocklist10 |
| A minifilter unloaded or detached | fltmc inventory drift; Filter Manager events in the System log |
| An ETW session stopped or a provider disabled | Inventory of logman query -ets; gaps in telemetry |
| The endpoint stops reporting | Sensor health dashboards in the EDR console |
MITRE ATT&CK catalogues these behaviours under Impair Defenses (T1562), whose sub-techniques include disabling security tools and interfering with event logging and tracing.11 The kernel-level attacks against callbacks and protected processes generally require loading a driver, which is why HVCI and the vulnerable driver blocklist are as important for the EDR as for the rest of the system.
Summary
An EDR sensor combines asynchronous sources, the ETW providers of the
kernel and of Windows components, with synchronous ones: process, thread,
image, registry and object callbacks, file system minifilters and WFP
callouts, all registered by its kernel driver through documented APIs. The
synchronous sources allow the sensor to block operations, not just record
them. A user-mode agent service, usually running as PPL Antimalware
thanks to its ELAM driver, consumes, enriches and correlates the events,
runs detections and executes responses, while a cloud back end gives
analysts a fleet-wide view. Because the sensor is a prime target, defenders
should verify its health with fltmc, logman and service and driver
telemetry, and protect the kernel with HVCI and the driver blocklist.
References
-
Microsoft Learn, Event Tracing for Windows (ETW). ↩︎
-
Microsoft Learn, Protecting Anti-Malware Services. ↩︎ ↩︎2
-
Microsoft Learn, PsSetCreateProcessNotifyRoutineEx function (ntddk.h). ↩︎
-
Microsoft Learn, ObRegisterCallbacks function (wdm.h). ↩︎
-
Microsoft Learn, Filter Manager concepts. ↩︎
-
Microsoft Learn, Load order groups and altitudes for minifilter drivers. ↩︎
-
Microsoft Learn, Windows Filtering Platform callout drivers. ↩︎
-
Microsoft Learn, Overview of Early Launch AntiMalware. ↩︎
-
Microsoft Learn, Microsoft recommended driver block rules. ↩︎
-
MITRE ATT&CK, Impair Defenses (T1562). ↩︎