TExcelTAD

EDR and XDR: Concepts and Telemetry

Antivirus asks one question about a file: is it known to be bad? Modern intrusions often never drop a known-bad file: they use PowerShell, built-in admin tools, stolen credentials and code that lives only in memory. Endpoint detection and response (EDR) watches behaviour on every endpoint, records it as telemetry the SOC can search, and lets responders act on the machine remotely. XDR (extended detection and response) joins endpoint telemetry with identity, e-mail, cloud and network data in one place. This lesson explains how EDR collects what it collects, what the telemetry looks like, and rebuilds a process tree from raw EDR events, which is the first view every analyst opens.

How an EDR agent sees the system

An EDR agent (Microsoft Defender for Endpoint, CrowdStrike Falcon, SentinelOne, Elastic Defend, Sophos, Trend Micro and others; the open-source Wazuh and osquery cover parts of it) combines several sensors:

Sensor (Windows terms; Linux and macOS have equivalents) Sees
Kernel callbacks for process and thread creation and image loads every process start with parent, command line, user; every DLL/driver load
File-system minifilter file creation, modification, renames, deletions (and ransomware-like mass changes)
Registry callbacks changes to autostart and configuration keys
Network filtering (WFP) connections per process, with destination and port
Event Tracing for Windows (ETW) providers, including the security-focused threat-intelligence provider API activity such as remote memory allocation, PowerShell and .NET activity
AMSI script content after de-obfuscation, as the script engine runs it
User-mode hooks (less used now) API calls inside processes

On Linux, agents use eBPF programs or the audit subsystem (Sysmon and auditd); Sysmon for Linux uses eBPF too. Everything is tagged with a process identity that survives PID reuse (a GUID or a PID plus start time), so events can be joined into trees and timelines.

What the SOC gets

  • Detections: the vendor's behaviour rules and machine-learning models, mapped to ATT&CK, plus your own custom rules on the telemetry.
  • Telemetry: searchable events (process, file, registry, network, module load, logon) for a retention period, typically 30 days or more.
  • Response actions: isolate the host from the network (keeping the EDR channel open), kill a process, quarantine a file, collect a forensic package, run a script, and on some products roll back file changes.
  • Prevention: blocking known-bad files and behaviours before they complete (the "protection" half of most products).

XDR adds other domains: the identity provider's risky sign-ins, the mail gateway's delivered phishing, cloud audit events, network sensor alerts, correlated into incidents per user and host. In practice it is a vendor's integrated stack or a SIEM with good entity correlation (A Correlation Engine in pandas); the idea is the same.

Rebuilding a process tree

EDR process events carry the process's own identifier and its parent's. A tree built from them shows the chain an alert sits in, which usually decides the triage. The program rebuilds the tree on ws15 from synthetic events and marks nodes that match simple behaviour rules. It also shows why PIDs alone are not enough.

python · try it yourself
EVENTS = [  # (guid, parent_guid, pid, ppid, image, command_line, user)
    ("g01", None,  612, 0,    "services.exe",  "", "SYSTEM"),
    ("g02", None,  4120, 0,   "explorer.exe",  "", "erin"),
    ("g03", "g02", 6604, 4120, "outlook.exe",   "outlook.exe", "erin"),
    ("g04", "g02", 7012, 4120, "winword.exe",   "winword.exe /n C:\\Users\\erin\\Downloads\\invoice-0115.docm", "erin"),
    ("g05", "g04", 7340, 7012, "powershell.exe", "powershell -nop -w hidden -enc SQBFAFgA...", "erin"),
    ("g06", "g05", 7392, 7340, "rundll32.exe",  "rundll32.exe C:\\Users\\Public\\lib.dll,Start", "erin"),
    ("g07", "g06", 7420, 7392, "whoami.exe",    "whoami /all", "erin"),
    ("g08", "g06", 7436, 7392, "nltest.exe",    "nltest /dclist:lab.test", "erin"),
    ("g09", "g02", 7012, 4120, "notepad.exe",   "notepad.exe notes.txt", "erin"),        # PID 7012 reused later
    ("g10", "g01", 8120, 612,  "svchost.exe",   "svchost.exe -k netsvcs", "SYSTEM"),
]
RULES = [
    ("office spawned script host", lambda p, c: p and p[4] in {"winword.exe", "excel.exe", "outlook.exe"} and c[4] in {"powershell.exe", "cmd.exe", "wscript.exe", "mshta.exe"}),
    ("encoded command",            lambda p, c: " -enc " in c[5]),
    ("rundll32 from user-writable path", lambda p, c: c[4] == "rundll32.exe" and "\\users\\public\\" in c[5].lower()),
    ("discovery command",          lambda p, c: c[4] in {"whoami.exe", "nltest.exe", "net.exe", "ipconfig.exe"}),
]
by_guid = {e[0]: e for e in EVENTS}
children = {}
for e in EVENTS:
    children.setdefault(e[1], []).append(e)

def show(e, depth=0):
    parent = by_guid.get(e[1])
    hits = [name for name, test in RULES if test(parent, e)]
    mark = "  <-- " + ", ".join(hits) if hits else ""
    print(f"{'    ' * depth}{e[4]} (pid {e[2]}) {e[5][:62]}".rstrip() + mark)
    for c in children.get(e[0], []):
        show(c, depth + 1)

