关于 configuring-windows-defender-advanced-settings
面向 Windows 管理员和安全团队,指导配置 Microsoft Defender 的高级防护设置,并通过 PowerShell 及企业策略部署。内容涉及 ASR、受控文件夹访问、网络与漏洞利用防护及监控。
主要功能
- 01配置 ASR 规则
- 02启用受控文件夹访问
- 03设置网络与漏洞利用防护
- 04配置云端保护和扫描
- 05通过 Intune 部署并监控
适用场景
- 01为 Windows 终端加强 Defender 防护
- 02以审计模式评估 ASR 规则
- 03通过企业策略部署 Defender 设置
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ mukul975/ anthropic-cybersecurity-skills --skill configuring-windows-defender-advanced-settings安装后在 Claude Code 中输入/configuring-windows-defender-advanced-settings确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
LICENSEassets/template.mdreferences/api-reference.mdstandards.mdworkflows.mdscripts/agent.pyprocess.py详细介绍
配置 Windows Defender 高级设置
使用场景
在以下情况下使用此技能:
- 为增强防护而配置 Microsoft Defender for Endpoint (MDE) 的默认设置之外的选项
- 实施攻击面缩减 (ASR) 规则以阻止常见攻击技术
- 启用受控文件夹访问以防御勒索软件
- 配置网络保护和漏洞利用防护功能
- 在企业规模下通过 Intune、SCCM 或组策略部署 Defender 设置
不要使用此技能来部署第三方 EDR(CrowdStrike、SentinelOne),也不要用于 Microsoft Defender for Cloud(Azure 工作负载保护)。
前提条件
- 已启用 Microsoft Defender Antivirus 的 Windows 10/11 企业版
- Microsoft 365 E5 或 Microsoft Defender for Endpoint Plan 2 许可证(以使用完整的 MDE 功能)
- 用于企业策略部署的 Microsoft Intune 或 SCCM
- Microsoft 365 Defender 门户访问权限 (security.microsoft.com)
- 终结点未以活动模式运行第三方 AV(否则 Defender 会进入被动模式)
工作流
步骤 1:配置攻击面缩减 (ASR) 规则
ASR 规则可阻止恶意软件和攻击者常用的特定行为:
# Enable ASR rules via PowerShell (or deploy via Intune/GPO)
# Mode: 0=Disabled, 1=Block, 2=Audit, 6=Warn
# Block executable content from email client and webmail
Set-MpPreference -AttackSurfaceReductionRules_Ids BE9BA2D9-53EA-4CDC-84E5-9B1EEEE46550 `
-AttackSurfaceReductionRules_Actions 1
# Block all Office applications from creating child processes
Set-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EFC-AADC-AD5F3C50688A `
-AttackSurfaceReductionRules_Actions 1
# Block Office applications from creating executable content
Set-MpPreference -AttackSurfaceReductionRules_Ids 3B576869-A4EC-4529-8536-B80A7769E899 `
-AttackSurfaceReductionRules_Actions 1
# Block Office applications from injecting code into other processes
Set-MpPreference -AttackSurfaceReductionRules_Ids 75668C1F-73B5-4CF0-BB93-3ECF5CB7CC84 `
-AttackSurfaceReductionRules_Actions 1
# Block JavaScript or VBScript from launching downloaded executable content
Set-MpPreference -AttackSurfaceReductionRules_Ids D3E037E1-3EB8-44C8-A917-57927947596D `
-AttackSurfaceReductionRules_Actions 1
# Block execution of potentially obfuscated scripts
Set-MpPreference -AttackSurfaceReductionRules_Ids 5BEB7EFE-FD9A-4556-801D-275E5FFC04CC `
-AttackSurfaceReductionRules_Actions 1
# Block Win32 API calls from Office macros
Set-MpPreference -AttackSurfaceReductionRules_Ids 92E97FA1-2EDF-4476-BDD6-9DD0B4DDDC7B `
-AttackSurfaceReductionRules_Actions 1
# Block credential stealing from Windows LSASS
Set-MpPreference -AttackSurfaceReductionRules_Ids 9E6C4E1F-7D60-472F-BA1A-A39EF669E4B2 `
-AttackSurfaceReductionRules_Actions 1
# Block process creations from PSExec and WMI commands
Set-MpPreference -AttackSurfaceReductionRules_Ids D1E49AAC-8F56-4280-B9BA-993A6D77406C `
-AttackSurfaceReductionRules_Actions 1
# Block untrusted and unsigned processes from USB
Set-MpPreference -AttackSurfaceReductionRules_Ids B2B3F03D-6A65-4F7B-A9C7-1C7EF74A9BA4 `
-AttackSurfaceReductionRules_Actions 1
# Block persistence through WMI event subscription
Set-MpPreference -AttackSurfaceReductionRules_Ids E6DB77E5-3DF2-4CF1-B95A-636979351E5B `
-AttackSurfaceReductionRules_Actions 1
# Block abuse of exploited vulnerable signed drivers
Set-MpPreference -AttackSurfaceReductionRules_Ids 56A863A9-875E-4185-98A7-B882C64B5CE5 `
-AttackSurfaceReductionRules_Actions 1
步骤 2:配置受控文件夹访问(勒索软件防护)
# Enable Controlled Folder Access
Set-MpPreference -EnableControlledFolderAccess Enabled
# Default protected folders: Documents, Pictures, Videos, Music, Desktop, Favorites
# Add custom protected folders
Add-MpPreference -ControlledFolderAccessProtectedFolders "C:\CriticalData"
Add-MpPreference -ControlledFolderAccessProtectedFolders "D:\SharedDrives"
# Allow specific applications to access protected folders
Add-MpPreference -ControlledFolderAccessAllowedApplications "C:\Program Files\CustomApp\app.exe"
Add-MpPreference -ControlledFolderAccessAllowedApplications "C:\Program Files\Backup\backup.exe"
# Set to Audit mode first to identify legitimate applications that need access
Set-MpPreference -EnableControlledFolderAccess AuditMode
# Event ID 1124 in Microsoft-Windows-Windows Defender/Operational log
步骤 3:配置网络保护
# Enable Network Protection (blocks connections to malicious domains/IPs)
Set-MpPreference -EnableNetworkProtection Enabled
# Network Protection leverages Microsoft SmartScreen intelligence
# Blocks: phishing sites, exploit hosting domains, C2 domains, malware download URLs
# Set to Audit mode first:
Set-MpPreference -EnableNetworkProtection AuditMode
# Event Log: Microsoft-Windows-Windows Defender/Operational, Event ID 1125
# Configure Web Content Filtering (requires MDE P2 license)
# Managed via Microsoft 365 Defender portal:
# Settings → Endpoints → Web content filtering → Add policy
# Categories to block: Malware, Phishing, Adult content, High bandwidth
步骤 4:配置漏洞利用防护
# Export current exploit protection settings
Get-ProcessMitigation -RegistryConfigFilePath "C:\Defender\current_mitigations.xml"
# Configure system-level mitigations
Set-ProcessMitigation -System -Enable DEP, SEHOP, ForceRelocateImages, BottomUp
# Configure per-application mitigations
# Example: Harden Microsoft Office against exploitation
Set-ProcessMitigation -Name "WINWORD.EXE" `
-Enable DEP, SEHOP, ForceRelocateImages, CFG, StrictHandle
Set-ProcessMitigation -Name "EXCEL.EXE" `
-Enable DEP, SEHOP, ForceRelocateImages, CFG, StrictHandle
Set-ProcessMitigation -Name "POWERPNT.EXE" `
-Enable DEP, SEHOP, ForceRelocateImages, CFG, StrictHandle
# Import exploit protection configuration from XML template
Set-ProcessMitigation -PolicyFilePath "C:\Defender\exploit_protection_template.xml"
步骤 5:配置云保护
# Enable cloud-delivered protection (real-time threat intelligence)
Set-MpPreference -MAPSReporting Advanced
Set-MpPreference -SubmitSamplesConsent SendAllSamples
# Enable Block at First Sight (BAFS)
# Requires: Cloud protection enabled + sample submission enabled
Set-MpPreference -DisableBlockAtFirstSeen $false
# Set cloud block timeout to maximum (60 seconds)
Set-MpPreference -CloudBlockLevel High
Set-MpPreference -CloudExtendedTimeout 50
# Enable potentially unwanted application (PUA) protection
Set-MpPreference -PUAProtection Enabled
步骤 6:配置扫描和更新设置
# Configure real-time protection
Set-MpPreference -DisableRealtimeMonitoring $false
Set-MpPreference -DisableBehaviorMonitoring $false
Set-MpPreference -DisableIOAVProtection $false
Set-MpPreference -DisableScriptScanning $false
# Configure scheduled scan
Set-MpPreference -ScanScheduleQuickScanTime 12:00:00
Set-MpPreference -ScanParameters QuickScan
Set-MpPreference -ScanScheduleDay 0 # Every day
Set-MpPreference -RemediationScheduleDay 0
# Configure signature updates
Set-MpPreference -SignatureUpdateInterval 1 # Check every hour
Set-MpPreference -SignatureFallbackOrder "MicrosoftUpdateServer|MMPC"
# Enable tamper protection (prevents unauthorized changes to Defender settings)
# Managed via Microsoft 365 Defender portal:
# Settings → Endpoints → Advanced features → Tamper Protection: On
步骤 7:通过 Intune 部署(企业)
Intune Deployment Path:
1. Endpoint Security → Attack Surface Reduction → Create Profile
- Platform: Windows 10 and later
- Profile: Attack surface reduction rules
- Configure each ASR rule to Block or Audit
2. Endpoint Security → Antivirus → Create Profile
- Microsoft Defender Antivirus
- Configure: Cloud protection, PUA, real-time protection
3. Endpoint Security → Antivirus → Create Profile
- Microsoft Defender Antivirus Exclusions
- Add path/process/extension exclusions for LOB apps
4. Devices → Configuration profiles → Create profile
- Endpoint protection → Microsoft Defender Exploit Guard
- Configure: Controlled Folder Access, Network Protection
步骤 8:在 Microsoft 365 Defender 门户中监控
Dashboard monitoring:
1. security.microsoft.com → Reports → Endpoints
- Device health: Protection status across fleet
- ASR rule detections: Which rules are triggering
- Vulnerable devices: Missing security updates
2. Threat analytics:
- Active threat campaigns and Defender coverage
- Recommended security actions
3. Advanced hunting (KQL):
DeviceEvents
| where ActionType startswith "Asr"
| summarize Count=count() by ActionType, FileName
| sort by Count desc
DeviceEvents
| where ActionType == "ControlledFolderAccessViolationBlocked"
| project Timestamp, DeviceName, FileName, FolderPath
关键概念
| 术语 | 定义 |
|---|---|
| ASR 规则 | 攻击面缩减规则,在终结点层面阻止特定的高风险行为 |
| 受控文件夹访问 | 勒索软件防护功能,阻止未经授权的应用程序修改受保护文件夹中的文件 |
| 网络保护 | 使用 SmartScreen 智能阻止指向低信誉或已知恶意域名的出站连接 |
| 漏洞利用防护 | 系统和按应用程序的内存缓解措施(DEP、ASLR、CFG),以防止漏洞利用 |
| BAFS(首次见到即阻止) | 基于云的零日防护,会在允许执行前将可疑文件留在云端进行分析 |
| 篡改防护 | 阻止对 Defender 安全设置的未经授权更改,即使是本地管理员也无法更改 |
工具与系统
- Microsoft 365 Defender 门户:security.microsoft.com,用于集中管理和报告
- Microsoft Intune:基于云的终结点管理,用于部署 Defender 策略
- PowerShell (Set-MpPreference):本地配置 Defender 设置
- WDAC(Windows Defender 应用程序控制):互补的应用程序控制技术
- Microsoft Defender for Endpoint API:用于自动化和自定义集成的 REST API
常见陷阱
- 立即以阻止模式启用所有 ASR 规则:某些 ASR 规则会对合法软件(Office 宏、管理员脚本)产生误报。请始终先以审核模式部署并观察 2-4 周。
- 未配置受控文件夹访问排除项:备份软件、数据库应用程序和开发工具可能会被阻止写入受保护文件夹。请主动添加排除项。
- 忽视篡改防护:没有篡改防护,恶意软件或内部人员可以通过 PowerShell 或注册表编辑禁用 Defender。请通过 M365 Defender 门户启用篡改防护。
- 将 Defender 与第三方 AV 一起运行:当存在第三方 AV 时,Defender 会进入被动模式。请确保使用的是预期的 AV 解决方案,并相应配置 Defender(如果保留第三方 AV,则使用仅 EDR 模式)。
- 忘记云连接要求:云保护和 BAFS 要求终结点能够访问 Microsoft 云服务。请验证代理/防火墙规则允许 Defender 云流量。
评论
支持 Markdown