hunting-for-anomalous-powershell-execution
What it does
This tool searches for malicious PowerShell activity in your Windows event logs. It analyzes executed scripts to find attempts to disguise commands, bypass security (AMSI), download suspicious code, or steal credentials.
When to use it
- ✓When investigating a security incident involving PowerShell.
- ✓When creating rules to detect suspicious PowerShell activity.
- ✓When checking if your monitoring system detects common PowerShell attacks.
Skill link
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/hunting-for-anomalous-powershell-execution/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Search for suspicious PowerShell activity in my event logs.”
5 new skills a week. 1 minute to read.
How it works
The tool reads Windows event log files (.evtx) that contain information about what PowerShell executed. It looks for known attack patterns, such as encoded commands or attempts to bypass security.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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
}
FAQ
What is 'Script Block Logging'?
These are detailed logs that show exactly which commands and scripts PowerShell executed, even if the attacker tried to hide them.
What is AMSI?
AMSI (Antimalware Scan Interface) is a Windows security layer that helps detect and block malicious software. The tool looks for attempts to disable or trick AMSI.
What are 'download cradles'?
These are code snippets used to download and execute other malicious programs directly from the internet, without saving a file to disk.
Details
Original description by the author
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 a
Popularity
- GitHub stars
- 35k
- Ranking position
- #7948
- License
- Apache-2.0
- Updated
- 8/31/2026
Comments
- …
More skills from this repository
abusing-dpapi-for-credential-access
35kGives your AI agent ready-made instructions for a specific task, so it does it better and faster.
abusing-shadow-credentials-for-privesc
35kTeaches your AI agent to write clear, well-structured text.
achieving-cmmc-level-2-compliance
35kHelps your agent prepare an environment for CMMC Level 2 compliance. It implements security requirements and manages necessary documentation.
acquiring-disk-image-with-dd-and-dcfldd
35kHelps your agent create exact copies of hard drives. This is useful for ensuring no information is lost or altered during investigations.
Similar skills
gitcrawl
394kLets your agent search a saved archive of GitHub issues and pull requests, group duplicates, and check their current status on GitHub.
slacrawl
394kLets your agent search and count messages in a local Slack archive, check how fresh that archive is, and refresh it when needed.
goplaces
394kHelps your agent search for places, get their details and reviews, and resolve place names using Google Places, with JSON output for scripts.