Chapter 57

Sysmon Internals

How Sysmon's driver captures kernel-level events, all 29 event types, config XML tuning, and the detection coverage every SOC should be measuring.

Scenario

A Cobalt Strike beacon lands on a workstation via a malicious Office macro. It never touches disk with its shellcode — it injects directly into a running process. Windows Event Log shows a new process (4688) for winword.exe, then nothing. No network connection events. No file writes. But Sysmon Event 8 shows CreateRemoteThread from winword.exe into explorer.exe. Event 3 shows a network connection from explorer.exe to 185.234.x.x:443. Event 22 shows a DNS lookup for a domain registered three days ago. The native Windows logs told you nothing; Sysmon built the entire kill chain.

How Sysmon Works

Sysmon is a Windows system service and device driver that installs into the OS and persists across reboots. It operates at three levels:


  Sysmon Architecture
  ══════════════════════════════════════════════════════════════════

  User Mode                           Kernel Mode
  ─────────                           ───────────
  ┌───────────────────┐               ┌─────────────────────────┐
  │  Sysmon.exe       │               │  SysmonDrv.sys          │
  │  (service process)│               │  (kernel driver)        │
  │                   │   IOCTL       │                         │
  │  Reads config     │◄──────────────│  Minifilter (FSFilter)  │
  │  Writes EVTX      │               │  → file creates/renames │
  │  via ETW          │               │                         │
  └───────────────────┘               │  Kernel callbacks:      │
                                      │  PsSetCreateProcess     │
          ETW                         │  NotifyRoutine          │
  ┌───────────────────┐               │  → process create/term  │
  │  Microsoft-Windows│◄──────────────│                         │
  │  -Sysmon ETW      │               │  ObRegisterCallbacks    │
  │  Provider         │               │  → process/thread handle│
  └───────────────────┘               │                         │
          │                           │  CmRegisterCallback     │
          ▼                           │  → registry operations  │
  ┌────────────────────────────┐      │                         │
  │  Sysmon EVTX channel       │      │  WFP callout (optional) │
  │  (Operational)             │      │  → network connections  │
  └────────────────────────────┘      └─────────────────────────┘

    

The driver intercepts operations at kernel level — before user-mode code can hide or tamper with them. This is why Sysmon sees injection techniques that native event logging misses.

All 29 Sysmon Event Types

IDNameCapturesDetection Value
1ProcessCreateProcess creation — hash, command line, parent, user, integrity level⭐⭐⭐⭐⭐ Core hunting event
2FileCreationTimeChangedTimestomping — file modify time changed by a process⭐⭐⭐ Anti-forensics detection
3NetworkConnectTCP/UDP connections with process, IP, port, hostname (DNS resolution)⭐⭐⭐⭐⭐ C2 beaconing detection
4ServiceStateChangedSysmon service started/stopped⭐ Tamper detection only
5ProcessTerminateProcess exit with PID⭐⭐ Short-lived process correlation
6DriverLoadDriver loaded — hash, signature status⭐⭐⭐⭐ BYOVD detection (unsigned drivers)
7ImageLoadDLL loaded into a process — hash, signature, path⭐⭐⭐⭐ DLL injection, reflective DLL
8CreateRemoteThreadCross-process thread creation — source/target PID, start address⭐⭐⭐⭐⭐ Process injection signature
9RawAccessReadRaw disk read bypassing filesystem (\\.\PhysicalDrive, \\.\C:)⭐⭐⭐ MBR access, disk forensics bypass
10ProcessAccessProcess handle opened with specific access rights (e.g., PROCESS_VM_READ)⭐⭐⭐⭐⭐ LSASS dump detection
11FileCreateFile created or overwritten — includes temp files, dropped payloads⭐⭐⭐⭐ Dropper detection
12RegistryEventObjectCreateDeleteRegistry key created or deleted⭐⭐⭐ Persistence via new keys
13RegistryEventValueSetRegistry value set (DWORD/QWORD/binary/string)⭐⭐⭐⭐ RunKey persistence writes
14RegistryEventKeyAndValueRenameRegistry key or value renamed⭐⭐ Evasion via key rename
15FileCreateStreamHashNTFS Alternate Data Stream (ADS) creation + hash⭐⭐⭐ ADS-based payload storage
16ServiceConfigurationChangeSysmon configuration changed⭐ Tamper detection
17PipeEventCreatedNamed pipe server created⭐⭐⭐⭐ Cobalt Strike default pipe names
18PipeEventConnectedNamed pipe client connection⭐⭐⭐⭐ C2 pipe comms
19WmiEventFilterWMI __EventFilter created⭐⭐⭐⭐⭐ WMI persistence detection
20WmiEventConsumerWMI __EventConsumer created⭐⭐⭐⭐⭐ WMI persistence detection
21WmiEventConsumerToFilterWMI __FilterToConsumerBinding created⭐⭐⭐⭐⭐ WMI persistence detection
22DNSEventDNS query from process — name, result, query type⭐⭐⭐⭐⭐ DGA, C2 domain detection
23FileDeleteFile deletion — optional archive of deleted file content⭐⭐⭐ Dropper cleanup detection
24ClipboardChangeClipboard content changes (enabled only in config)⭐⭐ Clipboard hijacking
25ProcessTamperingProcess image manipulation — hollowing, herpaderping detection⭐⭐⭐⭐⭐ Fileless malware hollowing
26FileDeleteDetectedFile delete detected (lighter than Event 23)⭐⭐⭐ Payload cleanup
27FileBlockExecutableBlocked executable file creation (rule-based blocking)⭐⭐⭐ Active blocking
28FileBlockShreddingBlocked file shredding by a process⭐⭐⭐ Ransomware / anti-forensics
29FileExecutableDetectedExecutable file detected in monitored directory⭐⭐⭐ Dropper in monitored paths

