Skip to content

Latest commit

 

History

History
24 lines (14 loc) · 860 Bytes

RedCanary2023_PowerShell.md

File metadata and controls

24 lines (14 loc) · 860 Bytes

Source:

Child process or rundll32 with a webrequest in the commandline

DeviceImageLoadEvents | where InitiatingProcessParentFileName =~ "rundll32.exe" and InitiatingProcessCommandLine has_any ("iwr","Invoke-webrequest")

Weeding out partial matches of iex or iwr using regex

DeviceProcessEvents | where ProcessCommandLine matches regex @"[^\w]iex[^\w]|invoke-expression"

DeviceProcessEvents | where ProcessCommandLine matches regex @"[^\w]iwr[^\w]|invoke-webrequest"

system.management.automation.dll

let excludedParentProcesses = datatable (process:string)["SenseIR.exe","SenseCM.exe"]; DeviceImageLoadEvents | where FileName contains "system.management.automation.dll" and InitiatingProcessParentFileName !in~ (excludedParentProcesses) | project InitiatingProcessParentFileName, InitiatingProcessFileName, InitiatingProcessCommandLine