cscli scenarios install sigmahq/proc_creation_win_powershell_snapins_hafnium1type: trigger2name: sigmahq/proc_creation_win_powershell_snapins_hafnium3description: |4 Detects adding and using Exchange PowerShell snap-ins to export mailbox data. As seen used by HAFNIUM and APT275filter: |6 (evt.Meta.service == 'sysmon' && evt.Parsed.EventID == '1') && ((evt.Parsed.Image endsWith '\\powershell.exe' || evt.Parsed.Image endsWith '\\pwsh.exe' || evt.Parsed.OriginalFileName in ['PowerShell.EXE', 'pwsh.dll']) && evt.Parsed.CommandLine contains 'Add-PSSnapin' && (evt.Parsed.CommandLine contains 'Microsoft.Exchange.Powershell.Snapin' || evt.Parsed.CommandLine contains 'Microsoft.Exchange.Management.PowerShell.SnapIn') && not (evt.Parsed.ParentImage == 'C:\\Windows\\System32\\msiexec.exe' && evt.Parsed.CommandLine contains '$exserver=Get-ExchangeServer ([Environment]::MachineName) -ErrorVariable exerr 2> $null'))7blackhole: 2m8#status: test9labels:10 service: windows11 confidence: 112 spoofable: 013 classification:14 - attack.t1059.00115 - attack.t11141617 label: "Exchange PowerShell Snap-Ins Usage"18 behavior : "windows:audit"19 remediation: false2021scope:22 type: ParentProcessId23 expression: evt.Parsed.ParentProcessId2425