ChidoEfobi/Azure-Threat-Detection-Lab
GitHub: ChidoEfobi/Azure-Threat-Detection-Lab
基于Azure和Microsoft Sentinel的云威胁检测工程实验环境,完整演示从攻击模拟到KQL检测规则开发的检测工程生命周期。
Stars: 0 | Forks: 0
# Azure 威胁检测实验环境

## 概述
本项目演示了使用 Microsoft Sentinel 和 Azure Log Analytics 的**云威胁检测工程工作流**。
本项目的目标是在 Windows 虚拟机上模拟攻击者行为,并开发能够使用 **Kusto Query Language (KQL)** 识别恶意活动的检测逻辑。
遥测数据通过 **Windows Security Events** 收集,并通过 **Azure Monitor Agent (AMA)** 转发到 Azure。随后在 **Microsoft Sentinel** 中分析这些事件,构建并验证映射到 **MITRE ATT&CK 技术** 的威胁检测。
本项目展示了一个典型的**检测工程生命周期**:
1. 模拟攻击者行为
2. 收集安全遥测数据
3. 开发检测逻辑
4. 验证检测查询
5. 将检测转换为 Sentinel 分析规则
# 实验架构
实验环境由一台生成安全遥测数据的 Azure Windows 虚拟机组成,该数据通过 Microsoft Sentinel 进行收集和分析。
## 遥测数据流:
互联网流量
↓
Azure Windows 虚拟机
↓
Windows 安全事件日志
↓
Azure Monitor Agent (AMA)
↓
Log Analytics Workspace
↓
Microsoft Sentinel
↓
威胁检测查询
# 检测工程方法论
本项目中的每个检测都遵循检测工程师使用的结构化工作流:
威胁场景 —— 正在被模拟的对手技术
遥测来源 —— 用于检测的 Windows 事件日志
检测逻辑 —— 用于识别可疑行为的 KQL 查询
验证 —— 用于生成遥测数据的攻击模拟
检测输出 —— 检测有效的证据
## 检测 1 —— 暴力破解登录检测
**`MITRE ATT&CK:`** T1110 – Brute Force (暴力破解)
**`威胁场景:`** 攻击者经常通过对用户账户进行重复的身份验证尝试来获取系统访问权限。
**`遥测来源:`** Windows Security Event Log
**`Event ID:`** 4625 – 登录尝试失败
### 检测逻辑
```
SecurityEvent
| where EventID == 4625
| summarize FailedAttempts=count() by Account, Computer, bin(TimeGenerated, 5m)
| where FailedAttempts > 5
| sort by FailedAttempts desc
```
### 检测输出

## 检测 2 —— 编码 PowerShell 执行
**`MITRE ATT&CK:`** T1059 – Command and Scripting Interpreter (PowerShell) (命令和脚本解释器)
**`威胁场景:`** 攻击者经常使用编码命令执行 PowerShell,以混淆恶意脚本并逃避检测。
**`遥测来源:`**: Windows Security Event Log
**`Event ID:`** 4688 – 进程创建
### 检测逻辑
```
SecurityEvent
| where EventID == 4688
| where Process has "powershell"
| where CommandLine contains "-EncodedCommand"
| project TimeGenerated, Computer, Account, Process, CommandLine
```
### 检测输出

## 检测 3 —— 可疑父进程执行
**`MITRE ATT&CK:`** T1059 – Command Execution (命令执行)
**`威胁场景:`** 攻击者可能从异常的父进程(如 cmd.exe 或 wmic.exe)生成 PowerShell 以执行恶意命令。
**`遥测来源:`** Windows Security Event Log
**`Event ID:`** 4688 – 进程创建
### 检测逻辑
```
SecurityEvent
| where EventID == 4688
| where Process has "powershell"
| where ParentProcessName !contains "explorer.exe"
| project TimeGenerated, Computer, Process, ParentProcessName, Account
```
### 检测输出

