Threat Hunting: PowerShell - Suspicious PowerShell Command Line Arguments

Where in the Cyber Kill Chain?


Reconnaisance_killchain

IDENTIFYING

Suspicious PowerShell Command-line Arguments

COMPONENT

Remarks

TACTIC

Windows PowerShell suspicious command line arguments

TECHNIQUE

Identify the execution of the PowerShell script interpreter with arguments commonly used by attackers: encoded command (enc and encodedcommand), invoke expression (iex), and reference to the .NET web client to download additional content over the Internet. This question deliberately omits the arguments used for execution policy bypass, hidden window, and no profile loading, due to the potential for their legitimate usage.

PROCEDURE

Trace Executed Processes

  1. Open the TaaS Tanium Console

  2. Using either the Question Builder or Question Bar proceed to Trace Executed Processes

  3. Treat Inputs as Regular Expressions: Enabled

  4. Skip Unique / Make Stackable: Disabled

  5. Process Path: (?i).*powershell\.exe

  6. Command Line: (?i).*(-enc|encodedcommand|iex|webclient|invoke-expression|newobject|downloadfile|downloadstring|frombase64string|deflatestr eam|createobject|uploadfile).*

Get Trace Executed Processes["",1528377490416|1528381089416,1,0,1,0,"(?i).*powershell.*","","(?i).*(-enc|- encodedcommand|iex|webclient|invoke-expression|newobject| downloadfile|downloadstring|frombase64string|deflatestr eam|createobject|uploadfile).*","","",""] from all machines

When findings come back you can drill down or change the original question to allow stackable results.

Technique effective against the following adversary TTPs:

  • PowerShell Attacks