fix(sensor): correct Microsoft-Windows-Kernel-File provider GUID#132
Conversation
The KERNEL_FILE_GUID constant had an incorrect final node (edd08927-9cc4-4e65-b970-63462d3f77bd), which is not a registered ETW provider. Enabling an unregistered provider GUID silently succeeds but delivers no events, so no file telemetry was ever produced on Windows and file_event Sigma rules could never fire. The correct Microsoft-Windows-Kernel-File GUID is edd08927-9cc4-4e65-b970-c2560fb5c289, confirmed via `logman query providers "Microsoft-Windows-Kernel-File"`. Verified on Windows 11: with the corrected GUID, the existing keyword (0xE90) and level (4) capture file create/write/rename/delete events and file_event Sigma rules fire as expected. No other change required. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4dc7349 to
82bfe60
Compare
|
I verified the provider on a Windows 11 lab VM with a live ETW capture. The GUID change in this PR is correct: Microsoft-Windows-Kernel-File resolves to The capture also exposed a separate decoder issue:
The current code routes file events using opcode values 64, 65, 70, 71, and 72. With this provider, the opcode is 0, so these events fall through as Modify and normalize to event ID 11. Rename and delete also lose their path because the decoder only reads FileName. I opened #133 with the full evidence and suggested acceptance criteria: Please consider expanding this PR or following it with the event-ID and field-mapping fixes. |
The manifest-based Kernel-File provider emits events with opcode 0, so the previous MOF FileIo opcode routing (64/65/70/71/72) classified every file event as Modify and normalized it to Sysmon event ID 11. - Route file events by manifest event IDs: Create (12), DeletePath (26), RenamePath (27); everything else, including Write (16), stays Modify - Read FilePath for DeletePath/RenamePath/SetLinkPath events, which do not carry a FileName field - Derive the file action code from the routed action so create, write, delete, and rename map onto the shared 64/65/70/71 scheme used by the Linux and macOS sensors - Rename the file keyword constants to match the provider manifest (WRITE 0x200, DELETE_PATH 0x400, RENAME_SETLINK_PATH 0x800); the enabled mask is unchanged (0xE90) - Add unit tests covering event IDs 12, 16, 26, and 27 and the path field selection Fixes Karib0u#133 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@Karib0u Thanks for the live verification and the detailed capture in #133 — that made the decoder fix straightforward. I've expanded this PR to cover it:
I also re-verified end to end on a Windows 11 machine: with per-category Sigma test rules, create fires as |
Summary
1. Correct the provider GUID
KERNEL_FILE_GUIDused an incorrect final node (edd08927-9cc4-4e65-b970-63462d3f77bd), which is not a registered ETW provider. Enabling an unregistered provider GUID silently succeeds but delivers no events, so no file telemetry was ever produced on Windows andfile_eventSigma rules could never fire.edd08927-9cc4-4e65-b970-c2560fb5c289, confirmed vialogman query providers "Microsoft-Windows-Kernel-File".2. Decode manifest events correctly (fixes #133)
As confirmed in the live capture in #133, this manifest provider emits file events with opcode 0, so the previous MOF FileIo opcode routing (64/65/70/71/72) classified every event as Modify → Sysmon event ID 11, and Delete/Rename lost their path:
FilePathfor DeletePath/RenamePath/SetLinkPath events (they carry noFileName); other events keep readingFileName.mapper.rsfrom the routed action so events map onto the shared 64/65/70/71 action-code scheme already used by the Linux and macOS sensors (create/write → Sysmon 11, delete → 23, rename → 71).WRITE0x200,DELETE_PATH0x400,RENAME_SETLINK_PATH0x800). The enabled mask is unchanged (0xE90).Fixes #133
Verification
logman) yields 0 file events for create/write/rename/delete operations (only the trace-session header event).logman+tracerpt(thousands of file events captured).FilePath/FileNameselection, and the action-code/Sysmon-ID mapping.cargo fmt --check,cargo check --locked --target x86_64-pc-windows-gnu, andcargo clippy --locked --all-targets --target x86_64-pc-windows-gnu -- -D clippy::allpass.End-to-end verification of the decoder fix (Windows 11)
Verified this branch (
cbab4ee) live on a Windows 11 (26100) machine:cargo test --lockedpasses (174 tests, 0 failures), including the new Kernel-File routing/mapping tests.rustinel run, admin) with per-category Sigma test rules (file_create/file_change/file_rename/file_delete) matching a test path, then performed create → write → rename → delete on a test file:event.actionevent.codeFileNameFilePathFilePath¹ Writes normalize to event ID 11 and therefore alias to the
file_event/file_createSigma categories — same as the Linux and macOS sensors; the ECSevent.actionstill distinguishes create vs change via the action code.Before this fix, all of these surfaced as
file-change/ event ID 11, and rename/delete carried no path.