let vm_p_off =
VMwareESXi
| where TimeGenerated > ago(14d)
| where SyslogMessage has ('VmPoweredOffEvent')
| extend DstHostname = extract(@'\[\d+\]\s+\[(.*?)\s+on', 1, SyslogMessage)
| summarize LastPowerOffTime=max(TimeGenerated) by DstHostname
| where datetime_diff('day',datetime(now),LastPowerOffTime) >= 20;
let vm_p_on =
VMwareESXi
| where TimeGenerated > ago(14d)
| where SyslogMessage has ('VmPoweredOnEvent')
| extend DstHostname = extract(@'\[\d+\]\s+\[(.*?)\s+on', 1, SyslogMessage)
| summarize LastPowerOnTime=max(TimeGenerated) by DstHostname
| where datetime_diff('day',datetime(now),LastPowerOnTime) >= 20;
let off_vms =
vm_p_on
| join (vm_p_off) on DstHostname
| where LastPowerOffTime > LastPowerOnTime
| summarize p_off_vm = make_set(DstHostname,200)
| extend k=1;
VMwareESXi
| where TimeGenerated between (ago(24h) .. datetime(now))
| where SyslogMessage has ('VmPoweredOnEvent')
| extend DstHostname = extract(@'\[\d+\]\s+\[(.*?)\s+on', 1, SyslogMessage)
| extend k=1
| join (off_vms) on k
| where p_off_vm !has DstHostname
| summarize rec_p_on = make_set(DstHostname,200)
| extend hostname = iff(array_length(rec_p_on) > 0, rec_p_on[0], "")
| extend NTDomain = tostring(split(hostname, '\\', 1)[0]), HostName = tostring(split(hostname, '.', 0)[0])
queryPeriod: 14d
query: |
let vm_p_off =
VMwareESXi
| where TimeGenerated > ago(14d)
| where SyslogMessage has ('VmPoweredOffEvent')
| extend DstHostname = extract(@'\[\d+\]\s+\[(.*?)\s+on', 1, SyslogMessage)
| summarize LastPowerOffTime=max(TimeGenerated) by DstHostname
| where datetime_diff('day',datetime(now),LastPowerOffTime) >= 20;
let vm_p_on =
VMwareESXi
| where TimeGenerated > ago(14d)
| where SyslogMessage has ('VmPoweredOnEvent')
| extend DstHostname = extract(@'\[\d+\]\s+\[(.*?)\s+on', 1, SyslogMessage)
| summarize LastPowerOnTime=max(TimeGenerated) by DstHostname
| where datetime_diff('day',datetime(now),LastPowerOnTime) >= 20;
let off_vms =
vm_p_on
| join (vm_p_off) on DstHostname
| where LastPowerOffTime > LastPowerOnTime
| summarize p_off_vm = make_set(DstHostname,200)
| extend k=1;
VMwareESXi
| where TimeGenerated between (ago(24h) .. datetime(now))
| where SyslogMessage has ('VmPoweredOnEvent')
| extend DstHostname = extract(@'\[\d+\]\s+\[(.*?)\s+on', 1, SyslogMessage)
| extend k=1
| join (off_vms) on k
| where p_off_vm !has DstHostname
| summarize rec_p_on = make_set(DstHostname,200)
| extend hostname = iff(array_length(rec_p_on) > 0, rec_p_on[0], "")
| extend NTDomain = tostring(split(hostname, '\\', 1)[0]), HostName = tostring(split(hostname, '.', 0)[0])
name: VMware ESXi - Dormant VM started
entityMappings:
- fieldMappings:
- columnName: HostName
identifier: HostName
- columnName: NTDomain
identifier: NTDomain
entityType: Host
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/VMWareESXi/Analytic Rules/ESXiDormantVMStarted.yaml
requiredDataConnectors:
- connectorId: SyslogAma
datatypes:
- Syslog
description: |
'Detects when dormant VM was started.'
kind: Scheduled
version: 1.0.3
queryFrequency: 1h
severity: Medium
relevantTechniques:
- T1190
triggerOperator: gt
triggerThreshold: 0
tactics:
- InitialAccess
id: 4cdcd5d8-89df-4076-a917-bc50abb9f2ab