Repository navigation
audit: add five read-only checks from the original manual audit - #1
Merged
Merged
Conversation
The original audit tool (manual run of 2026-11-09) also inspected settings that winsec-audit did not cover yet. Its read-only parts are carried over as checks; its hardening, rollback and update modes write to the system and stay out of this read-only tool. - DEF-09 email and removable drive scanning - NET-08 Point and Print driver installation (PrintNightmare) - NET-09 legacy SMB1/Telnet/TFTP client features (elevated) - LOG-04 Security/PowerShell/Defender event log sizes - LOG-05 process creation auditing via a recorded event 4688 (elevated; without elevation the Security query returns "no events" instead of access denied, so the check must not run unelevated) Smoke test: every declared Invoke-Check must be reported exactly once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Get-MpPreference is queried apart from Get-MpComputerStatus. DEF-04/05/ 06/09 assert readable preferences; DEF-02/03/04/09 read values through Get-DefenderValue, which throws on $null instead of casting it to 0/False. Before, unreadable preferences or missing ages gave Pass (DEF-02, DEF-03, DEF-09; DEF-06 when elevated). - DEF-09 also rates CloudExtendedTimeout (target 50 s, the maximum). - LOG-04: unreadable or absent logs are Info (not scored) instead of Warn or Pass; size targets live in one table and build the fix text. - NET-09 counts EnablePending as on and only rates Telnet/TFTP. SMBv1 is scored once, in NET-01, which now also reads the SMB1Protocol feature when elevated (shared, cached optional-feature listing). - LOG-05 names its limits: Retain log mode warns, a switch-off within the last 24 h is not detectable. - Smoke test fails on parse errors of the script. - New Test-DefenderUnavailable.ps1 (CI step) shadows the two Defender cmdlets and requires Error for every dependent check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With [CmdletBinding()], Windows PowerShell 5.1 leaves $PSScriptRoot empty while it evaluates param defaults under "powershell -File". Join-Path then fails, so the README quick start (powershell -File .\winsec-audit.ps1) and "powershell -File tests\Test-ReadOnly.ps1" exited 1 before doing anything. Both defaults are now resolved after the param block. CI runs the guard once through "powershell -File" to keep it that way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Carries over the read-only parts of the original manual audit (2026-11-09) that winsec-audit did not cover. Its hardening, rollback and update modes write to the system and are not part of this PR.
LOG-05 needs elevation: unelevated, a Security log query for 4688 returns
NoMatchingEventsFound(not access denied). The audit policy is not read (noauditpol.exe, native allowlist unchanged); a recorded event is the evidence. Its limits are stated in the finding: a switch-off within the last 24 h is not detectable, and Retain log mode warns.No Pass from unreadable data:
Separate commit
70d6933:$PSScriptRootparam defaults moved into the script body. With[CmdletBinding()], Windows PowerShell 5.1 leaves$PSScriptRootempty while evaluating param defaults underpowershell -File, so the README quick startpowershell -ExecutionPolicy Bypass -File .\winsec-audit.ps1failed with aJoin-Patherror.Evidence
Test-DefenderUnavailable.ps1(shadowsGet-MpPreference→ throws,Get-MpComputerStatus→ ages$null):d21950f):DEF-02 Pass,DEF-03 Pass,DEF-09 Pass(expected Error), exit 1Error, DEF-06Skipped(unelevated),none as Pass, exit 0powershell -File, PS 5.1:Test-ReadOnly.ps1andwinsec-audit.ps1both exit 1 (Join-Path ... leere Zeichenfolge)Read-only guard passed, exit 0; audit exit 0,report.jsonandreport.mdwrittenTest-ReadOnlyexit 0;Test-GuardSelf32 sample(s), exit 0;Test-SmokeChecks 49, score 84, fingerprint 85269D8A3C824F3D,system state unchanged, exit 070d6933): runnerElevated: True, so NET-01 feature, NET-09, LOG-05 and DEF-06 ran; smokeChecks 49with 0 Error results in both shells; guard viapowershell -Filepassed; Defender test 6/6 incl. DEF-06Error.Merge Danger
Door: two-way
Additive checks, stricter error handling, extra tests; each commit reverts on its own.
Blast Radius: score
Report scores shift: five weighted checks are added (12 weight points), and Defender checks that used to Pass on unreadable data now end as Error (not scored). NET-01's title changes to "SMBv1 disabled". No change to the read-only guard rules or the native allowlist.
🤖 Generated with Claude Code