Threat Hunting: PowerShell - Windows PowerShell Connections to Web Port

Where in the Cyber Kill Chain?


Reconnaisance_killchain

IDENTIFYING

PowerShell connections to web ports

COMPONENT

Remarks

TACTIC

PowerShell connections to web ports

TECHNIQUE

Identify network connections to ports 80 or 443 initiated by PowerShell. Can detect attempts to remotely download and execute script code via the PS interpreter. Should be atypical in most environments.

PROCEDURE

Aside from Exchange Server administration, PowerShell rarely communicates to port 443 during legitimate usage.

  1. Open the TaaS Tanium Console

  2. Use 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. Destination Port: (80|443)

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

Get Trace Network Connections[1 week,1529931416015|1529935015015,1,0,1,1,0,"","","","(80|443)","(?i).*powershell\.exe","",""] from all machines

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

Note: Microsoft has an additional, newer powershell binary, pwsh.exe. You should ask another question with this in your process path. For example, (?i).*\\pwsh\.exe.

Technique effective against the following adversary TTPs:

  • PowerShell Attacks