Source dated
SharePoint ToolShell exploitation and Warlock ransomware
Original query
Microsoft Defender XDR ยท KQL
Examines web-server child process telemetry for campaign-related evidence.
Telemetry DeviceProcessEvents
DeviceProcessEvents
| where InitiatingProcessFileName has "w3wp.exe"
and InitiatingProcessCommandLine !has "DefaultAppPool"
and FileName =~ "cmd.exe"
and ProcessCommandLine has_all ("cmd.exe", "powershell")
and ProcessCommandLine has_any ("EncodedCommand", "-ec")
| extend CommandArguments = split(ProcessCommandLine, " ")
| mv-expand CommandArguments to typeof(string)
| where CommandArguments matches regex "^[A-Za-z0-9+/=]{15,}$"
| extend B64Decode = replace("\\x00", "", base64_decodestring(tostring(CommandArguments)))
| where B64Decode contains "spinstall" or B64Decode contains "spupdate" or B64Decode contains "SpLogoutLayout" or B64Decode contains "SP.UI.TitleView"
or B64Decode contains "queryruleaddtool" or B64Decode contains "ClientId" and B64Decode contains
@'C:\PROGRA~1\COMMON~1\MICROS~1\WEBSER~1\15\TEMPLATE\LAYOUTS' or B64Decode contains @'C:\PROGRA~1\COMMON~1\MICROS~1\WEBSER~1\16\TEMPLATE\LAYOUTS'