Configuration XML

Sysmon's power is in its config file. Without a config, Sysmon generates enormous noise (every DNS query, every network connection). A tuned config focuses on high-signal events and filters benign activity.

XMLsysmon-config.xml (excerpt)
<Sysmon schemaversion="4.90">

  <!-- Hash algorithm for file/process hashes -->
  <HashAlgorithms>md5,sha256,imphash</HashAlgorithms>
  <CheckRevocation/>  <!-- Check driver cert revocation -->

  <EventFiltering>

    <!-- Event 1: Process Creation
         onmatch="include" = only log matching events
         onmatch="exclude" = log everything EXCEPT matches -->
    <RuleGroup name="process_create" groupRelation="or">
      <ProcessCreate onmatch="exclude">
        <!-- Exclude noisy but benign processes -->
        <Image condition="is">C:\Windows\System32\svchost.exe</Image>
        <Image condition="is">C:\Windows\System32\taskhostw.exe</Image>
        <Image condition="contains">antivirus</Image>
      </ProcessCreate>
    </RuleGroup>

    <!-- Event 3: Network connections
         Exclude common legitimate network traffic -->
    <RuleGroup name="network_connect" groupRelation="or">
      <NetworkConnect onmatch="exclude">
        <Image condition="is">C:\Windows\System32\svchost.exe</Image>
        <DestinationPort condition="is">53</DestinationPort>
        <DestinationIp condition="is">127.0.0.1</DestinationIp>
      </NetworkConnect>
    </RuleGroup>

    <!-- Event 8: CreateRemoteThread — INCLUDE specific suspicious targets -->
    <RuleGroup name="remote_thread" groupRelation="or">
      <CreateRemoteThread onmatch="include">
        <!-- Injection into system processes is suspicious -->
        <TargetImage condition="is">C:\Windows\System32\lsass.exe</TargetImage>
        <TargetImage condition="is">C:\Windows\System32\csrss.exe</TargetImage>
        <TargetImage condition="is">C:\Windows\explorer.exe</TargetImage>
        <TargetImage condition="is">C:\Windows\System32\svchost.exe</TargetImage>
        <StartFunction condition="is">LoadLibraryA</StartFunction>
        <StartFunction condition="is">LoadLibraryW</StartFunction>
      </CreateRemoteThread>
    </RuleGroup>

    <!-- Event 10: Process access (LSASS dumping detection) -->
    <RuleGroup name="process_access" groupRelation="or">
      <ProcessAccess onmatch="include">
        <TargetImage condition="is">C:\Windows\System32\lsass.exe</TargetImage>
        <GrantedAccess condition="is">0x1010</GrantedAccess>  <!-- PROCESS_VM_READ + PROCESS_QUERY_INFO -->
        <GrantedAccess condition="is">0x1410</GrantedAccess>
      </ProcessAccess>
    </RuleGroup>

    <!-- Event 17/18: Pipe events (Cobalt Strike detection) -->
    <RuleGroup name="pipe_events" groupRelation="or">
      <PipeEvent onmatch="include">
        <PipeName condition="contains">msagent_</PipeName>
        <PipeName condition="contains">MSSE-</PipeName>
        <PipeName condition="contains">postex_</PipeName>
        <PipeName condition="contains">status_</PipeName>
        <PipeName condition="contains">\svcctl</PipeName>
      </PipeEvent>
    </RuleGroup>

  </EventFiltering>

</Sysmon>

Config Conditions Reference

ConditionBehavior
isExact case-insensitive match
is notNot exactly this value
containsSubstring match
contains allAll comma-separated values present
contains anyAny comma-separated value present
excludesDoes not contain substring
begin withStarts with value
end withEnds with value
less thanNumeric less than
greater thanNumeric greater than
imageProcess image name only (not full path)

MITRE ATT&CK Coverage Map

