hunting-for-anomalous-powershell-execution
它能做什么
这个工具可以在你的 Windows 事件日志中搜索恶意的 PowerShell 活动。它会分析被执行的脚本,找出试图伪装命令、绕过安全防护(AMSI)、下载可疑代码或窃取凭据的行为。
适用场景
- ✓调查一起与 PowerShell 有关的安全事件时。
- ✓编写用于检测可疑 PowerShell 活动的规则时。
- ✓检查你的监控系统能否发现常见的 PowerShell 攻击时。
技能链接
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/hunting-for-anomalous-powershell-execution/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“在我的事件日志中搜索可疑的 PowerShell 活动。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具会读取 Windows 事件日志文件(.evtx),这些文件记录了 PowerShell 执行过的内容。它会查找已知的攻击模式,比如经过编码的命令,或者试图绕过安全防护的操作。
技术内容(原始 SKILL.md)
作者在 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
- Parse EVTX files extracting Event 4104 script block text and metadata
- Reassemble multi-part script blocks using ScriptBlock ID correlation
- Scan script text for AMSI bypass indicators and obfuscation patterns
- Detect encoded command execution and base64 payloads
- Identify download cradles, credential dumping, and lateral movement commands
- 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
}
常见问题
什么是“脚本块日志记录”(Script Block Logging)?
这是一种详细的日志,能准确显示 PowerShell 执行了哪些命令和脚本,即使攻击者试图隐藏它们。
什么是 AMSI?
AMSI(Antimalware Scan Interface)是 Windows 的一个安全层,用来帮助检测和拦截恶意软件。该工具会查找试图禁用或欺骗 AMSI 的行为。
什么是“下载 cradle”(download cradles)?
这是一些代码片段,用于直接从互联网下载并执行其他恶意程序,而不需要把文件保存到磁盘上。
详情
作者的原始描述
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
热度
- GitHub 星标
- 35k
- 排名
- #7948
- 许可证
- Apache-2.0
- 更新时间
- 2026/8/31
评论
- …
同一仓库的更多技能
abusing-dpapi-for-credential-access
35k为你的 AI 智能体提供针对特定任务的现成指令,让它完成得更好、更快。
abusing-shadow-credentials-for-privesc
35k教你的 AI 智能体写出清晰、结构良好的文本。
achieving-cmmc-level-2-compliance
35k帮助你的智能体搭建符合 CMMC Level 2 合规要求的环境。它会落实安全要求,并管理必要的文档。
acquiring-disk-image-with-dd-and-dcfldd
35k帮助你的智能体创建硬盘的精确副本。这能确保调查过程中信息不丢失、不被篡改。