Detecting Malware Infection (MITRE ATT&CK: T1566, T1059)
Detecting Malware Infection (MITRE ATT&CK: T1566, T1059)
Overview:
DeviceProcessEvents | where FileName == "powershell.exe" and ProcessCommandLine has "encodedCommand" | where InitiatingProcessAccountName !="network service" and InitiatingProcessAccountName !="system"| summarize count() by TimeGenerated, DeviceName, InitiatingProcessAccountName, InitiatingProcessCommandLine, ProcessCommandLine# Example encoded string
$EncodedCommand = "enter encoded string"
# Convert from Base64 to bytes
$Bytes = [System.Convert]::FromBase64String($EncodedCommand)
# Convert bytes to string (UTF-16 LE)
$DecodedCommand = [System.Text.Encoding]::Unicode.GetString($Bytes)
# Output the decoded command
Write-Output $DecodedCommandMethod 2: Decode Using Python
Last updated