Ricerca ransomware

Si applica a:

  • Microsoft Defender XDR

Ransomware si è evoluto rapidamente da semplice malware commodity che colpisce i singoli utenti di computer a una minaccia aziendale che sta gravemente influenzando settori e istituzioni governative. Anche se Microsoft Defender XDR offre molte funzionalità che rilevano e bloccano ransomware e le attività di intrusione associate, l'esecuzione di controlli proattivi per i segni di compromissione può aiutare a mantenere la rete protetta.

Informazioni sul ransomware gestito dall'uomo

Con la ricerca avanzata in Microsoft Defender XDR, è possibile creare query che individuano singoli artefatti associati all'attività ransomware. È anche possibile eseguire query più sofisticate che possono cercare segni di attività e pesare tali segni per trovare i dispositivi che richiedono attenzione immediata.

Segni di attività ransomware

Ricercatori di sicurezza Microsoft hanno osservato vari artefatti comuni ma sottili in molte campagne ransomware lanciato da intrusi sofisticati. Questi segni implicano principalmente l'uso di strumenti di sistema per preparare la crittografia, impedire il rilevamento e chiarire le prove forensi.

Attività ransomware Strumenti comuni Intento
Arrestare i processi taskkill.exe, net stop Assicurarsi che i file destinati alla crittografia non siano bloccati da varie applicazioni.
Disattivare i servizi sc.exe - Verificare che i file destinati alla crittografia non siano bloccati da varie applicazioni.
- Impedire che il software di sicurezza interrompa la crittografia e altre attività ransomware.
- Interrompi la creazione di copie ripristinabili da parte del software di backup.
Eliminare log e file cipher.exe, wevtutil, fsutil.exe Rimuovere le prove forensi.
Eliminare copie shadow vsadmin.exe, wmic.exe Rimuovere le copie shadow dell'unità che possono essere usate per ripristinare i file crittografati.
Eliminare e arrestare i backup wbadmin.exe Eliminare i backup esistenti e arrestare le attività di backup pianificate, impedendo il ripristino dopo la crittografia.
Modificare le impostazioni di avvio bcdedit.exe Disattiva avvisi e riparazioni automatiche dopo errori di avvio che possono essere causati dal processo di crittografia.
Disattivare gli strumenti di ripristino schtasks.exe, regedit.exe, Disattivare Ripristino di sistema e altre opzioni di ripristino del sistema.

Verificare la presenza di singoli segni di attività ransomware

Molte attività che costituiscono il comportamento ransomware, incluse le attività descritte nella sezione precedente, possono essere benigne. Quando si usano le query seguenti per individuare il ransomware, eseguire più di una query per verificare se gli stessi dispositivi presentano vari segni di possibile attività ransomware.

Arresto di più processi con taskkill.exe

Questa query verifica la presenza di tentativi di arrestare almeno 10 processi separati usando l'utilità taskkill.exe . Esegui query

// Find attempts to stop processes using taskkill.exe
DeviceProcessEvents
| where Timestamp > ago(1d)
| where FileName =~ "taskkill.exe" 
| summarize taskKillCount = dcount(ProcessCommandLine), TaskKillList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 2m)
| where taskKillCount > 10

Arresto dei processi tramite net stop

Questa query verifica la presenza di tentativi di arrestare almeno 10 processi separati usando il comando net stop . Esegui query

// Find attempts to stop processes using net stop
DeviceProcessEvents
| where Timestamp > ago(1d)
| where FileName =~ "net.exe" and ProcessCommandLine has "stop"
| summarize netStopCount = dcount(ProcessCommandLine), NetStopList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 2m)
| where netStopCount > 10

Eliminazione dei dati in più unità tramite cipher.exe

Questa query verifica la presenza di tentativi di eliminazione dei dati in più unità usando cipher.exe. Questa attività viene in genere eseguita dal ransomware per impedire il ripristino dei dati dopo la crittografia. Esegui query

// Look for cipher.exe deleting data from multiple drives
DeviceProcessEvents
| where Timestamp > ago(1d)
| where FileName =~ "cipher.exe" 
// cipher.exe /w flag used for deleting data 
| where ProcessCommandLine has "/w" 
| summarize CipherCount = dcount(ProcessCommandLine),
CipherList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 1m) 
// cipher.exe accessing multiple drives in a short timeframe 
| where CipherCount > 1

Cancellazione delle prove forensi dai log eventi usando wevtutil

Questa query verifica la presenza di tentativi di cancellare almeno 10 voci di log dai log eventi usando wevtutil. Esegui query

// Look for use of wevtutil to clear multiple logs
DeviceProcessEvents
| where Timestamp > ago(1d)
| where ProcessCommandLine has "WEVTUTIL" and ProcessCommandLine has "CL"
| summarize LogClearCount = dcount(ProcessCommandLine), ClearedLogList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 5m)
| where LogClearCount > 10

Disattivazione dei servizi tramite sc.exe

Questa query verifica la presenza di tentativi di disattivare almeno 10 servizi esistenti usando sc.exe. Esegui query

