Detection rules › Kusto Query Language

Java Executing cmd to run Powershell

Source
upstream

This query was originally published in the threat analytics report, Sysrv botnet evolution. Sysrv is a Go-based botnet that targets both Windows and Linux servers, and steals resources to mine cryptocurrency. The following query finds instances of the Java process being used to execute cmd.exe, and download and execute a PowerShell script.

MITRE ATT&CK coverage

TacticTechniques
ExecutionT1059 Command and Scripting Interpreter

Event coverage

ProviderEvent IDTitle
Sysmon1Process creation
Security-Auditing4688A new process has been created.
Defender-DeviceProcessEvents9001000Process activity (any)

Stages and Predicates

Stage 1: source

DeviceProcessEvents

Stage 2: where

and
  FileName eq "cmd.exe"
  InitiatingProcessFileName eq "java.exe"
  ProcessCommandLine match ["powershell iex", "DownloadString"]

Stage 3: extend

Stage 4: extend

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
FileNameeq
  • cmd.exe
InitiatingProcessFileNameeq
  • java.exe
ProcessCommandLinematch
  • DownloadString corpus 5 (sigma 5)
  • powershell iex