ATT&CK TechniquePrimary Sysmon EventsKey Fields
T1059 — Command Execution (PS/cmd)1 (ProcessCreate)CommandLine, Image, ParentImage
T1055 — Process Injection8 (RemoteThread), 10 (ProcessAccess), 7 (ImageLoad)SourceImage, TargetImage, GrantedAccess
T1053 — Scheduled Task1 (schtasks.exe), 13 (registry), 11 (task XML)CommandLine with /create, task path in registry
T1547.001 — RunKey Persistence13 (RegistryValueSet)TargetObject contains \Run\, Details
T1003.001 — LSASS Dump10 (ProcessAccess)TargetImage=lsass.exe, GrantedAccess 0x1410
T1071 — C2 over HTTP/S3 (NetworkConnect), 22 (DNS)DestinationIp, DestinationPort, QueryName
T1140 — Deobfuscate/Decode1 (certutil -decode), 11 (output file)CommandLine contains decode/deobfuscate
T1014 — Rootkit / Driver6 (DriverLoad)Signed=false, ImageLoaded path
T1546.003 — WMI Persistence19, 20, 21Consumer, Filter, Binding objects
T1218 — LOLBin Execution1 (ProcessCreate)Image=mshta.exe/wscript.exe/certutil.exe etc.
T1485 — Timestomping2 (FileCreationTimeChanged)TargetFilename, CreationUtcTime vs PreviousCreation
T1071.004 — DNS C222 (DNSEvent)QueryName (long/random subdomain), QueryStatus

Sysmon Blind Spots

Common mistake

Treating Sysmon as a complete security solution. It closes many gaps that native Windows logging leaves open, but has its own blindspots that sophisticated attackers actively exploit.

Blind SpotWhy Sysmon Misses ItBetter Coverage
Direct syscalls bypassing ntdllSysmon hooks operate via ETW and kernel callbacks, but some coverage depends on user-mode hooks that direct syscalls bypassEDR kernel sensor, ETW-TI
Encrypted shellcode in memorySysmon can't inspect memory content — it sees handles and network connections, not encrypted payloadsMemory scanning, behavioral EDR
WFP-bypassing network techniques (raw NDIS)Event 3 uses WFP; NDIS-level manipulation bypasses WFP entirelyNetwork sensor / NDR
COM-based process creation (no direct CreateProcess)ShellExecute via COM may not generate a standard process creation event chain visible in parent trackingSysmon Event 1 still captures the child
Very fast/short-lived processes (sub-millisecond)Timing edge cases may miss rapid create/terminateETW process events have faster hooks
Sysmon driver unloading / service stopOnce the driver is unloaded, all coverage stopsMonitor Event 4 (Sysmon stopped) as an immediate alert
Reflective DLL without touching diskEvent 7 only fires when the DLL appears in the module list; some reflective loaders avoid thisEvent 8 (RemoteThread) still fires

Deployment and Tuning Strategy

Why this matters

Sysmon without tuning generates 500–2000 events per minute on a busy endpoint. With tuning (especially excluding noisy Events 3 and 13 for known-good processes), a well-configured endpoint generates 50–200 events/minute of high-signal data. The community Sysmon configuration by @SwiftOnSecurity or the Olaf Hartong modular config are good starting points.

Deployment at scale:

Q & A

Q: An attacker dumps LSASS using a custom tool that avoids MiniDumpWriteDump. Will Sysmon Event 10 still fire?

Yes, if the tool opens a handle to lsass.exe with read permissions. Event 10 fires on the handle open (OpenProcess API call) — it doesn't care which dump API is used afterward, or even if no standard API is used. The critical field is GrantedAccess — the attacker needs at minimum PROCESS_VM_READ (0x0010) and PROCESS_QUERY_INFORMATION (0x0400), giving 0x0410. Many custom tools use 0x1410 (adds PROCESS_VM_OPERATION). Alert on any non-lsass, non-system process opening lsass.exe with GrantedAccess containing 0x10.

Q: How do you detect process hollowing with Sysmon?

Sysmon Event 25 (ProcessTampering) is the dedicated event — it fires when Sysmon detects that a process's image on disk doesn't match what's mapped in memory (a classic sign of hollowing). Additionally: Event 8 (CreateRemoteThread) with start address in an unusual region, Event 10 (ProcessAccess with PROCESS_VM_WRITE access rights 0x20/0x28), and Event 1 where the parent-child relationship is suspicious (e.g., winword.exe spawning svchost.exe). Correlate all three for high confidence.

Q: What Sysmon events catch the three stages of Cobalt Strike's SMB pipe-based lateral movement?

Stage 1 — Service creation on target (PsExec-style): Sysmon Event 13 (registry write to Services key) + Event 1 (services.exe starting the new service). Stage 2 — Pipe comms: Sysmon Event 17 (pipe created by the service binary) + Event 18 (client connection). Default CS pipe names include MSSE-<4chars>-server, msagent_<hex>, status_<hex>. Stage 3 — Beacon execution: Event 8 (RemoteThread from the service into a host process) or Event 25 (process tampering if hollowing is used).

Q: Why does Sysmon's Event 3 (NetworkConnect) show DNS hostnames for some connections but not others?

Sysmon intercepts network connections at WFP callout level and attempts to resolve the destination IP back to a hostname using the Windows DNS cache. If the DNS query happened recently and is still cached, the hostname is resolved. If the connection is to an IP that was never DNS-queried (hardcoded IP in malware, or DNS was flushed), only the IP appears. This is why correlating Event 3 with Event 22 (DNSEvent, which captures the query before the connection) gives a more complete picture — the lookup happens before the connection, so the hostname is available in the DNS event even when it's not in the network event.