Overhaul windows.ps1: fix breaking bugs, speed up run time, add answer-key-driven coverage - #1
Conversation
… coverage Critical fixes: - Remove RpcSs from the service-disable list (disabling RPC breaks Windows) - Stop opening inbound port 80 unconditionally; gate it behind a README prompt - Honor the keep-RDP choice consistently (TermService was disabled regardless) - Exempt the logged-in user from password changes (auto-logon lockout risk) - Replace deprecated wmic Administrator rename with Rename-LocalUser and drop the post-rename net commands that always failed - Rename the reserved $input automatic variable - Require explicit 'y' for destructive actions (user deletion, restart) - IPv6 DisabledComponents 0xFFFFFFFF -> documented 0xFF value - Write secedit config back as UTF-16 instead of ANSI Performance: - Ask all prompts up front so the run is unattended after setup - One secedit export/apply pass instead of three; drop redundant net accounts - Single recursive scan of C:\Users instead of two - Drop synchronous Windows Update COM search (5+ min); use UsoClient StartScan - Drop both gpupdate /force calls - One wildcard auditpol call instead of 18 plus an interactive prompt - Only touch services/features that exist (skip blind sc/dism calls) - Data-driven registry and firewall loops; LOLBin blocks optional and idempotent New coverage informed by past answer keys: - Installed-program audit flagging commonly prohibited software - Persistence report: Run keys, startup folders, scheduled tasks, listening ports with owning process, non-default SMB shares, hosts file - Suspicious file flagging (password/PII files, pcaps, loose exes) without auto-deleting potential forensics evidence - Added scored settings: printer driver restrictions, FIPS, LmCompatibilityLevel, WDigest, remote shell access, PowerShell 2.0 removal, Defender cloud/network protection, RDP SecurityLayer SSL, lockout duration, password history, and more - Closing manual checklist (forensics questions, README groups, app updates) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
Every round's README differs: software that is a removable "hacking tool" on
one image (e.g. Wireshark) is required business software on another, and
stopping a README-critical service triggers a scoring penalty. New up-front
exemption prompts capture this per round:
- Untouchable accounts (e.g. mail service accounts like IME_ADMIN): never
removed, disabled, demoted, or password-reset (resets can break services)
- Critical services: never stopped/disabled, ensured running and automatic
- Required software: excluded from prohibited-program flagging with a
reminder to update instead of remove
- Separate mail-server question so SMTP isn't coupled to the web choice
Also, informed by CCS scoring engine research and community guides:
- Never touch services matching CCS/CyberPatriot (scoring client)
- Ensure Security Center (wscsvc) runs ("Action Center enabled" READMEs)
- Report Windows Defender exclusion paths/extensions/processes (planted
exclusions silently override every scan policy)
- Detect and fix DisableCMD/DisableTaskMgr/DisableRegistryTools sabotage
- Save a gpresult baseline before making changes
- Expand the closing checklist: penalties are recoverable by reverting,
quality updates only (no Feature Updates/Insider/Reset this PC), never
touch the CCS client, review scenario app (mail/web) security settings
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Pushed a second commit that makes round-specific decisions README-driven, since every round's README differs (e.g. one Server 2022 round required Wireshark, IIS, RDP, and MailEnable to stay, and forbade touching the IME_ADMIN/IME_USER accounts — the previous flagging/password logic would have cost points there):
General policy items (password age/length/lockout, audit policy, UAC, SMB signing, etc.) stay unconditional since those score the same every round. 🤖 Generated with Claude Code |
Summary
Restructures
windows/windows.ps1end-to-end, keeping the original authorship/GPL header. Changes were driven by a review of past CyberPatriot answer keys (2024–2025 training/round keys) plus a line-by-line audit of the script. Three categories of change: critical fixes, performance, and new scored coverage.Critical fixes (image-breaking / point-losing)
RpcSsfrom the service-disable list. Nearly everything in Windows depends on the RPC service;sc config RpcSs start= disabledrenders the image unusable.TermService/SessionEnv/UmRdpServicein the later services section.Set-LocalUserinstead ofnet user, which fails on names with spaces or >20 chars.wmicis deprecated/removed on current Win11; the follow-upnet localgroup /delete Administrator+net user Administrator /active:noran after the rename so they always failed. NowRename-LocalUser+Disable-LocalUser, and the new name is prompted rather than hardcoded.$inputis a reserved PowerShell automatic variable — the Read-Host loops assigned to it; renamed.y. Unauthorized users are disabled (reversible) unless deletion is confirmed.DisabledComponentsset to the documented0xFFinstead of0xFFFFFFFF(invalid; causes boot delays).C:\.Performance (run time cut substantially)
Read-Hostcalls between slow stages.net accountscalls dropped.C:\Usersinstead of two, classified into media/images/suspicious afterward.IsInstalled=0, can take 5+ min); replaced with a backgroundUsoClient StartScan. The registry settings are what score.gpupdate /forcecalls (~30–60s each).auditpolcall (/category:* /success:enable /failure:enable) replaces 18 calls plus an interactive prompt — setting both satisfies every Success/Failure variant seen in answer keys.Get-Service/Get-WindowsOptionalFeaturecall) instead of ~50 blindsc.exespawns and unconditionaldismruns.netshfirewall lines became a data-driven, idempotentNew-NetFirewallRuleloop, and LOLBin blocking is optional (it isn't scored in any reviewed key).New coverage (items answer keys score that the script didn't touch)
.pcap, loose.exes in profiles) — reported, not auto-deleted, since these are often forensics evidence.LmCompatibilityLevel=5+NoLMHash, WDigest off, WinRMAllowRemoteShellAccess=0, PowerShell 2.0 removal, Defender cloud/network protection + PUA, RDPSecurityLayer=2(SSL — was 1/Negotiate), account lockout duration, password history 24, missing-authorized-user creation, Xbox/Fax/Spooler service handling.Testing
Parser::ParseFile, zero errors).🤖 Generated with Claude Code