Log watchdog integrity failures and drift to the event log - #49
Merged
Merged
Conversation
The watchdog only wrote to a text file in %ProgramData%\Winnow, which a local attacker with access to that box can also edit, and which nothing collects centrally. For a control that runs as SYSTEM and fails closed on tampering, the tamper signal is the thing you most want auditable. Register a Winnow event source in the Application log at install and have the payload mirror its security-relevant lines there: an integrity failure as an Error (event 2000) and a corrected drift as a Warning (event 1000). Writing is guarded on the source existing and never throws, so a missing source just falls back to the text log. Added event-source-present and event-source-missing cases to the tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The watchdog logged only to
%ProgramData%\Winnow\watchdog.log, a text file a local attacker on the box can also edit and that nothing collects centrally. For a control that runs as SYSTEM and fails closed on tampering, the tamper signal is exactly what you want auditable off-box.Winnowevent source in theApplicationlog (admin, already held; warns and continues if it can't).Write-WinnowWatchdogEventis guarded on the source existing (Test-WinnowWatchdogEventSource) and never throws; a missing source falls back to the text log alone. The text log still records everything, including intact runs.Validation
Tests\Invoke-StaticValidation.ps1 -RequirePSScriptAnalyzerclean (120 files).Tests/Unit/Test-UpdateWatchdog.ps1(Pester 5.7.1): 16/16 pass (adds source-present writes-once and source-missing stays-silent/no-throw).Not verified here (needs a live SYSTEM run against a real update): the actual event entries landing in the Application log. Docs (
docs/Telemetry-And-Privacy.md) and CHANGELOG[Unreleased]updated.