Detection rules › Kusto

Detect Unknown process launched via WinRM

Author
Robbe Van den Daele
Source
github.com/HybridBrothers/Hunting-Queries-Detection-Rules

When an unknown process is being launched from the WinRM service on a server, this might indicate a malicious actor spreading malware on various servers via the WinRM protocol.

MITRE ATT&CK coverage

References

Event coverage

Rule body yaml

DeviceProcessEvents
| where InitiatingProcessFileName contains "wsmprovhost.exe"
| invoke FileProfile(SHA1)
| where GlobalPrevalence < 1000
| join kind=leftouter (
    DeviceNetworkEvents
    | where ActionType == "InboundConnectionAccepted"
    | where LocalPort in ("5985", "5986")
    | distinct RemoteIP, DeviceId
) on DeviceId
| project-away DeviceId1

Stages and Predicates

Stage 1: source

DeviceProcessEvents

Stage 2: where

| where InitiatingProcessFileName contains "wsmprovhost.exe"

Stage 3: invoke

| invoke FileProfile(SHA1)

Stage 4: where

| where GlobalPrevalence < 1000

Stage 5: join

| join kind=leftouter (
    DeviceNetworkEvents
    | where ActionType == "InboundConnectionAccepted"
    | where LocalPort in ("5985", "5986")
    | distinct RemoteIP, DeviceId
) on DeviceId

Stage 6: project-away

| project-away DeviceId1

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
ActionTypeeq
  • InboundConnectionAccepted transforms: cased corpus 3 (kusto 3)
GlobalPrevalencelt
  • 1000 transforms: cased corpus 4 (kusto 4)
InitiatingProcessFileNamecontains
  • wsmprovhost.exe
LocalPortin
  • 5985 transforms: cased
  • 5986 transforms: cased