行为监视演示

适用于:

Microsoft Defender 防病毒中的行为监视监视进程行为,以基于应用程序、服务和文件的行为检测和分析潜在威胁。 行为监视不依赖于识别已知恶意软件模式的内容匹配,而是侧重于实时观察软件的行为方式。

方案要求和设置

Windows

验证是否启用了Microsoft Defender实时保护

若要验证是否启用了实时保护,请以管理员身份打开 PowerShell,然后运行以下命令:

get-mpComputerStatus |ft RealTimeProtectionEnabled

启用实时保护后,结果将显示值 True

为Microsoft Defender for Endpoint启用行为监视

有关如何为 Defender for Endpoint 启用行为监视的详细信息,请参阅 如何启用行为监视

演示行为监视在 Windows 和 Windows Server 中的工作原理

若要演示行为监视如何阻止有效负载,请运行以下 PowerShell 命令:

powershell.exe -NoExit -Command "powershell.exe hidden 12154dfe-61a5-4357-ba5a-efecc45c34c4"

输出包含预期的错误,如下所示:

hidden : The term 'hidden' is not recognized as the name of a cmdlet, function, script, script file, or operable program.  Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+hidden 12154dfe-61a5-4357-ba5a-efecc45c34c4
+""""""
CategoryInfo             : ObjectNotFound: (hidden:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException

在Microsoft Defender门户的“操作中心”中,应看到以下信息:

  • Windows 安全中心
  • 发现威胁
  • Microsoft Defender防病毒发现威胁。 获取详细信息。
  • 消除

如果选择链接,则会打开Windows 安全中心应用。 选择“ 保护历史记录”。

应会看到类似于以下输出的信息:

Threat blocked
Detected: Behavior:Win32/BmTestOfflineUI
Status: Removed
A threat or app was removed from this device.
Date: 6/7/2024 11:51 AM
Details: This program is dangerous and executes command from an attacker.
Affected items:
behavior: process: C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe, pid:6132:118419370780344
process: pid:6132,ProcessStart:133621698624737241
Learn more    Actions

Microsoft Defender门户中,应会看到如下信息:

Suspicious 'BmTestOfflineUI' behavior was blocked

选择它时,会看到包含以下信息的警报树:

Defender detected and terminated active 'Behavior:Win32/BmTestOfflineUI' in process 'powershell.exe' during behavior monitoring

macOS

验证Microsoft Defender是否启用了实时保护

若要验证是否启用了实时保护 (RTP) ,请打开终端窗口并复制并执行以下命令:

mdatp health --field real_time_protection_enabled

启用 RTP 后,结果将显示值 1。

为Microsoft Defender for Endpoint启用行为监视

有关如何为 Defender for Endpoint 启用行为监视的详细信息,请参阅 行为监视的部署说明

演示行为监视的工作原理

若要演示行为监视如何阻止有效负载,请执行以下操作:

  1. 使用脚本/文本编辑器(如 nano 或 Visual Studio Code (VS Code) )创建 bash 脚本:

    #! /usr/bin/bash
    echo " " >> /tmp/9a74c69a-acdc-4c6d-84a2-0410df8ee480.txt
    echo " " >> /tmp/f918b422-751c-423e-bfe1-dbbb2ab4385a.txt
    sleep 5
    
  2. BM_test.sh另存为 。

  3. 运行以下命令,使 bash 脚本可执行:

    sudo chmod u+x BM_test.sh
    
  4. 运行 bash 脚本:

    sudo bash BM_test.sh
    

    结果应如下所示

    zsh: killed sudo bash BM_test.sh

    该文件由 macOS 上的 Defender for Endpoint 隔离。 使用以下命令列出所有检测到的威胁:

    mdatp threat list
    

    结果显示如下信息:

    ID: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    
    Name: Behavior: MacOS/MacOSChangeFileTest
    
    Type: "behavior"
    
    Detection time: Tue May 7 20:23:41 2024
    
    Status: "quarantined"
    

如果Microsoft Defender for Endpoint P2/P1 或Microsoft Defender 商业版,请转到Microsoft Defender门户,并看到标题为“可疑的'MacOSChangeFileTest'行为被阻止”的警报。