Windows Defender — Architecture and Rulesets (Deep Dive)
Windows Defender — Architecture and Rulesets (Deep Dive)
Microsoft Defender Antivirus (MDAV) is the inbox antimalware stack on Windows 11 — services, engine process, kernel minifilter, AMSI provider, signatures, and optional Defender for Endpoint (MDE) sensor. This note maps how pieces connect and where rules live, using your lab VM 192.168.50.114 as a live example.
| Lab host | 192.168.50.114 — build 26200, SSH tester808 |
| Prerequisites | Module 7 — Security map, Module 2 — Syscalls |
| Defender/S1 field validation | Defender + SentinelOne field manual (attack chains) |
| AMSI read-only | 01-read-only-dll-inspection-amsi-part-1, 00-dll-target-selection |
| Official refs | MDAV on Windows · ASR rules |
Table of Contents
- ELI5 — what Defender is on this machine
- Lab baseline — 192.168.50.114
- Architecture stack
- Processes and services
- Key binaries and DLLs
- Kernel layer — WdFilter
- AMSI integration
- Detection engines and signatures
- Policy and ruleset layers
- Attack Surface Reduction (ASR)
- Other rule families
- Defender AV vs Defender for Endpoint
- Investigation commands
- Security engineer checklist
- Navigation
ELI5 — what Defender is on this machine
Defender is three things at once:
- A background guard (
MsMpEng.exe) that scans files and behavior - A kernel traffic cop (
WdFilter.sys) that can pause file opens until scan completes - A script spell-checker hook (AMSI provider) so PowerShell/VBScript gets inspected before running
Rulesets are the rulebooks telling the guard what to block, audit, or allow — configured via local PowerShell, Group Policy, Intune, or the MDE cloud portal.
Lab baseline — 192.168.50.114
Audited 2026-09-01 via SSH from MiniMac.
Services
| Service | Status | Meaning |
|---|---|---|
WinDefend |
Running | Core antivirus service → MsMpEng.exe |
WdNisSvc |
Running | Network inspection → NisSrv.exe |
mdcoresvc |
Running | Defender core platform → MpDefenderCoreService.exe |
SecurityHealthService |
Running | Security Center health broker |
Sense |
Stopped | MDE/EDR sensor not active on this host |
Sense stopped means the machine is not onboarded to Microsoft Defender for Endpoint (no EDR sensor telemetry to the cloud). You still get full local AV, AMSI, signatures, and configurable ASR — but not MDE advanced hunting / centralized EDR response unless Sense is installed and onboarded.
Protection state (Get-MpComputerStatus)
| Setting | Value |
|---|---|
| Antivirus enabled | True |
| Real-time protection | True |
| IOAV (download scanning) | True |
| NIS (network inspection) | True |
| On-access protection | True |
| Product version | 4.18.26070.9 |
| Signatures updated | 2026-08-31 |
| Spyware sig version | 1.457.442.0 |
Policy snapshot (Get-MpPreference)
| Setting | Value |
|---|---|
| Real-time monitoring disabled | False (RT is on) |
| Path / process / extension exclusions | None configured |
| Controlled Folder Access | 0 (off) |
| ASR rules | 1 rule — block mode (updated 2026-09-01 on lab) |
ASR rule active on lab .114
| Rule | GUID | Mode | Action value |
|---|---|---|---|
| Block execution of potentially obfuscated scripts | 5beb7efe-fd9a-4556-801d-275e5ffc04cc |
Block | 1 |
History: Audit (2) applied earlier same day, then switched to Block (Enabled).
Set-MpPreference -AttackSurfaceReductionRules_Ids '5beb7efe-fd9a-4556-801d-275e5ffc04cc' `
-AttackSurfaceReductionRules_Actions Enabled
Verify:
$p = Get-MpPreference
$p.AttackSurfaceReductionRules_Ids
$p.AttackSurfaceReductionRules_Actions
Watch for audit hits: Event Viewer → Microsoft → Windows → Windows Defender → Operational — IDs 1122 (audit) / 1121 (block). Config changes log as 5007.
Live processes (memory)
| Process | PID | ~RAM | Role |
|---|---|---|---|
MsMpEng.exe |
3296 | 328 MB | Main scan engine |
MpDefenderCoreService.exe |
3188 | 26 MB | Core platform service |
NisSrv.exe |
8576 | 15 MB | Network real-time inspection |
SecurityHealthService.exe |
8940 | 25 MB | Health / UI backend |
Install layout
| Path | Contents |
|---|---|
C:\Program Files\Windows Defender\ |
Inbox binaries — MpCmdRun.exe, MpClient.dll, MsMpEng loader chain |
C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.26070.9-0\ |
Active platform build (versioned engine/components) |
C:\ProgramData\Microsoft\Windows Defender\ |
Signatures, scan data, support files |
Architecture stack
flowchart TB
subgraph ui [User / admin surface]
SECUI[Windows Security app]
PS[PowerShell Get-Mp* / Set-Mp*]
MPCMD[MpCmdRun.exe]
end
subgraph usermode [User-mode services]
CORE[MpDefenderCoreService.exe
mdcoresvc]
ENG[MsMpEng.exe
WinDefend]
NIS[NisSrv.exe
WdNisSvc]
SENSE[Sense.exe
optional MDE]
AMSIProv[AMSI provider in engine]
end
subgraph dlls [Client libraries]
MPCLIENT[MpClient.dll]
MPRTP[MpRtp.dll real-time]
end
subgraph kernel [Kernel mode]
WDF[WdFilter.sys minifilter]
KERN[ntoskrnl.exe]
end
subgraph cloud [Optional cloud]
MAPS[MAPS / cloud protection]
MDEPORTAL[Defender portal policies]
end
SECUI --> CORE
PS --> MPCLIENT
MPCMD --> ENG
MPCLIENT --> ENG
ENG --> AMSIProv
ENG --> WDF
WDF --> KERN
ENG --> MAPS
SENSE --> MDEPORTAL
NIS --> ENGScan path (simplified — file open on normal volume):
App opens file
→ I/O manager → file system stack
→ WdFilter.sys (PreOp callback) — thread may block here
→ MsMpEng scan decision
→ allow / block / quarantine
→ app continues or fails
On Dev Drives, Microsoft documents deferred async scanning instead of blocking PreOp — see sandbox / Dev Drive docs.
Optional sandbox layer: MsMpEngCP.exe (content process) when sandbox mode enabled via MP_FORCE_USE_SANDBOX=1 — high-risk parsing isolated from privileged MsMpEng.exe.
Processes and services
| Process (Task Manager) | Service name | Binary | Primary job |
|---|---|---|---|
| Antimalware Service Executable | WinDefend |
MsMpEng.exe |
Real-time + on-demand scans, AMSI provider work, remediation |
| Microsoft Defender Core Service | mdcoresvc |
MpDefenderCoreService.exe |
Platform lifecycle, component coordination |
| Network Realtime Inspection Service | WdNisSvc |
NisSrv.exe |
Network-layer inspection (NIS) |
| Windows Defender Advanced Threat Protection Service | Sense |
Sense.exe |
MDE sensor — EDR telemetry, response APIs |
| — | — | MpCmdRun.exe |
CLI scans, signature update, diagnostics |
| — | — | ConfigSecurityPolicy.exe |
Policy configuration helper |
Source: Microsoft Defender Antivirus processes.
Key binaries and DLLs
From C:\Program Files\Windows Defender\ on .114:
| DLL / binary | Typical role |
|---|---|
MpClient.dll |
Client API surface — other components call into the engine |
MpRtp.dll |
Real-time protection plumbing |
MpSvc.dll |
Service integration |
MpOAV.dll |
Office/on-access helpers |
MpCmdRun.exe |
Admin CLI (-Scan, -GetFiles, signature update) |
MsMpEng.exe |
Engine (also loaded from Platform folder at runtime) |
The running engine build often comes from ProgramData\...\Platform\<version>\, not only the inbox Program Files copy. Always record both AMProductVersion and Platform folder name when baselining.
Read-only DLL inspection: MpClient.dll paths.
Kernel layer — WdFilter
WdFilter.sys is Microsoft's file system minifilter for Defender real-time protection. It sits in the FSFilter Anti-Virus altitude band (320000–329999). On lab .114 it registers at 328010 with 5 instances (one per attached volume/stack type).
Altitude and stack position
Filter Manager assigns numeric altitudes — higher numbers sit closer to user-mode callers in the I/O stack. Defender AV and third-party AV products share the 320000–329999 band; EDR activity monitors use a different band (360000–369999).
| Load-order group | Altitude range | Example on .114 |
|---|---|---|
| FSFilter Anti-Virus | 320000–329999 | WdFilter 328010 |
| FSFilter Content Screener | 260000–269999 | applockerfltr 265000 |
| FSFilter HSM | 150000–159999 | luafv 135000 |
| FSFilter Activity Monitor | 360000–369999 | UCPD 385250.5 (not Defender scan) |
Official allocation table: Allocated minifilter altitudes.
fltmc filters | Sort-Object { [double]($_ -split '\s+')[-2] } -Descending
fltmc instances # per-volume attach detail
fltmc volumes # which filters on which volumes
PreOp vs PostOp scan flow
App CreateFile / Read / Write
→ I/O Manager → file-system filter stack
→ WdFilter PreOp (IRP_MJ_CREATE, IRP_MJ_READ on-access)
• Thread may block synchronously
• Scan request forwarded to MsMpEng.exe via filter communication port
→ Lower filters / NTFS
→ WdFilter PostOp (write completion, cleanup)
→ IRP completed → app continues or fails
| Phase | Typical IRPs | Defender behavior |
|---|---|---|
| PreOp | CREATE, READ (on-access) |
Synchronous scan before handle use |
| PostOp | WRITE completion, CLEANUP |
Post-write inspection, quarantine coordination |
On Dev Drives, Microsoft documents async/deferred scanning instead of blocking PreOp — see sandbox / Dev Drive MDAV.
What happens on block
WdFilterforwards content toMsMpEng.exe(WinDefend).- Engine returns malicious verdict.
- Filter completes the IRP with failure (commonly
STATUS_ACCESS_DENIED/0xC0000022). - User-mode app sees open/read/write failure; remediation may quarantine the file.
- Optional:
MsMpEngCP.exesandbox process parses high-risk content whenMP_FORCE_USE_SANDBOX=1.
Event IDs — file scan / RTP (Defender Operational)
| ID | Meaning | Hunt use |
|---|---|---|
| 1116 | Malware detected | Primary RTP/on-access signal |
| 1117 | Action taken (quarantine/remove) | Confirms remediation |
| 1118 | Action failed | Engine/remediation failure |
| 1150 | Real-time protection detection | RTP-specific path |
| 1121 | ASR block | Behavioral (not signature) |
| 1122 | ASR audit | Would-have-blocked |
| 5007 | Configuration changed | Policy drift |
Get-WinEvent -LogName 'Microsoft-Windows-Windows Defender/Operational' -MaxEvents 50 |
Where-Object { $_.Id -in 1116,1117,1118,1150,1121,1122,5007 } |
Select-Object TimeCreated, Id, @{N='Msg';E={$_.Message.SubstringMin(100,$_.Message.Length)}}
Tamper protection, PUA, network protection (lab .114)
| Setting | Value | Meaning |
|---|---|---|
| Tamper protection | On (Get-MpComputerStatus) |
Blocks local RTP disable / some preference changes |
| PUA protection | 2 |
Potentially unwanted apps blocked |
| Network protection | 0 |
Off — NIS service runs but URL/IP block policy not enforced |
| MAPS / cloud | 2 |
Advanced cloud reporting enabled |
| Sample submission | 1 |
Prompt before sample upload |
Security engineer angle: minifilters see all file I/O on attached volumes — stronger than user-mode hooks, different blind spots than AMSI (script/content focused). When both Defender AV and a third-party EDR are present, expect multiple filters at different altitudes — always baseline with fltmc after installs.
Related: Module 1 — Kernel · Code Integrity Engine · Lab baseline
AMSI integration
Defender registers as an AMSI antimalware provider. When a script host (PowerShell, wscript, .NET 4.8+, WMI, etc.) calls AmsiScanBuffer / AmsiScanString, content can be routed to Defender before execution.
sequenceDiagram
participant PS as powershell.exe
participant AMSI as amsi.dll
participant ENG as MsMpEng
participant PS2 as PowerShell runtime
PS->>AMSI: AmsiScanString(script)
AMSI->>ENG: provider scan
ENG-->>AMSI: clean / detected
AMSI-->>PS: result
alt detected
PS--xPS2: block or alert
else clean
PS->>PS2: execute
endSupported script surfaces (Microsoft): PowerShell, JScript, VBScript, WSH, .NET assemblies, WMI — see AMSI on MDAV.
Logging: enable PowerShell script block logging (4104) and Defender operational logs for correlation.
Your lab: amsi.dll is inbox; MsMpEng was top memory consumer — consistent with active AV + script scanning path.
Detection engines and signatures
Defender stacks multiple detection types (not just hashes):
| Layer | What it does | Updates via |
|---|---|---|
| Signatures | Hash / sequence matches for known malware | Signature packages (MpCmdRun -SignatureUpdate) |
| Heuristics / generic | Structural / behavioral patterns locally | Engine + sigs |
| Cloud protection (MAPS) | Submit metadata/samples for cloud verdict | Requires network + policy |
| Machine learning models | Local + cloud ML classifiers | Platform + sig channels |
| Behavior monitoring | Suspicious process chains, memory traits | Engine + (more with MDE) |
| AMSI / script inspection | Obfuscated script, fileless patterns | Engine + AMSI |
On .114: signatures fresh (2026-08-31); engine version string empty in Get-MpComputerStatus output — use Platform folder version 4.18.26070.9-0 as authoritative build.
Policy and ruleset layers
Rules are not one file — they stack. Upper layers override lower when configured.
flowchart TB CLOUD[MDE / Intune / GPO central policy] MDM[Defender CSP / Configuration Manager] GP[Group Policy — SecGuide / ADMX] LOCAL[Set-MpPreference / Add-MpPreference] ENGINE[MsMpEng effective policy] CLOUD --> ENGINE MDM --> ENGINE GP --> ENGINE LOCAL --> ENGINE
| Layer | How admins set it | Examples |
|---|---|---|
| Local PowerShell | Set-MpPreference, Add-MpPreference |
Exclusions, ASR, RTP toggle (where allowed) |
| Group Policy | Computer Configuration → Administrative Templates → Windows Components → Microsoft Defender |
ASR rule table, cloud protection |
| Intune / MDM | Defender CSP | Defender/AttackSurfaceReductionRules, exclusions |
| MDE portal | security.microsoft.com | EDR policies, ASR, tamper protection, onboarding |
Effective policy query (lab):
Get-MpPreference | Format-List *
Get-MpComputerStatus | Format-List *
Tamper Protection: when on, blocks local disable of RTP and some preference changes — check IsTamperProtected in Get-MpComputerStatus on your host.
Attack Surface Reduction (ASR)
ASR rules are behavioral block/audit rules — independent of classic malware signatures. Each rule has a GUID and a mode.
Modes
| Value | Mode | Effect |
|---|---|---|
0 |
Disabled | Rule off |
1 |
Block | Enforce block |
2 |
Audit | Log would-have-blocked |
6 |
Warn | User prompt (where supported) |
Example high-value rules (GUID → name)
| Rule | GUID |
|---|---|
| Block Office child processes | d4f940ab-401b-4efc-aadc-ad5f3c50688a |
| Block obfuscated scripts | 5beb7efe-fd9a-4556-801d-275e5ffc04cc |
| Block JS/VBS launching download content | d3e037e1-3eb8-44c8-a917-57927947596d |
| Block credential steal from LSASS | 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2 |
| Block PSExec/WMI process creation | d1e49aac-8f56-4280-b9ba-993a6d77406c |
| Block Office injecting into other processes | 75668c1f-73b5-4cf0-bb93-3ecf5cb7cc84 |
| Advanced ransomware protection | c1db55ab-c21a-4637-bb3f-a12568109d35 |
Full list: ASR rules overview · ASR reference.
Configure (lab — admin PowerShell)
# Audit one rule (example — obfuscated scripts)
Add-MpPreference -AttackSurfaceReductionRules_Ids '5beb7efe-fd9a-4556-801d-275e5ffc04cc' `
-AttackSurfaceReductionRules_Actions AuditMode
# List configured rules
$p = Get-MpPreference
0..Min($p.AttackSurfaceReductionRules_Ids.Count, $p.AttackSurfaceReductionRules_Actions.Count)-1 |
ForEach-Object {
[pscustomobject]@{
Id = $p.AttackSurfaceReductionRules_Ids[$_]
Action = $p.AttackSurfaceReductionRules_Actions[$_]
}
} | Format-Table -AutoSize
Your lab today: one ASR rule in block mode — obfuscated scripts (5beb7efe-fd9a-4556-801d-275e5ffc04cc). Action=1 (Block). Event 1121 when triggered.
Events: ASR blocks/audits appear in Event Viewer → Microsoft → Windows → Windows Defender → Operational (IDs vary by rule; hunt 1121, 1122, 5007 family).
Other rule families
| Feature | What it controls | Lab .114 |
|---|---|---|
| Controlled Folder Access (CFA) | Ransomware-style protected folders | Off (EnableControlledFolderAccess = 0) |
| Network protection | SmartScreen-like URL/IP blocks via NIS | NIS service running — check EnableNetworkProtection in preferences |
| Exploit protection | DEP/ASLR/CFG mitigations (Exploit Guard) | Separate from ASR — Get-ProcessMitigation / GPO |
| PUA protection | Potentially unwanted apps | PUAProtection in Get-MpPreference |
| Cloud-delivered protection | MAPS / cloud block level | MAPSReporting, SubmitSamplesConsent |
| Exclusions | Path, extension, process, IP | None on lab — good for learning detections |
| Attack surface reduction only exclusions | Per-rule exclusions | None |
Controlled Folder Access modes: 0 off, 1 on, 2 audit — enable only with allow-list planning.
Defender AV vs Defender for Endpoint
| Defender Antivirus (MDAV) | Defender for Endpoint (MDE) | |
|---|---|---|
| Required? | Inbox on Win11 | License + onboarding |
| Key process | MsMpEng.exe |
+ Sense.exe |
| Service | WinDefend |
Sense |
| Primary job | Malware prevention | EDR telemetry, hunting, response, advanced policies |
Your lab .114 |
Active | Sense stopped — not onboarded |
Onboarding installs Sense client and registry/CSP onboarding blob — WDATP CSP.
Naming confusion: "Windows Defender" in UI often means the whole security stack; engineers should specify MDAV vs MDE vs ASR vs Exploit Guard.
Investigation commands
Run on .114 (elevated where noted):
# Health dashboard
Get-MpComputerStatus | Format-List *
# Full preference / ruleset
Get-MpPreference | Format-List *
# Threat history
Get-MpThreatDetection | Select-Object -First 10 *
Get-MpThreat | Select-Object -First 10 *
# Quick scan (lab)
Start-MpScan -ScanType QuickScan
# Signature update
Start-MpWDOScan # offline rescue — disruptive; avoid on shared lab without snapshot
# Prefer: MpCmdRun.exe -SignatureUpdate
# Operational log (recent Defender events)
Get-WinEvent -LogName 'Microsoft-Windows-Windows Defender/Operational' -MaxEvents 20 |
Select-Object TimeCreated, Id, Message
# ASR audit mapping (when rules exist)
# Event ID 1121 = block, 1122 = audit
GUI: Windows Security → Virus & threat protection → Manage settings / Protection history.
Security engineer checklist
Baseline (do once per VM)
Hardening progression (lab-safe order)
- Enable ASR in audit mode for 2–3 rules → review Operational log
- Enable cloud-delivered protection if network policy allows
- Tune PUA and network protection
- Pilot CFA in audit before enforce
- Onboard to MDE only when tenant + legal/logging scope ready
Do not (in shared lab without snapshot)
- Disable tamper protection on production-adjacent systems without approval
- Add broad
C:\exclusions to "make lab work" - Run
Set-MpPreference -DisableRealtimeMonitoring $trueand forget to revert
Navigation
← Module 7 · MOC · Windows Playbook
See also: Defender + S1 field manual · AMSI inspection Part 1