// Look for sc.exe disabling services
DeviceProcessEvents
| where Timestamp > ago(1d)
| where ProcessCommandLine has "sc" and ProcessCommandLine has "config" and ProcessCommandLine has "disabled"
| summarize ScDisableCount = dcount(ProcessCommandLine), ScDisableList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 5m)
| where ScDisableCount > 10

Disattivazione del ripristino del sistema

Questa query identifica i tentativi di arrestare Il ripristino del sistema e impedire al sistema di creare punti di ripristino, che possono essere usati per recuperare i dati crittografati da ransomware. Esegui query

DeviceProcessEvents
//Pivoting for rundll32  
| where InitiatingProcessFileName =~ 'rundll32.exe'   
//Looking for empty command line   
and InitiatingProcessCommandLine !contains " " and InitiatingProcessCommandLine != ""  
//Looking for schtasks.exe as the created process  
and FileName in~ ('schtasks.exe')  
//Disabling system restore   
and ProcessCommandLine has 'Change' and ProcessCommandLine has 'SystemRestore' 
and ProcessCommandLine has 'disable'

Eliminazione del backup

Questa query identifica l'uso di wmic.exe per eliminare gli snapshot di copia shadow prima della crittografia. Esegui query

DeviceProcessEvents
| where FileName =~ "wmic.exe"
| where ProcessCommandLine has "shadowcopy" and ProcessCommandLine has "delete"
| project DeviceId, Timestamp, InitiatingProcessFileName, FileName,
ProcessCommandLine, InitiatingProcessIntegrityLevel, InitiatingProcessParentFileName

Verificare la presenza di più segni di attività ransomware

Invece di eseguire diverse query separatamente, è anche possibile usare una query completa che verifica la presenza di più segni di attività ransomware per identificare i dispositivi interessati. La query consolidata seguente:

  • Cerca segni relativamente concreti e sottili di attività ransomware
  • Pesa la presenza di questi segni
  • Identifica i dispositivi con una maggiore probabilità di essere obiettivi di ransomware

Quando viene eseguita, questa query consolidata restituisce un elenco di dispositivi che hanno mostrato più segni di attacco. Viene visualizzato anche il conteggio di ogni tipo di attività ransomware. Per eseguire questa query consolidata, copiarla direttamente nell'editor di query di ricerca avanzata.

