본문으로 건너뛰기
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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/analyzing-powershell-script-block-logging/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 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

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