Hunting for anomalous powershell execution
Skill pinkpixel-dev/skills-collection-1/SKILLS/hunting-for-anomalous-powershell-execution
Hunt for malicious PowerShell activity by analyzing Script Block Logging (Event 4104), Module Logging (Event 4103), and process creation events. The analyst parses Windows Event Log EVTX files to detect obfuscated commands, AMSI bypass attempts, encoded payloads, credential dumping keywords, and suspicious download cradles. Activates for requests involving PowerShell threat hunting, script block analysis, encoded command detection, or AMSI bypass identification.From its SKILL.md
npx -y skills add pinkpixel-dev/skills-collection-1 --skill hunting-for-anomalous-powershell-executionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 7 stars7 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as Apache-2.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
2.4 KB, 368 tokens by cl100k_base, as published. Nobody here has run it
Hunting for Anomalous PowerShell Execution
Overview
PowerShell Script Block Logging (Event ID 4104) records the full deobfuscated script text executed on a Windows endpoint, making it the primary data source for hunting malicious PowerShell. Combined with Module Logging (4103) and process creation events, analysts can detect encoded commands, AMSI bypass patterns, download cradles, credential theft tools, and fileless attack techniques even when the attacker uses obfuscation layers.
When to Use
- When investigating security incidents that require hunting for anomalous powershell execution
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- Windows Event Log exports (.evtx) from Microsoft-Windows-PowerShell/Operational
- Python 3.8+ with python-evtx and lxml libraries
- Script Block Logging enabled via Group Policy
- Understanding of common PowerShell attack techniques
Steps
- Parse EVTX files extracting Event 4104 script block text and metadata
- Reassemble multi-part script blocks using ScriptBlock ID correlation
- Scan script text for AMSI bypass indicators and obfuscation patterns
- Detect encoded command execution and base64 payloads
- Identify download cradles, credential dumping, and lateral movement commands
- Score and prioritize findings by threat severity
Expected Output
{
"total_events": 1247,
"suspicious_events": 23,
"amsi_bypass_attempts": 2,
"encoded_commands": 8,
"download_cradles": 5,
"credential_access": 3
}
What ships with it: 3 files
23.7 KB alongside SKILL.md, 1 of them executable
references/
- api-reference.md4.1 KB
scripts/
- agent.pyruns8.6 KB
- LICENSE11.0 KB