maamooon/sentinel-threat-hunting-lab

GitHub: maamooon/sentinel-threat-hunting-lab

一个完整的 Microsoft Sentinel 蓝队威胁狩猎实验室,涵盖攻击模拟、KQL 检测工程与 SOC 文档,展示云 SIEM 环境下的端到端入侵检测能力。

Stars: 0 | Forks: 0

# 🛡️ Microsoft Sentinel 威胁狩猎实验室 **端到端云 SIEM 实验室 — 攻击模拟、KQL 检测工程与 SOC 文档** [![Azure](https://img.shields.io/badge/Azure-Cloud-0078D4?style=flat-square&logo=microsoftazure)](https://azure.microsoft.com) [![Sentinel](https://img.shields.io/badge/Microsoft_Sentinel-SIEM-0078D4?style=flat-square&logo=microsoft)](https://azure.microsoft.com/en-us/products/microsoft-sentinel) [![KQL](https://img.shields.io/badge/KQL-Detection_Engineering-F5A623?style=flat-square)](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/) [![MITRE](https://img.shields.io/badge/MITRE_ATT%26CK-Mapped-FF6B6B?style=flat-square)](https://attack.mitre.org) [![Platform](https://img.shields.io/badge/Platform-Windows_10-00C9A7?style=flat-square&logo=windows)](https://www.microsoft.com/en-us/windows)
## 📌 概述 本项目展示了一个完整的**蓝队杀伤链** — 从云基础设施部署到实时攻击模拟,再到基于 KQL 的检测和 SOC 文档。我们在 Azure 中部署了一台故意留下漏洞的 Windows 10 VM,从 Kali Linux 节点对其发起攻击,并使用 Microsoft Sentinel 检测到了入侵的每一个阶段。 ## 🏗️ 实验室架构 | 组件 | 详情 | | ------------------ | ---------------------------------------------------------- | | **攻击者** | Kali Linux — Nmap, Metasploit, Evil-WinRM v3.9 | | **受害者 VM** | Windows 10 Azure VM — `victim-win10` (`172.210.65.72`) | | **SIEM** | Microsoft Sentinel — `law-soc-sentinel` (East US) | | **日志管道** | Azure Monitor Agent → Data Collection Rule → Log Analytics | | **资源组** | `rg-soc-sentinel-lab` | ## ⚔️ 攻击杀伤链 ### 阶段 1 — 侦察 `T1046` `T1595` - 针对受害者 VM 进行 Nmap 主机发现和全端口扫描 - 确认 WinRM 端口 `5985` 处于开放状态 → 选为主要利用途径 ### 阶段 2 — 初始访问 `T1110.001` `T1078` - 使用 Metasploit `winrm_login` 模块进行凭据暴力破解 - 在发现 `Admin:Admin123` 之前,出现了 50 多次失败的登录尝试 (EID `4625`) - 使用 Evil-WinRM v3.9 建立完整的 PowerShell shell ### 阶段 3 — 持久化 `T1547.001` `T1053.005` `T1136.001` `T1098` ``` # Registry Run Key reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Run" /v WindowsUpdate /t REG_SZ /d "cmd.exe" /f # 计划任务(登录时以 SYSTEM 身份运行) schtasks /create /tn "SystemCheck" /tr "powershell.exe -WindowStyle Hidden" /sc onlogon /ru system /f # 后门本地账户 net user backdoor B@ckd00r123!! /add net localgroup administrators backdoor /add ``` ### 阶段 4 — 防御规避 `T1070.001` ``` # 清除 Windows 安全日志 — 生成 EID 1102(已在 Sentinel 中) wevtutil cl Security wevtutil cl System ``` ## 🔍 KQL 狩猎活动 ### 活动 1 — 暴力破解与凭据访问 ``` // Kill Shot: Brute Force → Successful Logon Chain let BruteForce = SecurityEvent | where TimeGenerated > ago(2h) | where Computer == "victim-win10" | where EventID == 4625 | summarize FailCount = count() by IpAddress, TargetUserName | where FailCount > 3; SecurityEvent | where TimeGenerated > ago(2h) | where Computer == "victim-win10" | where EventID == 4624 | where LogonType in (3, 10) | where IpAddress != "-" | join kind=inner BruteForce on $left.IpAddress == $right.IpAddress, $left.TargetUserName == $right.TargetUserName | project TimeGenerated, Account = TargetUserName, SourceIP = IpAddress, FailCountBeforeSuccess = FailCount ``` ### 活动 2 — 远程会话活动 - EID `4624` (LogonType 3, NTLM) + EID `4672` (SeDebugPrivilege / SeImpersonatePrivilege) - 确认 Evil-WinRM 攻击者级别的会话 ### 活动 3 — 持久化检测 ``` // Backdoor Chain: New Account → Added to Administrators (SID-joined) let NewAccounts = SecurityEvent | where EventID == 4720 | project AccountCreatedTime = TimeGenerated, NewAccount = TargetUserName, NewAccountSid = TargetSid, CreatedBy = SubjectUserName, Computer; SecurityEvent | where EventID == 4732 | where TargetUserName == "Administrators" | join kind=inner NewAccounts on $left.MemberSid == $right.NewAccountSid | extend MinutesBetween = datetime_diff('minute', AddedToAdminTime, AccountCreatedTime) ``` ### 活动 4 — 日志清除(防御规避) - 在本地日志被擦除**之后**,Sentinel 检测到了 EID `1102` - 证明云 SIEM 遥测数据在攻击者清除日志后依然得以留存 ### 活动 5 — 横向移动指标 - EID `4648` 显式凭据登录事件 - 与暴力破解源 IP 相关联,以获取完整的会话时间线 ## 🛠️ 修复矩阵 | 技术 | 修复措施 | 优先级 | | -------------------------- | ------------------------------------------------------- | ------------ | | T1110 暴力破解 | 账户锁定(5 次尝试 / 15 分钟),MFA | **关键** | | T1021.006 WinRM | 通过 NSG 限制仅允许管理 IP 访问 | **关键** | | T1078 弱凭据 | 至少 16 个字符,本地管理员使用 LAPS | **关键** | | T1547.001 注册表自启动项 | Sysmon EID 13 告警,AppLocker | 高 | | T1053.005 计划任务 | 针对 EID 4698 告警,限制为仅限管理员 | 高 | | T1136.001 账户创建 | 针对 EID 4720 告警,每月审计 | 高 | | T1070.001 日志清除 | 实时 AMA 转发(已完成),EID 1102 告警 | 高 | ## 🧠 展示技能 | 领域 | 详情 | | ------------------------ | --------------------------------------------------------------- | | **云基础设施** | Azure VM, NSG, Log Analytics Workspace, 通过 CLI 配置 AMA | | **SIEM 工程** | Sentinel 部署,DCR 配置,分析规则 | | **KQL** | Joins, aggregations, time intelligence, multi-stage correlation | | **威胁检测** | 假设驱动的狩猎,MITRE ATT&CK 映射 | | **进攻安全** | Nmap, Metasploit, Evil-WinRM, 持久化模拟 | | **文档编写** | 专业的 SOC 报告,检测方法论述 | ## 👤 作者 **Mamoon Ahmad** [GitHub](https://github.com/maamooon) · [LinkedIn](https://linkedin.com/in/maamooon) · mamoonahmad.dev@gmail.com
标签:KQL, 安全运营, 密码管理, 微软Sentinel, 扫描框架, 插件系统, 攻击模拟, 红队行动, 驱动签名利用