本文へスキップ
Skillpedia
分析とスプレッドシート35k · #7646

analyzing-powershell-script-block-logging

できること

このツールは、PowerShellのログを分析して、怪しい、または偽装されたコマンドを見つけ出します。Windowsで悪意のあるコードを実行するために、ハッカーが使う手口を探します。

使う場面

  • ✓セキュリティインシデントを調査しているとき。
  • ✓危険な活動を検知するためのアラートを作成しているとき。
  • ✓既知の攻撃をセキュリティ対策が捉えられているかを確認したいとき。

スキルのリンク

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-powershell-script-block-logging/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-powershell-script-block-logging/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“このPowerShellのログファイルを分析して、怪しい点がないか教えてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

ツールはPowerShellのログを読み込み、分割されていたスクリプトの断片をつなぎ合わせ、エンコードされたコマンドやセキュリティを無効化する試みなど、一般的な攻撃パターンを探します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Analyzing PowerShell Script Block Logging

When to Use

  • When investigating security incidents that require analyzing powershell script block logging
  • 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

  • Familiarity with security operations concepts and tools
  • Access to a test or lab environment for safe execution
  • Python 3.8+ with required dependencies installed
  • Appropriate authorization for any testing activities

Instructions

  1. Install dependencies: pip install python-evtx lxml
  2. Collect PowerShell Operational logs: Microsoft-Windows-PowerShell%4Operational.evtx
  3. Parse Event ID 4104 entries using python-evtx to extract ScriptBlockText, ScriptBlockId, and MessageNumber/MessageTotal for multi-part script reconstruction.
  4. Apply detection heuristics:
    • Base64-encoded commands (-EncodedCommand, FromBase64String)
    • Download cradles (DownloadString, DownloadFile, Invoke-WebRequest, Net.WebClient)
    • AMSI bypass patterns (AmsiUtils, amsiInitFailed)
    • Obfuscation indicators (high entropy, tick-mark insertion, string concatenation)
  5. Generate a report with reconstructed scripts, risk scores, and MITRE ATT&CK mappings.
python scripts/agent.py --evtx-file /path/to/PowerShell-Operational.evtx --output ps_analysis.json

Examples

Detect Encoded Command Execution

import base64
if "-encodedcommand" in script_text.lower():
    encoded = script_text.split()[-1]
    decoded = base64.b64decode(encoded).decode("utf-16-le")

Reconstruct Multi-Block Script

Scripts split across multiple 4104 events share a ScriptBlockId. Concatenate blocks ordered by MessageNumber to recover the full script.

よくある質問

「スクリプトブロックログ」とは何ですか?

PowerShellがコマンドを実行したときに、Windowsが作成する詳細な記録です。何が実行されたのかを把握するのに役立ちます。

「Living off the Land」の手法とは何ですか?

攻撃者が、PowerShellなどの正規のWindowsツールを悪用して、追加の悪意のあるソフトウェアを入れずに攻撃を行う手法のことです。

この文脈での「エントロピー」とは何ですか?

文字列がどれだけランダムで「ばらばら」に見えるかを示す指標です。エントロピーが高いテキストは、コマンドが本来の目的を隠すために符号化されている可能性を示します。

詳細

作者による元の説明

Parse Windows PowerShell Script Block Logs (Event ID 4104) from EVTX files to detect obfuscated commands, encoded payloads, and living-off-the-land techniques. Uses python-evtx to extract and reconstruct multi-block scripts, applies entropy analysis and pattern matching for Base64-encoded commands, Invoke-Expression abuse, download cradles, and AMSI bypass attempts.

repo: mukul975/Anthropic-Cybersecurity-Skills

人気

GitHubのスター
35k
ランキング
#7646
ライセンス
Apache-2.0
更新日
2026/8/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル