Hunting suspicious powershell execution

From meltedinhex/analyst-ai-pack · View interactive version

Hunting suspicious powershell execution is an AI agent skill from the GitHub repository meltedinhex/analyst-ai-pack. Hunts malicious PowerShell using script-block (EID 4104) and module logging: scoring encoded commands, download cradles, AMSI/logging bypass, and in-memory execution, then decoding payloads for triage. Activates for requests to hunt malicious PowerShell, analyze script-block logs, or detect encoded

How to use this skill

Skill file

Hunting Suspicious PowerShell Execution

When to Use

AMSI/logging bypasses.

Do not use simple keyword blocklists as the sole method — admins legitimately use many of

the same cmdlets; score combinations and decode before judging.

Prerequisites

Workflow

Step 1: Collect script-block events

Pull EID 4104 script-block text (and EID 4103 module logging) over the hunt window. Reassemble

multi-part script blocks before analysis.

Step 2: Score suspicious constructs

Weight combinations rather than single keywords: -EncodedCommand, IEX/Invoke-Expression

with Net.WebClient/Invoke-WebRequest, FromBase64String, -w hidden -nop, AMSI strings,

and [Ref].Assembly reflection.

python scripts/analyst.py score events.json

Step 3: Decode payloads

Base64-decode -EncodedCommand (UTF-16LE) and recover layered encodings to read the real

intent (download URLs, in-memory loaders).

Step 4: Baseline and pivot

Compare against normal admin activity; for survivors, pull the parent process, user, host, and

network connections to confirm.

Step 5: Confirm and operationalize

Validate true positives, escalate to IR, and convert the scoring logic into a detection rule.

Validation

Pitfalls

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.