Sysmon in Wazuh: the Operational channel, win.eventdata fields and the rule chain
How Wazuh ingests the Sysmon Operational channel as eventchannel: the 60000, 60004 and 61600 rule chain, win.eventdata fields and a custom child rule.
Sysmon records Windows system activity in the event log, and Wazuh can collect it from the Operational channel as EventChannel. Collecting the channel does not mean every event creates an alert, though: most built-in rules for specific event IDs have level 0.
What Sysmon records
System Monitor, or Sysmon, is a Windows system service and driver. It stays active across reboots and monitors system activity, writing it to the Windows event log. Microsoft lists, among other things, process creation, network connections and changes to file creation time. Sysmon can record the full command line of a process and its parent, process and session GUIDs, driver and library loads with signatures and hashes, and opens of disks and volumes for raw reads.
Features include SHA1, MD5, SHA256 and IMPHASH hashes, with SHA1 as the default algorithm. Network connection logging can include source and destination IP addresses, ports and host names. Sysmon can also reload its configuration after a registry change, apply include or exclude filters and capture activity early in the boot process. Sysmon itself does not analyze the events it produces, and it does not try to hide from attackers.
The basic syntax for installing and updating the configuration looks like this:
sysmon64 -i [<configfile>]
sysmon64 -c [<configfile>]
An install with -i can take a configuration file, and -c updates the configuration. The -m switch installs the event manifest, and -s prints the schema. -u uninstalls Sysmon; the syntax allows an optional force argument. The -accepteula flag accepts the license agreement during installation, otherwise an interactive prompt appears. The service writes events immediately, and the driver is installed as a boot-start driver so it can capture early activity. Neither installing nor uninstalling requires a reboot.
The configuration file has a root element Sysmon, and filter rules sit in EventFiltering. Configuration entries go directly under Sysmon. The onmatch attribute takes include to log only matching events, or exclude to log events except the matching ones. Conditions on the same field combine as OR, and conditions on different fields as AND. The configuration schema has a version number independent of the Sysmon binary version.
Sysmon event IDs
Microsoft documents the following event IDs and names:
| ID | Event name |
|---|---|
| 1 | Process creation |
| 2 | A process changed a file creation time |
| 3 | Network connection |
| 4 | Sysmon service state changed |
| 5 | Process terminated |
| 6 | Driver loaded |
| 7 | Image loaded |
| 8 | CreateRemoteThread |
| 9 | RawAccessRead |
| 10 | ProcessAccess |
| 11 | FileCreate |
| 12 | RegistryEvent (Object create and delete) |
| 13 | RegistryEvent (Value Set) |
| 14 | RegistryEvent (Key and Value Rename) |
| 15 | FileCreateStreamHash |
| 16 | ServiceConfigurationChange |
| 17 | PipeEvent (Pipe Created) |
| 18 | PipeEvent (Pipe Connected) |
| 19 | WmiEvent (WmiEventFilter activity detected) |
| 20 | WmiEvent (WmiEventConsumer activity detected) |
| 21 | WmiEvent (WmiEventConsumerToFilter activity detected) |
| 22 | DNSEvent (DNS query) |
| 23 | FileDelete (File Delete archived) |
| 24 | ClipboardChange (New content in the clipboard) |
| 25 | ProcessTampering (Process image change) |
| 26 | FileDeleteDetected (File Delete logged) |
| 27 | FileBlockExecutable |
| 28 | FileBlockShredding |
| 29 | FileExecutableDetected |
| 255 | Error |
The Operational channel is available at the log path Applications and Services Logs/Microsoft/Windows/Sysmon/Operational on Windows Vista and later. On older systems, Sysmon writes to the System log. The short channel name used in the Wazuh configuration is Microsoft-Windows-Sysmon/Operational. Sysmon event timestamps are in UTC.
Collecting the channel in Wazuh
Wazuh configures event collection through a localfile block. For Sysmon, give the channel name and the eventchannel format:
<localfile>
<location>Microsoft-Windows-Sysmon/Operational</location>
<log_format>eventchannel</log_format>
</localfile>
Limiting the collected events is covered in the article on EventChannel filtering.
The rule chain from channel to event ID
The built-in Windows rules form several matching levels. Rule 60000 is the level 0 base rule for windows_eventchannel events. Rule 60004, also level 0, recognizes the Sysmon channel Microsoft-Windows-Sysmon/Operational. Then rules 61600, 61601 and 61602 classify the event by win.system.severityValue: INFORMATION, WARNING and ERROR respectively.
Rule 61600 has level 0, 61601 has level 0, and 61602 has level 5. The informational event rules 61603-61617 and 61644-61655 are children of 61600 and check a specific event ID. Each adds a group such as sysmon_event1 or sysmon_event_10, which later rules can use.
The table below shows the mapping of IDs to the built-in per-event rules. Each rule checks win.system.eventID with a single expression, for example ^1$ in rule 61603 and ^10$ in rule 61612.
| Event ID | Per-event rules | Level |
|---|---|---|
| 1-15 | 61603-61617, in order | 0 |
| 16-26 | 61644-61654, in order | 0 |
| 255 | 61655 | 0 |
The per-event rules do not cover IDs 27, 28 and 29 from the Microsoft table.
Level 0 in the Wazuh classification means an ignored event for which no action is taken; this level is used to avoid false alarms.
Built-in rules above level 0
In the Sysmon rules file, the rules above level 0 are the error rule 61602, thirteen process anomaly rules at level 12 and two aggregating rules for errors and warnings at level 10. Rule 61602 belongs to the groups system_error and gpg13_4.3, and also gdpr_IV_35.7.d.
The built-in process anomaly rules have level 12. Each uses if_group with the sysmon_event1 group, sits in the block <group name="windows,sysmon,sysmon_process-anomalies,"> and carries the MITRE ID T1055. They also carry the compliance groups pci_dss_10.6.1, pci_dss_11.4, gdpr_IV_35.7.d, hipaa_164.312.b, nist_800_53_AU.6, nist_800_53_SI.4, tsc_CC7.2, tsc_CC7.3, tsc_CC6.1 and tsc_CC6.8. Some have a level 0 child rule that matches the parent process image value.
| Rule | Field | Value |
|---|---|---|
| 61618 | win.eventdata.image | svchost.exe |
| 61620 | win.eventdata.image | lsm.exe |
| 61622 | win.eventdata.parentImage | lsm.exe |
| 61623 | win.eventdata.image | csrss.exe |
| 61625 | win.eventdata.image | lsass.exe |
| 61627 | win.eventdata.parentImage | lsass.exe |
| 61628 | win.eventdata.image | winlogon.exe |
| 61630 | win.eventdata.image | wininit.exe |
| 61632 | win.eventdata.image | smss.exe |
| 61634 | win.eventdata.image | taskhost.exe |
| 61636 | win.eventdata.image | /services.exe |
| 61638 | win.eventdata.image | dllhost.exe |
| 61640 | win.eventdata.image | \\explorer.exe |
Rules 61642 and 61643 have level 10, frequency="$MS_FREQ" and no_full_log. The first points to if_matched_sid 61601, the second to 61602, and their windows are 120 and 240 seconds respectively. The MS_FREQ variable has the value 8 in the rules file. Details on thresholds and how to interpret levels are in a separate post on rule levels and thresholds.
Fields and a custom child rule
Examples of EventChannel rules use the win.eventdata.* namespace. The built-in matches include win.eventdata.image and win.eventdata.parentImage, among others. The event ID is checked in win.system.eventID.
The custom rule below has the example ID 100001 and checks the process image; the path is an example.
<group name="windows,sysmon,">
<rule id="100001" level="10">
<if_sid>61603</if_sid>
<field name="win.eventdata.image">C:\\example\\tool.exe</field>
<description>Illustrative Sysmon process match</description>
</rule>
</group>
if_sid ties the rule to the result of 61603, the match of process event ID 1. The field condition limits the match to the given win.eventdata.image value. The backslash is written twice, as in the \\explorer.exe value of the built-in rule 61640.
Text format decoders
The Wazuh decoder file also has Sysmon decoders for the text format WinEvtLog: Microsoft-Windows-Sysmon/Operational. They use the sysmon.* namespace.
What the documentation does not specify
Wazuh gives no recommended Sysmon configuration for the integration and no Sysmon performance impact at large scale. The documentation does not state which Sysmon event IDs are filtered or disabled by default. The mapping of field names from native Sysmon events to decoded names is shown through examples, without a general description of the transformation or of case sensitivity. It is also unknown whether the MS_FREQ value is configurable or recommended. The general rules reference excludes level 0 from if_matched_sid, but rule 61642 points to 61601, which has level 0 in the Sysmon file; the documentation does not explain this discrepancy.
Sources
- https://learn.microsoft.com/en-us/sysinternals/downloads/sysmon
- https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/configuration.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html
- https://documentation.wazuh.com/current/user-manual/ruleset/rules/rules-classification.html
- https://documentation.wazuh.com/current/user-manual/ruleset/ruleset-xml-syntax/rules.html
- https://github.com/wazuh/wazuh/blob/v4.14.10/ruleset/rules/0575-win-base_rules.xml
- https://github.com/wazuh/wazuh/blob/v4.14.10/ruleset/rules/0595-win-sysmon_rules.xml
- https://github.com/wazuh/wazuh/blob/v4.14.10/ruleset/decoders/0380-windows_decoders.xml