// Find attempts to stop processes using taskkill.exe
let taskKill = DeviceProcessEvents
| where Timestamp > ago(1d)
| where FileName =~ "taskkill.exe" 
| summarize taskKillCount = dcount(ProcessCommandLine), TaskKillList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 2m)
| where taskKillCount > 10;
// Find attempts to stop processes using net stop
let netStop = DeviceProcessEvents
| where Timestamp > ago(1d)
| where FileName =~ "net.exe" and ProcessCommandLine has "stop"
| summarize netStopCount = dcount(ProcessCommandLine), NetStopList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 2m)
| where netStopCount > 10;
// Look for cipher.exe deleting data from multiple drives
let cipher = DeviceProcessEvents
| where Timestamp > ago(1d)
| where FileName =~ "cipher.exe" 
// cipher.exe /w flag used for deleting data 
| where ProcessCommandLine has "/w" 
| summarize CipherCount = dcount(ProcessCommandLine), 
CipherList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 1m) 
// cipher.exe accessing multiple drives in a short timeframe 
| where CipherCount > 1;
// Look for use of wevtutil to clear multiple logs
let wevtutilClear = DeviceProcessEvents
| where Timestamp > ago(1d)
| where ProcessCommandLine has "WEVTUTIL" and ProcessCommandLine has "CL"
| summarize LogClearCount = dcount(ProcessCommandLine), ClearedLogList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 5m)
| where LogClearCount > 10;
// Look for sc.exe disabling services
let scDisable = DeviceProcessEvents
| where Timestamp > ago(1d)
| where ProcessCommandLine has "sc" and ProcessCommandLine has "config" and ProcessCommandLine has "disabled"
| summarize ScDisableCount = dcount(ProcessCommandLine), ScDisableList = make_set(ProcessCommandLine) by DeviceId, bin(Timestamp, 5m)
| where ScDisableCount > 10;
// Main query for counting and aggregating evidence
DeviceProcessEvents
| where Timestamp > ago(1d)
| where FileName =~ "vssadmin.exe" and ProcessCommandLine has_any("list shadows", "delete shadows")
or FileName =~ "fsutil.exe" and ProcessCommandLine has "usn" and ProcessCommandLine has "deletejournal"
or ProcessCommandLine has("bcdedit") and ProcessCommandLine has_any("recoveryenabled no", "bootstatuspolicy ignoreallfailures")
or ProcessCommandLine has "wbadmin" and ProcessCommandLine has "delete" and ProcessCommandLine has_any("backup", "catalog", "systemstatebackup")
or (ProcessCommandLine has "wevtutil" and ProcessCommandLine has "cl") 
or (ProcessCommandLine has "wmic" and ProcessCommandLine has "shadowcopy delete")
or (ProcessCommandLine has "sc" and ProcessCommandLine has "config" and ProcessCommandLine has "disabled")
| extend Bcdedit = iff(ProcessCommandLine has "bcdedit" and ProcessCommandLine has_any("recoveryenabled no", "bootstatuspolicy ignoreallfailures"), 1, 0)
| extend ShadowCopyDelete = iff (ProcessCommandLine has "shadowcopy delete", 1, 0)
| extend VssAdminShadows = iff(ProcessCommandLine has "vssadmin" and ProcessCommandLine has_any("list shadows", "delete shadows"), 1, 0)
| extend Wbadmin = iff(ProcessCommandLine has "wbadmin" and ProcessCommandLine has "delete" and ProcessCommandLine has_any("backup", "catalog", "systemstatebackup"), 1,0)
| extend Fsutil = iff(ProcessCommandLine has "fsutil" and ProcessCommandLine has "usn" and ProcessCommandLine has "deletejournal", 1, 0)
| summarize FirstActivity = min(Timestamp), ReportId = any(ReportId), Commands = make_set(ProcessCommandLine) by DeviceId, Fsutil, Wbadmin, ShadowCopyDelete, Bcdedit, VssAdminShadows, bin(Timestamp, 6h)
// Joining extra evidence
| join kind=leftouter (wevtutilClear) on $left.DeviceId == $right.DeviceId
| join kind=leftouter (cipher) on $left.DeviceId == $right.DeviceId
| join kind=leftouter (netStop) on $left.DeviceId == $right.DeviceId
| join kind=leftouter (taskKill) on $left.DeviceId == $right.DeviceId
| join kind=leftouter (scDisable) on $left.DeviceId == $right.DeviceId
| extend WevtutilUse = iff(LogClearCount > 10, 1, 0)
| extend CipherUse = iff(CipherCount > 1, 1, 0)
| extend NetStopUse = iff(netStopCount > 10, 1, 0)
| extend TaskkillUse = iff(taskKillCount > 10, 1, 0)
| extend ScDisableUse = iff(ScDisableCount > 10, 1, 0)
// Adding up all evidence
| mv-expand CommandList = NetStopList, TaskKillList, ClearedLogList, CipherList, Commands, ScDisableList
// Format results
| summarize BcdEdit = iff(make_set(Bcdedit) contains "1" , 1, 0), NetStop10PlusCommands = iff(make_set(NetStopUse) contains "1", 1, 0), Wevtutil10PlusLogsCleared = iff(make_set(WevtutilUse) contains "1", 1, 0),
CipherMultipleDrives = iff(make_set(CipherUse) contains "1", 1, 0), Fsutil = iff(make_set(Fsutil) contains "1", 1, 0), ShadowCopyDelete = iff(make_set(ShadowCopyDelete) contains "1", 1, 0),
Wbadmin = iff(make_set(Wbadmin) contains "1", 1, 0), TaskKill10PlusCommand = iff(make_set(TaskkillUse) contains "1", 1, 0), VssAdminShadow = iff(make_set(VssAdminShadows) contains "1", 1, 0), 
ScDisable = iff(make_set(ScDisableUse) contains "1", 1, 0), TotalEvidenceCount = count(CommandList), EvidenceList = make_set(Commands), StartofBehavior = min(FirstActivity) by DeviceId, bin(Timestamp, 1d)
| extend UniqueEvidenceCount = BcdEdit + NetStop10PlusCommands + Wevtutil10PlusLogsCleared + CipherMultipleDrives + Wbadmin + Fsutil + TaskKill10PlusCommand + VssAdminShadow + ScDisable + ShadowCopyDelete
| where UniqueEvidenceCount > 2

Comprendere e modificare i risultati della query

La query consolidata restituisce i risultati seguenti:

  • DeviceId: identifica il dispositivo interessato
  • TimeStamp: prima volta che è stato osservato un segno di attività ransomware sul dispositivo
  • Segni di attività specifici: il conteggio per ogni segno visualizzato in più colonne, ad esempio BcdEdit o FsUtil
  • TotalEvidenceCount: numero di segni osservati
  • UniqueEvidenceCount: numero di tipi di segni osservati

Esempio di query consolidata per un'attività ransomware nel portale di Microsoft Defender

Risultati delle query che mostrano i dispositivi interessati e i conteggi dei vari segni di attività ransomware

Per impostazione predefinita, i risultati della query elencano solo i dispositivi con più di due tipi di attività ransomware. Per visualizzare tutti i dispositivi con qualsiasi segno di attività ransomware, modificare l'operatore seguente where e impostare il numero su zero (0). Per visualizzare un minor numero di dispositivi, impostare un numero più alto.

| where UniqueEvidenceCount > 2

Altre risorse ransomware

Informazioni chiave di Microsoft:

Microsoft 365:

Microsoft Azure:

Microsoft Defender for Cloud Apps:

Post di blog del team Microsoft Security:

Consiglio

Per saperne di più, Engage con la community Microsoft Security nella community tech: Microsoft Defender XDR Tech Community.