## 检测 4 —— 网络信标活动
**`MITRE ATT&CK:`** T1071 – Application Layer Protocol (应用层协议)
**`威胁场景:`** 恶意软件通常使用频繁的出站连接与命令控制 (C2) 服务器通信。
**`遥测来源:`** Sysmon Network Connection Logs
**`Event ID:`** 3 – 网络连接
### 检测逻辑
```
Event
| where Source == "Microsoft-Windows-Sysmon"
| where EventID == 3
| summarize Connections=count() by Computer, bin(TimeGenerated, 1m)
| where Connections > 20
```
### 检测输出

## 检测 5 —— 特权登录活动
**`MITRE ATT&CK:`** T1078 – Valid Accounts (有效账户)
**`威胁场景:`** 攻击者可能利用特权账户提升权限或执行管理操作。
**`遥测来源:`** Windows Security Event Log
**`Event ID:`** 4672 – 分配给新登录的特殊权限
### 检测逻辑
```
SecurityEvent
| where EventID == 4672
| project TimeGenerated, Account, Computer
| sort by TimeGenerated desc
```
### 检测输出

## 检测 6 —— 计划任务持久化
**`MITRE ATT&CK:`** T1053 – Scheduled Task / Job (计划任务/作业)
**`威胁场景:`** 攻击者创建计划任务以在被攻陷的系统内维持持久性。
**`遥测来源:`** Windows Security Event Log
**`Event ID:`** 4698 – 已创建计划任务
### 检测逻辑
```
SecurityEvent
| where EventID == 4698
| project TimeGenerated, Computer, Activity
Detection Output
```
### 检测输出

## 检测 7 —— 可疑服务创建
**`MITRE ATT&CK:`** T1543 – Create or Modify System Process (创建或修改系统进程)
**`威胁场景:`** 攻击者可能安装恶意服务以执行恶意软件或维持持久性。
**`遥测来源:`** Windows Security Event Log
**`Event ID:`** 4697 – 已安装服务
### 检测逻辑
```
SecurityEvent
| where EventID == 4697
| project TimeGenerated, Account, Computer, Activity
```

## 检测 8 —— 远程桌面登录检测
**`MITRE ATT&CK:`** T1021 – Remote Services (远程服务)
**`威胁场景:`** 攻击者经常使用远程桌面协议 (RDP) 进行远程访问和横向移动。
**`遥测来源:`** Windows Security Event Log
**`Event ID:`** 4624 – 登录成功
**`LogonType:`** 10
### 检测逻辑
```
SecurityEvent
| where EventID == 4624
| where LogonType == 10
| project TimeGenerated, Account, Computer, IpAddress
| sort by TimeGenerated desc
```
### 检测输出

# Microsoft Sentinel 分析规则
检测查询被转换为 Sentinel 分析规则以自动生成警报。

# Sentinel 事件调查
当检测触发时,Microsoft Sentinel 会生成安全事件以供调查。

# 展示技能
- 威胁检测工程
- Microsoft Sentinel SIEM
- Kusto Query Language (KQL)
- MITRE ATT&CK 映射
- Windows 安全日志分析
- 云安全监控
- 攻击模拟与检测验证
# 关键要点
本项目演示了检测工程师如何使用 Microsoft Sentinel 将原始遥测数据转化为可操作的威胁检测。
本实验中开发的检测模拟了真实的攻击者行为,并展示了安全团队如何通过结构化的日志分析和检测工程实践识别恶意活动。
标签:AMA, AMSI绕过, Azure, Azure Monitor Agent, Cloudflare, KQL, Microsoft Sentinel, MITRE ATT&CK, PE 加载器, PoC, PowerShell 滥用, RDP 活动, Windows 安全事件, 嗅探欺骗, 威胁检测, 安全实验室, 攻击模拟, 暴力破解, 服务创建, 权限维持, 特权登录, 网络安全实验, 驱动签名利用