Hunts & Detections

SharePoint ToolShell exploitation and Warlock ransomware

Original query

Microsoft Sentinel · KQL · MIT

General web-shell hunt cited in Microsoft’s ToolShell report. Examine the contributing records and normal web-server activity before escalating.

Telemetry Microsoft Sentinel’s Azure Monitor IIS connector and the W3CIISLog workspace table.

KQL

let command = "(?i)net(1)?(.exe)?(%20){1,}user|cmd(.exe)?(%20){1,}/c(%20){1,}";
W3CIISLog
| where csMethod == "GET" 
| where ( csUriQuery has "whoami" or csUriQuery matches regex command ) or 
        ( csUriStem has "whoami" or csUriStem matches regex command ) or
        ( csReferer has "whoami" or csReferer matches regex command )
| summarize StartTime = max(TimeGenerated), EndTime = min(TimeGenerated), ConnectionCount = count() 
by Computer, sSiteName, sIP, cIP, csUserName, csUriQuery, csMethod, scStatus, scSubStatus, scWin32Status
| extend timestamp = StartTime, IPCustomEntity = cIP, HostCustomEntity = Computer, AccountCustomEntity = csUserName