for root in children[None]:
    show(root)

# Joining on PIDs instead of GUIDs: which process was PID 7012's child?
owners = [e[4] for e in EVENTS if e[2] == 7012]
print(f"\nby PID: PID 7012 was {owners}; its child powershell.exe is ambiguous between them")
services.exe (pid 612)
    svchost.exe (pid 8120) svchost.exe -k netsvcs
explorer.exe (pid 4120)
    outlook.exe (pid 6604) outlook.exe
    winword.exe (pid 7012) winword.exe /n C:\Users\erin\Downloads\invoice-0115.docm
        powershell.exe (pid 7340) powershell -nop -w hidden -enc SQBFAFgA...  <-- office spawned script host, encoded command
            rundll32.exe (pid 7392) rundll32.exe C:\Users\Public\lib.dll,Start  <-- rundll32 from user-writable path
                whoami.exe (pid 7420) whoami /all  <-- discovery command
                nltest.exe (pid 7436) nltest /dclist:lab.test  <-- discovery command
    notepad.exe (pid 7012) notepad.exe notes.txt

by PID: PID 7012 was ['winword.exe', 'notepad.exe']; its child powershell.exe is ambiguous between them

The tree turns ten events into one readable story. Under explorer.exe (erin's desktop), Word opened a macro-enabled document from Downloads; Word started hidden PowerShell with an encoded command; PowerShell started rundll32.exe loading a DLL from C:\Users\Public, a folder every user can write to; and that process ran whoami and nltest /dclist, the first questions an intruder asks (who am I, where are the domain controllers). Four rules fired on four different nodes, all in one branch, while Outlook, Notepad and the services branch stay clean. An analyst who saw only the "discovery command" alert on whoami.exe would close it as an admin habit; the tree shows where it came from.

The last line shows why EDR events carry GUIDs: Word and the later Notepad both had PID 7012, so a join on PIDs cannot say whose child the PowerShell process was.

How EDR coverage fails, and the fix

Failure How it shows Fix
Hosts without an agent Inventory has more hosts than the EDR console Compare inventories daily; deploy with provisioning; network sensors for unmanaged devices
Agent disabled or tampered with Heartbeat stops; tamper-protection alerts Enable tamper protection; alert on missing heartbeats; restrict local admin rights
Detection-only mode everywhere Attacks seen but not blocked Turn on prevention after a tuning period, starting with high-confidence behaviours
Exclusions too broad Folders or processes excluded "for performance" Review exclusions like allow-lists (Tuning): exact paths, owners, expiry
Telemetry not in the SIEM Analysts pivot between consoles Stream EDR events to the SIEM (or use the XDR's correlation) so identity and network data meet endpoint data

Attackers actively try to blind EDR (stopping services, loading vulnerable drivers to remove kernel callbacks, unhooking user-mode hooks). This course does not teach those techniques; what matters for defenders is that each attempt leaves traces (service stops, driver loads, missing heartbeats from a host that is still on the network) which the SOC must alert on, and that tamper protection and blocking known-vulnerable drivers (Microsoft's vulnerable driver blocklist) make them harder.

Pitfalls

  • Trusting the vendor's detections only. They are generic; your environment's specifics (the service account that never logs on interactively, the server that never runs PowerShell) need custom rules on the telemetry.
  • Short telemetry retention. 30 days of EDR history cannot scope an intrusion that began 60 days ago; forward the important event types to longer storage.
  • Isolating without thinking. Isolating a server stops the business; isolation of servers needs the playbook's approval step (Playbooks and Runbooks).

Practice

1. Which node in the tree would you investigate first, and what would you collect?

rundll32.exe C:\Users\Public\lib.dll,Start: it is the payload the document dropped (a DLL in a world-writable folder) and the parent of the discovery commands. Collect the DLL (hash, quarantine copy), its network connections (EDR network events for that process GUID), and the original invoice-0115.docm with its mail source.

2. Why does the PID-based join fail for PID 7012?

Windows reuses PIDs: Word ran as 7012, exited, and later Notepad got 7012 too. A child whose parent PID is 7012 could belong to either, depending on time. The GUID (or PID plus process start time) identifies one process instance.

3. What would an XDR add to this tree?

The e-mail that delivered invoice-0115.docm (sender, other recipients), erin's sign-ins around that time (any from unusual places), the network sensor's view of ws15's connections, and other hosts where the same DLL hash or the same domain appeared, all correlated into one incident.

Test yourself

What does EDR add beyond classic antivirus?

  1. Faster file scanning only
  2. Behavioural telemetry from every endpoint, behaviour detections and remote response actions
  3. A firewall
  4. Password management

Why do EDR events carry a process GUID or start time and not only a PID?

  1. For encryption
  2. PIDs are reused, so joins on PIDs can attach children to the wrong process
  3. GUIDs are shorter
  4. Because of IPv6

What does the 'X' in XDR extend?

  1. The number of agents
  2. Detection and response across domains: endpoint plus identity, e-mail, cloud and network
  3. Only the retention
  4. The file size limit

Which signal indicates possible EDR tampering on a host that is still online?

  1. High CPU
  2. The agent's heartbeat stops while the host keeps sending other traffic
  3. A new user logs on
  4. Disk is full