s225645819/Azure-Sentinel-Detection-Lab
GitHub: s225645819/Azure-Sentinel-Detection-Lab
Azure Sentinel KQL检测实验室,用于构建和测试针对MITRE ATT&CK框架的检测规则。
Stars: 0 | Forks: 0
# Azure Sentinel 云 SIEM 实验室:攻击模拟与检测工程
## 目标
本项目的目标是构建一个完全功能的基于云的安全信息与事件管理(SIEM)系统,使用 Microsoft Sentinel,配置自定义日志摄取管道,并构建 KQL(Kusto 查询语言)检测以识别映射到 MITRE ATT&CK 框架的模拟网络攻击。
## 使用的技术与工具
* **云提供商:** Microsoft Azure(日志分析工作区、Microsoft Sentinel、虚拟机)
* **端点安全:** Sysmon(系统监控)
* **日志摄取:** Azure Monitor Agent(AMA)、数据收集规则(DCR)
* **攻击框架:** Atomic Red Team
* **查询语言:** KQL(Kusto 查询语言)
## 架构与配置
1. 在 Azure 中部署了 Windows Server 虚拟机作为目标端点。
2. 在端点上安装了 Sysmon,并使用自定义 SwiftOnSecurity 配置文件来捕获细粒度的进程和网络遥测数据。
3. 配置 Azure 数据收集规则(DCR),将本机 Windows 安全事件和自定义 Sysmon `Operational` 日志通过 Azure Monitor Agent 路由到 Sentinel。
4. 暂时禁用了 Windows Defender 以允许恶意软件执行,然后使用 Atomic Red Team 模拟攻击者的技术。
## MITRE ATT&CK 覆盖范围
| 技术ID | 技术名称 | 检测 |
|---|---|---|
| T1059.001 | 命令和脚本解释器:PowerShell | 检测 1 |
| T1136.001 | 创建账户:本地账户 | 检测 2 |
| T1047 | Windows 管理规范 | 检测 3 |
| T1041 | 通过 C2 通道的数据外泄 | 检测 4 |
| T1110 | 爆破 | 检测 5 |
## 如何重现
1. 在 Azure 中部署 Windows Server 2019 VM
2. 使用 SwiftOnSecurity 配置安装 Sysmon
3. 配置 Azure Monitor Agent(AMA)和数据收集规则(DCR)
4. 将日志连接到日志分析工作区与 Microsoft Sentinel
5. 运行 Atomic Red Team 测试:`Invoke-AtomicTest T1059.001 -TestNumbers 1`
6. 将 KQL 查询粘贴到 Sentinel 的日志标签页
7. 截图显示检测已触发
## 检测工程与威胁狩猎
### 1. PowerShell 伪装与执行(T1059.001)
**场景:** 攻击者经常使用 Base64 编码或执行绕过标志来隐藏恶意 PowerShell 命令,以避免防御者检测。
**KQL 查询:**
```
| where Provider == "Microsoft-Windows-Sysmon" and EventID == 1
| extend CommandLine = tostring(EventData.CommandLine),
Image = tostring(EventData.Image),
User = tostring(EventData.User)
| where Image has "powershell.exe"
| where CommandLine contains "-enc" or CommandLine contains "-nop" or CommandLine contains "mimikatz"
| project TimeGenerated, Computer, User, Image, CommandLine
```
![PowerShell 伪装]()
### 2. 创建本地账户以实现持久性(T1136.001)
**场景:** 攻击者创建本地后门账户以保持对受损害主机的访问。由于禁用了本机事件 ID 4720 日志记录,检测转向 Sysmon 进程创建。
**KQL 查询:**
```
WindowsEvent
| where Provider == "Microsoft-Windows-Sysmon" and EventID == 1
| extend CommandLine = tostring(EventData.CommandLine),
User = tostring(EventData.User),
Image = tostring(EventData.Image)
| where (Image has "net.exe" or Image has "net1.exe") and CommandLine contains "user" and CommandLine contains "/add"
| project TimeGenerated, Computer, User, Image, CommandLine
| sort by TimeGenerated desc
```
![本地账户创建]()
### 3. WMI 探测与横向移动(T1047)
**场景:** Windows 管理规范(WMI)被滥用以收集系统数据或远程执行有效负载。
**KQL 查询:**
```
WindowsEvent
| where Provider == "Microsoft-Windows-Sysmon" and EventID == 1
| where EventData has "wmic.exe"
| where EventData has "useraccount"
| project TimeGenerated, Computer, EventData
| sort by TimeGenerated desc
```
![WMI 探测]()
### 4. 通过 C2 通道的数据外泄(T1041)
**场景:** 恶意软件利用本机脚本解释器(如 PowerShell)打开到外部命令和控制(C2)服务器的出站网络连接。
**KQL 查询:**
```
WindowsEvent
| where Provider == "Microsoft-Windows-Sysmon" and EventID == 3
| where EventData has "powershell.exe"
| project TimeGenerated, Computer, EventData
| sort by TimeGenerated desc
```
![C2 外泄]()
### 5. RDP 爆破攻击(T1110)
**场景:** 活跃的威胁行为者利用自动化的僵尸网络在面向互联网的 RDP 端口上爆破凭证访问。
**KQL 查询:**
```
SecurityEvent
| where EventID == 4625
| where LogonType == 2 or LogonType == 3
| project TimeGenerated, TargetAccount, IpAddress, Computer
| summarize FailureCount=count() by TargetAccount, IpAddress, bin(TimeGenerated, 5m)
| where FailureCount >= 5
| sort by TimeGenerated desc
```
![RDP 爆破]()
## 展示的技能
- 云 SIEM 配置(Microsoft Sentinel、日志分析)
- KQL 查询编写和威胁狩猎
- 端点遥测收集(Sysmon、事件日志)
- 使用 Atomic Red Team 进行攻击模拟
- MITRE ATT&CK 映射和威胁建模
- 自定义检测规则工程
- Azure 云基础设施(VM、网络、IAM)
标签:Atomic Red Team, Azure Sentinel, Cloudflare, Kusto Query Language, MITRE ATT&CK, OpenCanary, PB级数据处理, Sysmon, URL发现, Windows Management Instrumentation, XML 请求, 安全信息与事件管理, 安全开发, 安全检测, 安全测试, 安全运维, 搜索引擎爬取, 攻击性安全, 攻击模拟, 数据泄露检测, 驱动签名利用