共用方式為


受攻擊面減少規則示範

受攻擊面縮小規則會針對惡意代碼和惡意應用程式通常用來感染電腦的特定行為,例如:

  • Office 應用程式或 Web 郵件中使用的可執行檔和腳本,嘗試下載或執行檔案
  • 模糊化或其他可疑的腳本
  • 應用程式在正常日常工作中未啟動的行為

必要條件

  • Windows 用戶端裝置必須執行 Windows 11、Windows 10 1709 組建 16273 或更新版本
  • Windows 伺服器裝置必須執行 R2 和更新版本Windows Server 2012, (具有新式統一解決方案中的功能)
  • Azure Stack HCI OS 版本 23H2 和更新版本。

安裝程式

PowerShell 命令

Add-MpPreference -AttackSurfaceReductionRules_Ids BE9BA2D9-53EA-4CDC-84E5-9B1EEEE46550 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EfC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 3B576869-A4EC-4529-8536-B80A7769E899 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 75668C1F-73B5-4CF0-BB93-3ECF5CB7CC84 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids D3E037E1-3EB8-44C8-A917-57927947596D -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 5BEB7EFE-FD9A-4556-801D-275E5FFC04CC -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 92E97FA1-2EDF-4476-BDD6-9DD0B4DDDC7B -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids D1E49AAC-8F56-4280-B9BA-993A6D77406C -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids B2B3F03D-6A65-4F7B-A9C7-1C7EF74A9BA4 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids C1DB55AB-C21A-4637-BB3F-A12568109D35 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 01443614-CD74-433A-B99E-2ECDC07BFC25 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 56a863a9-875e-4185-98a7-b882c64b5ce5 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids e6db77e5-3df2-4cf1-b95a-636979351e5b -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids a8f5898e-1dc8-49a9-9878-85004b8a61e6 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 26190899-1602-49E8-8B27-EB1D0A1CE869 -AttackSurfaceReductionRules_Actions AuditMode
Add-MpPreference -AttackSurfaceReductionRules_Ids 7674BA52-37EB-4A4F-A9A1-F0F9A1619A2C -AttackSurfaceReductionRules_Actions AuditMode
Add-MpPreference -AttackSurfaceReductionRules_Ids 33ddedf1-c6e0-47cb-833e-de6133960387 -AttackSurfaceReductionRules_Actions Enabled
Add-MpPreference -AttackSurfaceReductionRules_Ids c0033c00-d16d-4114-a5a0-dc9b3a7d2ceb -AttackSurfaceReductionRules_Actions Enabled

規則狀態

狀態 Mode 數值
已停用 = 關閉 0
Enabled = 封鎖模式 1
稽核 = 審核模式 2

確認設定


Get-MpPreference

測試檔案

注意 - 某些測試檔案嵌入了多個漏洞並觸發了多個規則

