Skip to content

Lesson 7 of 14 · 13m

Sysmon Is Its Config

Default Sysmon logs almost nothing useful — ProcessGuid beats PID reuse, and the config's include/exclude rules are the product.

Sysmon is a kernel driver plus a service that emits structured XML into Microsoft-Windows-Sysmon/Operational. Install it with no config and you get process creation and termination — the 20% of coverage nobody was missing anyway. The config file is the product: it decides which of the two-dozen event types fire, and on which images, paths, and destinations.

The events that carry a hunt: 1 process create — ProcessGuid, ParentProcessGuid, CommandLine, ParentCommandLine, Hashes including imphash. 3 network connection, keyed to ProcessGuid. 7 image load. 8 CreateRemoteThread — injection's front door. 10 ProcessAccess — source and target ProcessGuid plus GrantedAccess. 11 FileCreate. 12/13/14 registry key and value operations. 15 FileCreateStreamHash — alternate data streams, including the MOTW that marks downloaded files. 17/18 named pipe create/connect — PsExec's \pipe\PSEXESVC and Cobalt Strike's post-ex pipes live here. 19/20/21 WMI event filter, consumer, and binding — the fileless-persistence trio. 22 DNS query, resolved name and result, per process. 23/26 file deletes. 25 process tampering — hollowing and herpaderping.

PID is not an identity

Windows reuses process IDs constantly — a PID is a slot, not a person. ProcessGuid is computed from the machine GUID, the process start time, and the PID, which makes it unique per boot across the fleet and immune to reuse. Every downstream Sysmon event that a process causes — the connection in event 3, the DNS lookup in 22, the file in 11 — carries the same ProcessGuid. That is what turns five log types into one execution record. Correlating on PID+Image instead will silently join your suspect to whatever innocent process took the slot after it exited.

Config philosophy, stated honestly

The two canonical starting points are SwiftOnSecurity's community config — exclusion-driven, tuned to stay quiet — and Olaf Hartong's sysmon-modular — include-driven, logs aggressively and expects you to tune. Inclusion-first catches the novel path and costs you volume and a few percent CPU on noisy endpoints; exclusion-first is cheap and has holes shaped exactly like whatever you excluded. On servers, include-heavy is usually right — the box's job is to be watched. On fleet workstations, start exclusion-heavy and grow includes for the things hunts keep asking for: ProcessAccess into lsass.exe, image loads from user-writable paths, DNS from anything that isn't the browser.

The payoff is concrete. rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump <pid> C:\dump.bin full dumps LSASS using a signed Microsoft DLL — every IOC feed misses it and every hash is Microsoft's. One Sysmon 10 rule — TargetImage lsass.exe, GrantedAccess 0x1010/0x1410/0x1fffff — catches it and every future LSASS-dump tool, named or not. That single rule is a TTP detection that costs one line of XML.

Deploy a baseline, sysmon64 -c config.xml to reload, audit event volume by type for a week, then tune by frequency — not by vibes. And keep a copy of the config in git; the day you need to answer "when did we start logging DNS?" you will be glad it has history.

On volume: Sysmon 1 and 11 are the heavy events on noisy endpoints, and the config's onmatch include/exclude rules are where you buy the tradeoff. Include ProcessAccess on lsass.exe unconditionally — it is rare and it is the credential-theft tripwire — and exclude Image paths for your known-noisy but trusted binaries elsewhere. The rule shape that matters most, stated once: target the thing being attacked (TargetImage, TargetFilename), not just the tool doing it.

Two operational facts worth knowing before rollout. First, Sysmon is a sensor, not a filter — it observes and records; it blocks nothing and hides nothing from the observed process. A privileged attacker can unload it (the driver is SysmonDrv, the service is Sysmon64 on current builds), which is why Sysmon service stops and missing telemetry are themselves hunt events. Second, the channel has a size ceiling — a single event record caps around 64KB, and a gigantic command line gets truncated. The truncation is silent. If a powershell -enc blob looks cut, it is; go check the file it was loading instead.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.