Compartilhar via


Demonstrações amsi com Microsoft Defender para Ponto de Extremidade

Microsoft Defender para Ponto de Extremidade utiliza a Interface de Análise Antimalware (AMSI) para melhorar a proteção contra software maligno sem ficheiros, ataques dinâmicos baseados em scripts e outras ameaças cibernéticas não tradicionais. Neste artigo, descrevemos como testar o motor AMSI com uma amostra benigna.

Pré-requisitos

  • Microsoft Defender Antivírus (como primário) e estas capacidades têm de estar ativadas:
    • Proteção Real-Time (RTP)
    • Monitorização de Comportamento (BM)
    • Ativar a análise de scripts

Sistemas operacionais com suporte

  • Windows 10 e posterior
  • Windows Server 2016 e posterior

Testar AMSI com o Defender para Endpoint

Neste artigo de demonstração, tem duas opções de motor para testar a AMSI:

  • PowerShell
  • VBScript

Testar AMSI com o PowerShell

  1. Guarde o seguinte script do PowerShell como AMSI_PoSh_script.ps1:

    $testString = "AMSI Test Sample: " + "7e72c3ce-861b-4339-8740-0ac1484c1386"
    Invoke-Expression $testString
    ```powershell
    
    
  2. No seu dispositivo, abra o PowerShell como administrador.

  3. Digite Powershell -ExecutionPolicy Bypass AMSI_PoSh_script.ps1e pressione Enter.

    O resultado deve ser o seguinte:

       Invoke-Expression : At line:1 char:1
    
       + AMSI Test Sample: 7e72c3ce-861b-4339-8740-8ac1484c1386
    
       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
       This script contains malicious content and has been blocked by your antivirus software.
    
       At C:\Users\Admin\Desktop\AMSI_PoSh_script.ps1:3 char:1
    
       + Invoke-Expression $testString
    
       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
       + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
    
       + FullyQualifiedErrorId : ScriptContainedMaliciousContent,Microsoft.PowerShell.Commands.InvokeExpressionCommand
        ```
    
    

Testar AMSI com VBScript

  1. Guarde o VBScript seguinte como AMSI_vbscript.vbs:

    REM Save this sample AMSI vbscript as AMSI_vbscript.vbs
    Dim result
    result = eval("AMSI Test Sample: " + "7e72c3ce-861b-4339-8740-0ac1484c1386")
    WScript.Echo result
    
  2. No seu Dispositivo Windows, abra a Linha de Comandos como administrador.

  3. Digite wscript AMSI_vbscript.vbse pressione Enter.

    O resultado deve ser o seguinte:

    Windows Script Host
    
    Script: C:\Users\Admin\Desktop\AMSI_vbscript.vbs
    
    Line: 3
    
    Char: 1
    
    Error: This script contains malicious content and has been blocked by your antivirus software.: 'eval'
    
    Code: 800A802D
    
    Source: Microsoft VBScript runtime error
    

Verificar os resultados do teste

No histórico de proteção, deverá conseguir ver as seguintes informações:

Threat blocked

Detected: Virus: Win32/MpTest!amsi

Status: Cleaned

This threat or app was cleaned or quarantined before it became active on your device.

Details: This program is dangerous and replicates by infecting other files.

Affected items:

amsi: \Device\HarddiskVolume3\Windows\System32\WindowsPowershell\v1.0\powershell.exe

or

amsi: C:\Users\Admin\Desktop\AMSI_vbscript.vbs

and/or you might see:

Threat blocked

Detected: Virus: Win32/MpTest!amsi

Status: Cleaned

This threat or app was cleaned or quarantined before it became active on your device.

Details: This program is dangerous and replicates by infecting other files

Obter a lista de ameaças antivírus do Microsoft Defender

Pode ver as ameaças detetadas com o Registo de eventos ou o PowerShell.

Utilizar o Registo de eventos

  1. Aceda a Iniciar e procure EventVwr.msc. Abra Visualizador de Eventos na lista de resultados.

  2. Aceda a Registos de Aplicações e Serviços Eventos>operacionais doMicrosoft>Windows> Defender.

  3. Procure .event ID 1116 Deverá ver as seguintes informações:

    
    Microsoft Defender Antivirus has detected malware or other potentially unwanted software.
    
    For more information please see the following: https://go.microsoft.com/fwlink/?linkid=37020&name=Virus:Win32/MpTest!amsi&t
    
    Name: Virus:Win32/MpTest!amsi
    
    ID: 2147694217
    
    Severity: Severe
    
    Category: Virus
    
    Path: \Device\HarddiskVolume3\Windows\System32\WindowsPowerShell\v1.0\powershell.exe or C:\Users\Admin\Desktop\AMSI_jscri
    
    Detection Origin: Local machine or Unknown
    
    Detection Type: Concrete
    
    Detection Source: System
    
    User: NT AUTHORITY\SYSTEM
    
    Process Name: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe or C:\Windows\System32\cscript.exe or C:\Windows\Sy
    
    Security intelligence Version: AV: 1.419.221.0, AS: 1.419.221.0, NIS: 1.419.221.0
    
    Engine Version: AM: 1.1.24080.9, NIS: 1.1.24080.9
    

Usar o Windows PowerShell!

  1. No seu dispositivo, abra o PowerShell.

  2. Escreva o seguinte comando: Get-MpThreat.

    Poderá ver os seguintes resultados:

    CategoryID     : 42
    
    DidThreatExecute : True
    
    IsActive       : True
    
    Resources      :
    
    RollupStatus   : 97
    
    SchemaVersion  : 1.0.0.0
    
    SeverityID     : 5
    
    ThreatID       : 2147694217
    
    ThreatName     : Virus:Win32/MpTest!amsi
    
    TypeID         : 0
    
    PSComputerName :
    

Confira também

Microsoft Defender para Ponto de Extremidade - cenários de demonstração