Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính35k · #7646

analyzing-powershell-script-block-logging

Skill này làm gì

Công cụ này phân tích nhật ký PowerShell để tìm các lệnh đáng ngờ hoặc được ngụy trang. Nó tìm các kỹ thuật mà hacker dùng để chạy mã độc trên Windows.

Khi nào nên dùng

  • ✓Khi điều tra một sự cố bảo mật.
  • ✓Khi xây dựng cảnh báo để phát hiện hoạt động nguy hiểm.
  • ✓Khi kiểm tra xem hệ thống bảo mật có ghi nhận các cuộc tấn công đã biết hay không.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-powershell-script-block-logging/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Phân tích file nhật ký PowerShell này và cho tôi biết có điều gì đáng ngờ không.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ đọc nhật ký PowerShell, ghép lại các phần của script đã bị tách ra, và tìm các mẫu tấn công phổ biến như lệnh được mã hóa hoặc nỗ lực tắt bảo mật.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.

Câu hỏi thường gặp

“Script Block Logs” là gì?

Đây là các bản ghi chi tiết mà Windows tạo ra khi PowerShell chạy lệnh, giúp hiểu được những gì đã được thực thi.

“Living-off-the-land” là gì?

Đây là các phương pháp kẻ tấn công dùng để lợi dụng các công cụ hợp pháp của Windows, như PowerShell, để thực hiện tấn công mà không cần cài thêm phần mềm độc hại.

“Entropy” trong ngữ cảnh này là gì?

Đây là thước đo mức độ ngẫu nhiên hoặc “xáo trộn” của một đoạn văn bản. Văn bản có entropy cao có thể cho thấy lệnh đã được mã hóa để che giấu mục đích thật.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
35k
Vị trí xếp hạng
#7646
Giấy phép
Apache-2.0
Cập nhật
31/8/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự