Skip to content
New

DeepSeek V4.1 Flash free for 7 days: 10M tokens a day after a top-up of $10 or more. Until Nov 30.

How it works
mukul975/hunting-for-anomalous-powershell-executionDFIR and threat hunting

hunting-for-anomalous-powershell-execution

⁨Hunt for malicious PowerShell activity by analyzing Script Block Logging⁩

v1.03 installs+3 in 7 days36.3K StarsApache-2.0synced 12 hours ago

Install

No NotHoly CLI yet? Install it first.

$ curl -fsSL https://notholy.com/install.sh | sh
$ notholy skills install mukul975/hunting-for-anomalous-powershell-execution

Writes to ⁦~/.notholy/skills⁩ after checking the signature and the SHA-256.

SignatureSigned, ed25519
wcM7M8t+my…3smyI5AA==The CLI checks the SHA-256 and the signature before it writes a file.
Packagef7b57ee9…9347c8a0
f7b57ee96d70…cb469347c8a04 files · ⁦9.2 KB⁩
ScanMedium8 findings
  • command.pipe_to_shellreferences/api-reference.md:54
  • command.pipe_to_shellreferences/api-reference.md:61
  • command.base64_execreferences/api-reference.md:62
See the full scan
Sourcegithub.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/hunting-for-anomalous-powershell-execution@54a7988

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

json
{
  "total_events": 1247,
  "suspicious_events": 23,
  "amsi_bypass_attempts": 2,
  "encoded_commands": 8,
  "download_cradles": 5,
  "credential_access": 3
}

Files in this version

Permissions

PermissionDeclaredFound by the scan
Reads filesNoNo
Writes filesNoNo
Runs shell commandsYesYes
Uses the networkYesYes
Uses connectorsNoNo
Drives a browserNoNo

Scan findings

Reviewed on Nov 13, 2026

  1. MediumCommand · command.pipe_to_shellreferences/api-reference.md:54
  2. MediumCommand · command.pipe_to_shellreferences/api-reference.md:61
  3. MediumCommand · command.base64_execreferences/api-reference.md:62
  4. MediumFile · Executable script shipped with the skillscripts/agent.py
  5. MediumCommand · command.pipe_to_shellscripts/agent.py:47
  6. MediumCommand · command.pipe_to_shellscripts/agent.py:48
  7. MediumCommand · command.base64_execscripts/agent.py:49
  8. InfoLink · Links to outside domains

A clean scan lowers the risk but does not prove a package is safe. Read what you install.

VersionPublishedCommitSHA-256SignaturePermission change
v1.0Nov 13, 202654a7988f7b57ee9Signed–

Ask anything your scope allows.

Create an account, add credits and ask the first question in the chat or the terminal.

  1. 1/3

    Create the account

    Individual or company. You can switch to a company later without losing balance or keys.

    IndividualCompany
  2. 2/3

    Add credits

    By card. Pay per token, no subscription.

    $5.00minimum deposit
  3. 3/3

    Ask

    In the chat, or install the CLI and run notholy login in your terminal.

    $ notholy login