Execution (TA0002)
Sub-technique: T1059.001 - PowerShell
Objective: Detect malicious PowerShell script execution.
Detect PowerShell Script Execution
DeviceProcessEvents
| where ProcessCommandLine has "powershell"
| project Timestamp, DeviceName, AccountName, ProcessCommandLine, InitiatingProcessAccountName, AccountDomain, ActionType, FolderPath, FileName
| order by Timestamp descPurpose: Identify PowerShell script execution.
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 descPurpose: Detect obfuscated PowerShell commands.
PowerShell Download and Execute
DeviceProcessEvents
| where ProcessCommandLine has "Invoke-WebRequest"
| project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessAccountName, AccountDomain, ActionType, FolderPath, FileName
| order by Timestamp descPurpose: Identify PowerShell commands downloading and executing content.
Detect PowerShell Executed from Suspicious Directories
Purpose: Detect PowerShell execution from temporary directories.
Detect PowerShell Encoded Commands
Purpose: Identify PowerShell commands executed with encoded strings.
Monitor PowerShell for Command Line Length
Purpose: Detect long command-line executions that could indicate complex scripts.
PowerShell Execution by Non-Admin Users
Purpose: Monitor PowerShell usage by non-administrative users.
PowerShell Process Chaining
Purpose: Detect PowerShell chained with other interpreters.
Detect PowerShell Execution via Macro
Purpose: Identify PowerShell executed from Microsoft Word macros.
Monitor PowerShell Remoting
Purpose: Detect the use of PowerShell Remoting.
Last updated