Skip to content
Skillpedia
Analysis & spreadsheets35k · #5785

hunting-for-anomalous-powershell-execution

Helps your agent find malicious activities using PowerShell by analyzing script and process logs. Useful for detecting hidden commands and security bypass attempts.

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.

Example of what to ask your AI

“Search for suspicious PowerShell activity in my event logs.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/hunting-for-anomalous-powershell-execution/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/hunting-for-anomalous-powershell-execution/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
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.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill hunting-for-anomalous-powershell-execution

Or download just the file:

curl -L https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/main/skills/hunting-for-anomalous-powershell-execution/SKILL.md -o SKILL.md
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

  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
}
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

repo: mukul975/Anthropic-Cybersecurity-Skills

Popularity

GitHub stars
35k
Ranking position
#5785
License
Apache-2.0
Updated
8/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills