genius-detection-labs/powershell-detection-engineering-lab

GitHub: genius-detection-labs/powershell-detection-engineering-lab

该项目通过模拟多种 PowerShell 攻击技术并利用 Sysmon 日志与 Sigma 规则进行检测,为 SOC 分析师和检测工程师提供实战化的安全检测训练。

Stars: 0 | Forks: 0

# 项目 2 – PowerShell 检测工程实验室 ## 概述 本项目旨在使用 Sysmon Event Logs 和 Sigma rules 检测可疑的 PowerShell 活动。目标是模拟攻击者的技术,调查生成的日志,并创建可供 SOC 分析师和检测工程师使用的检测逻辑。 在整个项目中,通过分析 Sysmon Event ID 1(Process Creation)和 Event ID 3(Network Connection)来识别潜在的恶意 PowerShell 行为。 ## 使用的工具 - Windows 10 - Sysmon - Event Viewer - PowerShell - Sigma - GitHub ## 学习目标 - 了解基于 PowerShell 的攻击技术 - 分析 Sysmon 日志 - 调查 Process Creation 事件 - 调查 Network Connection 事件 - 开发 Sigma 检测规则 - 记录安全调查过程 - 构建 SOC 分析师作品集 ## 活动 1 – 隐藏 PowerShell 检测 ## 目标 检测使用 `-WindowStyle Hidden` 参数启动的 PowerShell。 ## 执行的命令 powershell.exe -WindowStyle Hidden -Command "Get-Date" Sysmon 事件 Event ID: 1 Event Type: Process Creation 检测结果 命令行包含: -WindowStyle Hidden 此参数会对用户隐藏 PowerShell 窗口,通常被恶意软件和恶意脚本使用。 MITRE ATT&CK 战术 (Tactic) 技术 (Technique) Execution T1059.001 – PowerShell Sigma 规则 title: Hidden PowerShell Execution logsource: product: windows category: process_creation detection: selection: Image|endswith: - '\powershell.exe' CommandLine|contains: - '-WindowStyle Hidden' condition: selection level: high ## 活动 2 – PowerShell Web 请求检测 ## 目标 检测从互联网下载内容的 PowerShell。 执行的命令 mkdir C:\LabDownloads Invoke-WebRequest ` -Uri "https://www.example.com" ` -OutFile "C:\LabDownloads\example.html" Sysmon 事件 Event ID 1 Process Creation Event ID 3 Network Connection 检测结果 PowerShell 建立了出站 HTTPS 连接并从互联网下载了内容。 MITRE ATT&CK 战术 (Tactic) 技术 (Technique) Command and Control T1071.001 Execution T1059.001 Sigma 规则 # PowerShell Web Request 活动 logsource: product: windows category: process_creation detection: selection: Image|endswith: - '\powershell.exe' CommandLine|contains: - 'Invoke-WebRequest' condition: selection level: high # 活动 3 – PowerShell 下载活动检测 ## 目标 通过 Sysmon 进程和网络事件调查 PowerShell 的下载行为。 执行的命令 Invoke-WebRequest ` -Uri "https://www.example.com" ` -OutFile "C:\LabDownloads\example2.html" Sysmon 事件 Event ID 1 Process Creation Event ID 3 Network Connection 检测结果 PowerShell 发起了出站 HTTPS 连接,并将下载的文件写入磁盘。 MITRE ATT&CK 战术 (Tactic) 技术 (Technique) Command and Control T1071.001 Execution T1059.001 Sigma 规则 # PowerShell Download 活动 logsource: product: windows category: process_creation detection: selection: Image|endswith: - '\powershell.exe' CommandLine|contains: - 'Invoke-WebRequest' condition: selection level: high # 活动 4 – 编码 PowerShell 检测 ## 目标 检测使用 Base64 编码命令执行的 PowerShell。 执行的命令 $command = "Get-Process" $bytes = [System.Text.Encoding]::Unicode.GetBytes($command) $encoded = [Convert]::ToBase64String($bytes) powershell.exe -EncodedCommand RWBIAH... Sysmon 事件 Event ID: 1 检测结果 PowerShell 启动时使用了: -EncodedCommand 攻击者通常使用 Base64 编码来隐藏恶意命令。 MITRE ATT&CK 战术 (Tactic) 技术 (Technique) Defense Evasion T1027 Execution T1059.001 Sigma 规则 # 编码的 PowerShell Command logsource: product: windows category: process_creation detection: selection: Image|endswith: - '\powershell.exe' CommandLine|contains: - '-EncodedCommand' condition: selection level: high # 活动 5 – PowerShell 执行策略绕过 ## 目标 检测 PowerShell 执行策略绕过活动。 执行的命令 Get-ExecutionPolicy powershell.exe -ExecutionPolicy Bypass -Command Get-Process Sysmon 事件 Event ID: 1 检测结果 PowerShell 启动时使用了: -ExecutionPolicy Bypass 此参数允许脚本无视本地策略限制执行,经常被攻击者滥用。 MITRE ATT&CK 战术 (Tactic) 技术 (Technique) Execution T1059.001 Sigma 规则 # PowerShell Execution Policy Bypass logsource: product: windows category: process_creation detection: selection: Image|endswith: - '\powershell.exe' CommandLine|contains: - '-ExecutionPolicy Bypass' condition: selection level: high 学到的关键检测技术 隐藏 PowerShell 执行 PowerShell Web 请求 通过 PowerShell 下载文件 编码 PowerShell 命令 执行策略绕过检测 Sysmon Event ID 1 分析 Sysmon Event ID 3 分析 Sigma 规则开发 MITRE ATT&CK 覆盖范围 技术 ID 技术 T1059.001 PowerShell T1027 混淆/编码的文件和信息 T1071.001 Web Protocols 项目成果 该项目提供了使用 Sysmon 和 Sigma 检测基于 PowerShell 的攻击技术的实践经验。多种攻击者行为被模拟、调查、记录,并转化为适用于 SOC 和检测工程环境的可重用检测规则。 ## MITRE ATT&CK 覆盖范围 - T1059.001 – PowerShell - T1027 – 混淆/编码的文件 - T1071.001 – Web Protocols
标签:AI合规, Conpot, OpenCanary, Windows安全, 安全运营, 扫描框架, 网络信息收集