RELOPS-2433 + RELOPS-2458: Defender real-time hardening (hw fleet) + per-task RTP toggle (testers) - #1264
Open
markcor wants to merge 2 commits into
Open
RELOPS-2433 + RELOPS-2458: Defender real-time hardening (hw fleet) + per-task RTP toggle (testers)#1264markcor wants to merge 2 commits into
markcor wants to merge 2 commits into
Conversation
Split out of PR #1235 (combined RELOPS-2396 branch) into defender-only. Ensures on-access scanning is genuinely OFF on every NUC13 hw boot, and visible if it ever isn't: - disable_services.pp (datacenter): explicitly include disable_windows_defender_schtask (de-coupled from the ReleaseId 2004/2009 gate that fired on 24H2 by accident) plus disable_windows_defender. - disable_windows_defender.pp: rewritten registry-only (DisableAntiSpyware, the Real-Time Protection family, ForceDefenderPassiveMode, Sense\Start=4 EDR-off, and an idempotent exec disabling Defender's own scheduled tasks). - maintainsystem-hw.ps1 Invoke-DefenderRealtimeGuard: asserts GP path exclusions, re-renames restored WdFilter/WdBoot/WdNisDrv drivers, tries fltmc unload, and reboots ONCE (boot-loop guarded) if WdFilter still runs under Tamper. Writes defender_status.json. - check_defender.ps1: NSClient++ check reading ground-truth signals (WdFilter not loaded) rather than Get-MpComputerStatus (unusable on this fleet). Hardware-only: gated to the datacenter maintain-system path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
markcor
force-pushed
the
RELOPS-2396-defender
branch
from
July 15, 2026 20:17
95e899d to
13e8d08
Compare
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
Hardens Windows Defender real-time / on-access scanning disable on the NUC13
hardware fleet (
releng-hardware/win11-64-24h2-hw*), closing the WdFilterboot race where a Defender platform update can re-arm on-access scanning
mid-life and inject scan overhead into Speedometer 3 / Talos / Raptor runs.
Tracked by RELOPS-2433.
Hardware-only: gated to the datacenter maintain-system path.
Findings that shaped this
Get-MpComputerStatus/Set-MpPreferenceare unusable on the hw fleet("Provider load failure") because the disable mechanism renames the Defender driver
.sysfiles. Cmdlets can't manage what they can't load.TamperProtectionSource=5).fltmc unload WdFilterandsc config WdFilter start=disabledare both blocked under Tamper.WdFilter.sysis a boot-start minifilter: it loads at boot before the disableschtask renames it, so a Defender platform update that restores
WdFilter.sysleavesreal-time scanning active until the next boot (intermittently — observed live: nuc13-119
had 38 WdFilter instances attached despite the
.sysbeing renamed, nuc13-059 clean).Changes
profiles/disable_services.pp— datacenter case explicitly includesdisable_windows_defender_schtask(de-coupled from theReleaseId in ['2004','2009']coincidence that fired on 24H2 by accident) plus
disable_windows_defender.win_disable_services::disable_windows_defender— rewritten registry-only:DisableAntiSpyware, the Real-Time Protection family,ForceDefenderPassiveMode,Sense\Start=4(EDR off), and an idempotent exec disabling Defender's own scheduled tasks.maintainsystem-hw.ps1→Invoke-DefenderRealtimeGuard— runs afterTest-ConnectionUntilOnline: asserts GP path exclusions, re-renames restoredWdFilter/WdBoot/WdNisDrv, triesfltmc unload, and reboots ONCE (boot-loop guarded:marker file,
MaxReboots=1,CooldownMin=60) ifWdFilterstill runs under Tamper.Writes
defender_status.json. Never throws.win_nsclient::check_defender— NEW external check +defenderalias, readingground-truth signals (
WdFilternot loaded) rather thanGet-MpComputerStatus.Files
New:
modules/win_nsclient/files/check_defender.ps1Modified:
disable_services.pp,disable_windows_defender.pp,win_nsclient/manifests/init.pp,win_nsclient/templates/nsclient.ini.epp,win_scheduled_tasks/files/maintainsystem-hw.ps1(
Write-DefenderStatus+Invoke-DefenderRealtimeGuard+ the guard call).RELOPS-2458: Windows Defender real-time protection switch (driver-rename based)
Adds an on/off control for Defender real-time / on-access scanning on the CI hw fleet, in
the new
win_defender_rt_togglemodule. Default is OFF and non-persistent — enabling isa transient, in-session testing override; every boot resets to disabled.
Mechanism:
Set-MpPreferenceis unusable on this fleet (management platform absent →"Provider load failure"; Tamper enforced), so the switch renames the boot-start minifilter
drivers (
WdFilter/WdBoot/WdNisDrv) viatakeown, below Tamper's reach.defender_rt_disable— user-triggerable (GRGX): rename drivers (off; effective next boot).defender_rt_enable— user-triggerable (GRGX): transient restore + best-effortfltmc loadso scanning runs this session for a test. Not persisted.defender_rt_enable_boot— boot reconcile that always enforces OFF (ignores any prior enable), catches a Defender update that restored the driver, and does a boot-loop-guarded single reboot to clear a still-running filter.Triggering the switch (task payload, or manual) — the tasks are ACL'd
GRGX, so the unprivileged task user can run but not modify them; they execute as SYSTEM and return immediately:Cmdlet equivalent:
Start-ScheduledTask -TaskName defender_rt_enable. State:C:\ProgramData\defender_rt\rt_state.json(anddefender_status.json).Security model:
GRGXtrigger-only forBUILTIN\Users(noFA), boot task untouchable,idempotent
-Checkregistrar. Consolidated to single authority:disable_services.pp(datacenter) includes this instead of
disable_windows_defender_schtask;Invoke-DefenderRealtimeGuardremoved frommaintainsystem-hw.ps1.Validated on nuc13-059: off-by-default after re-image; unprivileged
schtasks /Runofdefender_rt_enableflips RTP on (runs as SYSTEM,LastTaskResult=0); after reboot thereconcile enforced OFF (ignored the on-marker).
Testing
Testing on the
win11-64-24h2-hw-perf-debugpool. Try push:https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=66499
End-to-end validated on nuc13-059 (
6a21436):defender_rt_enable→repuppetize=1→ defender-only puppet re-apply (exit 2, ~4.5s, tasks re-registered) → reboot resets to OFF. Meets the requirement (default off / transient enable / reboot resets to off).Follow-on work
WdFilter\Start=4indisable_windows_defender.ppso the kernel cannot loadthe minifilter at boot at all — makes the boot race structurally impossible on
Tamper-off nodes (per RELOPS-2433 root-cause analysis).
-perf-debug+-alphato the remainingwin11-64-24h2-hw*pools.Pester sampling on real hw nodes to catch the next regression of this shape.
🤖 Generated with Claude Code