mcpField
H
hunting-for-anomalous-powershell-execution

hunting-for-anomalous-powershell-execution

github.com/mukul975Security35.2k57 installsUpdated 8w ago
Repository

About hunting-for-anomalous-powershell-execution

A security skill for analysts hunting suspicious PowerShell activity on Windows endpoints. It parses EVTX logs and examines script blocks for obfuscation, encoded commands, download cradles, and credential theft patterns.

Key features

  1. 01Parse PowerShell EVTX logs
  2. 02Reassemble multi-part script blocks
  3. 03Detect AMSI bypass and obfuscation
  4. 04Identify encoded commands and payloads
  5. 05Flag download cradles and credential theft

Use cases

  1. 01Investigate suspicious PowerShell execution
  2. 02Build hunts from Event 4104 logs
  3. 03Prioritize malicious script findings

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill hunting-for-anomalous-powershell-execution

After installing, type/hunting-for-anomalous-powershell-executionin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

LICENSE
references/
api-reference.md
scripts/
agent.py

Details

From the project README

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

  1. Parse EVTX files extracting Event 4104 script block text and metadata
  2. Reassemble multi-part script blocks using ScriptBlock ID correlation
  3. Scan script text for AMSI bypass indicators and obfuscation patterns
  4. Detect encoded command execution and base64 payloads
  5. Identify download cradles, credential dumping, and lateral movement commands
  6. 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
}

Comments

Markdown supported