Execution (TA0002)

Sub-technique: T1059.001 - PowerShell

Objective: Detect malicious PowerShell script execution.

  1. Detect PowerShell Script Execution

DeviceProcessEvents
| where ProcessCommandLine has "powershell"
| project Timestamp, DeviceName, AccountName, ProcessCommandLine, InitiatingProcessAccountName, AccountDomain, ActionType, FolderPath, FileName
| order by Timestamp desc

Purpose: Identify PowerShell script execution.

  1. Detect Obfuscated PowerShell Commands

DeviceProcessEvents
| where ProcessCommandLine has "powershell" and ProcessCommandLine matches regex "(?i)[^a-zA-Z0-9\\s]"
| project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName, AccountDomain, ActionType, FolderPath, FileName
| order by Timestamp desc

Purpose: Detect obfuscated PowerShell commands.

  1. PowerShell Download and Execute

DeviceProcessEvents
| where ProcessCommandLine has "Invoke-WebRequest"
| project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName, AccountDomain, ActionType, FolderPath, FileName
| order by Timestamp desc

Purpose: Identify PowerShell commands downloading and executing content.

  1. Detect PowerShell Executed from Suspicious Directories

Purpose: Detect PowerShell execution from temporary directories.

  1. Detect PowerShell Encoded Commands

Purpose: Identify PowerShell commands executed with encoded strings.

  1. Monitor PowerShell for Command Line Length

Purpose: Detect long command-line executions that could indicate complex scripts.

  1. PowerShell Execution by Non-Admin Users

Purpose: Monitor PowerShell usage by non-administrative users.

  1. PowerShell Process Chaining

Purpose: Detect PowerShell chained with other interpreters.

  1. Detect PowerShell Execution via Macro

Purpose: Identify PowerShell executed from Microsoft Word macros.

  1. Monitor PowerShell Remoting

Purpose: Detect the use of PowerShell Remoting.

Last updated