規則名稱 規則 GUID
封鎖來自電子郵件用戶端及網路郵件的可執行內容 BE9BA2D9-53EA-4CDC-84E5-9B1EEEE46550
封鎖 Office 應用程式建立子程式 D4F940AB-401B-4EFC-AADC-AD5F3C50688A
封鎖 Office 應用程式使其無法建立可執行的內容 3B576869-A4EC-4529-8536-B80A7769E899
封鎖 Office 應用程式插入其他進程 75668C1F-73B5-4CF0-BB93-3ECF5CB7CC84
阻礙 JavaScript 和 VBScript 啟動可執行檔 D3E037E1-3EB8-44C8-A917-57927947596D
封鎖可能經過模糊化的指令碼的執行 5BEB7EFE-FD9A-4556-801D-275E5FFC04CC
封鎖從 Office 中的巨集程式碼匯入 Win32 92E97FA1-2EDF-4476-BDD6-9DD0B4DDDC7B
{封鎖源自 PSExec & WMI 命令的進程建立 D1E49AAC-8F56-4280-B9BA-993A6D77406C
封鎖在卸除式 USB 媒體內執行不受信任或未簽署的可執行檔 B2B3F03D-6A65-4F7B-A9C7-1C7EF74A9BA4
激進勒索軟體預防 C1DB55AB-C21A-4637-BB3F-A12568109D35
封鎖可執行檔執行,除非它們符合流行度、存留期或信任清單準則 01443614-CD74-433A-B99E-2ECDC07BFC25
封鎖 Adobe Reader 使其無法建立子程序 7674BA52-37EB-4A4F-A9A1-F0F9A1619A2C
封鎖濫用惡意探索易受攻擊的已簽署驅動程式 56a863a9-875e-4185-98a7-b882c64b5ce5
封鎖從 Windows 本機安全性授權子系統 (lsass.exe) 竊取認證 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2
透過 WMI 事件訂閱封鎖持續性 e6db77e5-3df2-4cf1-b95a-636979351e5b
封鎖伺服器的 Webshell 建立 a8f5898e-1dc8-49a9-9878-85004b8a61e6
封鎖在安全模式下重新啟動電腦 (預覽) 33ddedf1-c6e0-47cb-833e-de6133960387
封鎖使用複製或模擬的系統工具 (預覽) C0033C00-D16D-4114-A5A0-DC9B3A7D2CEB

案例

安裝程式

下載並執行此 安裝指令碼。 在執行指令碼之前,請使用下列 PowerShell 命令將執行原則設定為 [無限制]:

Set-ExecutionPolicy Unrestricted

您可以改為執行下列手動步驟:

  1. 在 c: 下建立名為 demo 的資料夾,“c:\demo”
  2. 將此 乾淨檔案 儲存到 c:\demo 中。
  3. 使用 PowerShell 命令啟用所有規則。

案例 1:受攻擊面縮小封鎖具有多個弱點的測試檔案

  1. 使用 PowerShell 命令在封鎖模式下啟用所有規則 (您可以複製貼上所有)
  2. 下載並開啟任何測試檔案/文件,並在出現提示時啟用編輯和內容。

情境 1 預期結果

您應該會立即看到「操作已封鎖」通知。

案例 2:ASR 規則封鎖具有對應弱點的測試檔案

  1. 使用上一個步驟中的 PowerShell 命令來設定您要測試的規則。

    範例:Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EfC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Enabled

  2. 下載並開啟您要測試之規則的測試檔案/文件,並在出現提示時啟用編輯和內容。

    範例: 封鎖 Office 應用程式建立子進程 D4F940AB-401B-4EFC-AADC-AD5F3C50688A

情境 2 預期結果

您應該會立即看到「操作已封鎖」通知。

案例 3 (Windows 10 或更新版本) :ASR 規則會封鎖未簽署的 USB 內容執行

  1. 設定 USB 保護 (B2B3F03D-6A65-4F7B-A9C7-1C7EF74A9BA4) 的規則。

    Add-MpPreference -AttackSurfaceReductionRules_Ids B2B3F03D-6A65-4F7B-A9C7-1C7EF74A9BA4 -AttackSurfaceReductionRules_Actions Enabled
    
  2. 下載檔案並將其放在 USB 記憶棒上並執行它 阻止可移動 USB 媒體中不受信任或未簽名的可執行檔的執行

情境 3 預期結果

您應該會立即看到「操作已封鎖」通知。

案例 4:如果沒有減少受攻擊面會發生什麼事

  1. 在清除區段中使用 PowerShell 命令關閉所有受攻擊面縮小規則。

  2. 下載任何測試檔案/文件,並在出現提示時啟用編輯和內容。

情境 4 預期結果

  • c:\demo 中的檔案已加密,您應該會收到警告訊息
  • 再次執行測試檔案以解密檔案

清理

下載並執行此 清理指令碼

或者,您可以執行下列手動步驟:

Add-MpPreference -AttackSurfaceReductionRules_Ids BE9BA2D9-53EA-4CDC-84E5-9B1EEEE46550 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids D4F940AB-401B-4EfC-AADC-AD5F3C50688A -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 3B576869-A4EC-4529-8536-B80A7769E899 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 75668C1F-73B5-4CF0-BB93-3ECF5CB7CC84 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids D3E037E1-3EB8-44C8-A917-57927947596D -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 5BEB7EFE-FD9A-4556-801D-275E5FFC04CC -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 92E97FA1-2EDF-4476-BDD6-9DD0B4DDDC7B -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids D1E49AAC-8F56-4280-B9BA-993A6D77406C -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids B2B3F03D-6A65-4F7B-A9C7-1C7EF74A9BA4 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids C1DB55AB-C21A-4637-BB3F-A12568109D35 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 01443614-CD74-433A-B99E-2ECDC07BFC25 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 56a863a9-875e-4185-98a7-b882c64b5ce5 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 9e6c4e1f-7d60-472f-ba1a-a39ef669e4b2 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids e6db77e5-3df2-4cf1-b95a-636979351e5b -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids a8f5898e-1dc8-49a9-9878-85004b8a61e6 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 26190899-1602-49E8-8B27-EB1D0A1CE869 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 7674BA52-37EB-4A4F-A9A1-F0F9A1619A2C -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids 33ddedf1-c6e0-47cb-833e-de6133960387 -AttackSurfaceReductionRules_Actions Disabled
Add-MpPreference -AttackSurfaceReductionRules_Ids c0033c00-d16d-4114-a5a0-dc9b3a7d2ceb -AttackSurfaceReductionRules_Actions Disabled

執行加密/解密檔案來清除 c:\demo 加密。

另請參閱

受攻擊面縮小規則部署指南

受攻擊面縮小規則參考

適用於端點的 Microsoft Defender - 示範案例

提示

想要深入了解? 在我們的技術社區中與Microsoft安全社區Engage:適用於端點的 Microsoft Defender技術社區