一个基于 Microsoft Azure 和 Sentinel 的动手实验室项目,通过部署蜜罐虚拟机、收集 Windows 安全事件并利用 KQL 进行分析,演示云端 SOC 威胁检测与攻击可视化的完整工作流。
# Azure 安全运营与威胁检测实验室
## 概述
本项目演示了使用 Microsoft Azure 和 Microsoft Sentinel 的基本基于云端的安全运营工作流。
我通过在 Azure 中部署一台 Windows 10 虚拟机,并故意将其暴露在互联网上以进行安全监控实践,从而构建了一个受控的蜜罐环境。从该虚拟机收集身份验证失败事件,将其转发到 Log Analytics Workspace 中,使用 KQL 进行分析,通过地理 IP 数据进行丰富,并使用自定义攻击地图工作簿在 Microsoft Sentinel 中进行可视化展示。
本实验室的目的是练习核心 SOC 分析师技能,包括日志收集、SIEM 配置、失败登录调查、IP 丰富、检测逻辑和安全事件可视化。
## 作品集背景
本项目通过提供日志收集、Microsoft Sentinel 配置、基于 KQL 的调查以及身份验证失败分析的实践证据,支持我的 SOC 分析师技术评估作品集。
本实验室的调查结果可作为 SIEM 警报分诊、Event ID 4625 调查、MITRE ATT&CK 映射和 SOC 报告的实用案例研究。
## 项目目标
- 在 Microsoft Azure 中部署 Windows VM 蜜罐
- 使用 Log Analytics Workspace 配置 Microsoft Sentinel
- 使用 Azure Monitor Agent 收集 Windows 安全事件
- 使用 Event ID 4625 调查失败登录尝试
- 使用 Kusto Query Language 查询安全日志
- 使用 Sentinel watchlist 通过地理数据丰富源 IP 地址
- 构建 Microsoft Sentinel 工作簿以可视化攻击源
- 练习基本的 SOC 调查和云威胁检测工作流
## 使用的工具与技术
- Microsoft Azure
- Microsoft Sentinel
- Log Analytics Workspace
- Azure Monitor Agent
- Data Collection Rules
- Windows Security Events
- Kusto Query Language
- Sentinel Watchlists
- Sentinel Workbooks
- Remote Desktop Protocol
- Windows 10 VM
## 展现的技能
- 云安全监控
- SIEM 配置
- Windows 事件日志分析
- 身份验证失败调查
- KQL 查询
- 剧透丰富
- 攻击可视化
- 基础检测工程
- SOC 工作流文档记录
## 架构
```
flowchart LR
A[Internet Authentication Attempts] --> B[Azure Windows VM Honeypot]
B --> C[Windows Security Event Logs]
C --> D[Azure Monitor Agent]
D --> E[Data Collection Rule]
E --> F[Log Analytics Workspace]
F --> G[Microsoft Sentinel]
G --> H[KQL Investigation]
G --> I[GeoIP Watchlist Enrichment]
I --> J[Sentinel Attack Map Workbook]
```
## 检测重点
本实验室侧重于识别针对暴露在互联网上的 Windows VM 的身份验证失败活动。
### 主要事件 ID
| 事件 ID | 描述 |
|---|---|
| 4625 | Windows 登录失败尝试 |
### MITRE ATT&CK 映射
| 技术 | 描述 |
|---|---|
| T1110 | 暴力破解 |
| T1021.001 | 远程服务:远程桌面协议 |
| T1078 | 有效账户(如果有效凭据被成功使用) |
## 实验指南
## 步骤 1:设置 Azure 订阅
我创建了一个 Azure 订阅并访问了 Azure Portal 以开始构建实验室环境。
Azure 注册页面:
https://azure.microsoft.com/en-us/pricing/purchase-options/azure-account
Azure Portal:
https://portal.azure.com
Azure sign-up page:
## 步骤 2:创建 Azure 蜜罐 VM
我创建了一个 Resource Group、Virtual Network 和 Windows 10 虚拟机,作为蜜罐端点。
### Resource Group 创建
Create Resource Group:
Choose subscription, resource group name, and region:
### Virtual Network 创建
Search for Virtual Network:
Create Virtual Network:
Configure subscription, resource group, name, and region:
### 虚拟机创建
Search for Virtual Machines:
Create Azure Virtual Machine:
Configure subscription, resource group, VM name, and region:
Select Windows 10 Pro image and VM size:
Create local administrator credentials:
Confirm licensing and proceed to disk configuration:
Configure OS disk settings:
Attach the VM to the virtual network:
Enable deletion of public IP and NIC when the VM is deleted:
Review and create the VM:
## 步骤 3:配置蜜罐暴露
为了生成用于分析的安全事件,我修改了 Network Security Group 以允许入站流量,然后在 VM 内部禁用了 Windows 防火墙。
### Network Security Group 配置
Open the Network Security Group from the Resource Group:
Remove the default inbound rule blocking traffic:
Create a new inbound security rule:
Allow inbound traffic for lab testing:
Set rule priority and name:
### 远程桌面访问
Copy the VM public IP address:
Connect using Remote Desktop:
Enter the VM username and password:
### Windows 防火墙配置
在 VM 内部,我打开了 `wf.msc` 并为域、专用和公用配置文件禁用了 Windows Defender 防火墙。
Open Windows Defender Firewall settings:
Test connectivity to the VM using ping:
## 步骤 4:生成并检查登录失败事件
为了创建测试安全事件,我使用无效用户名对虚拟机进行了几次失败的登录尝试。
重新登录虚拟机后,我打开了事件查看器并查看了 Windows 安全日志。
失败的登录尝试显示为:
```
Event ID: 4625
Description: An account failed to log on
```
Failed login event evidence in Event Viewer:
这证实了虚拟机在将身份验证日志转发到 Microsoft Sentinel 之前正在生成有用的日志。
## 步骤 5:配置 Log Analytics Workspace 和 Microsoft Sentinel
接下来,我创建了一个 Log Analytics Workspace 作为中央日志存储库,然后在工作区之上启用了 Microsoft Sentinel。
### Log Analytics Workspace
Search for Log Analytics Workspaces:
Create Log Analytics Workspace:
Configure subscription, resource group, workspace name, and region:
### Microsoft Sentinel 设置
Search for Microsoft Sentinel and create a Sentinel instance:
Select the Log Analytics Workspace and add Sentinel:
## 步骤 6:配置 Windows 安全事件收集
我在 Microsoft Sentinel 中配置了 **Windows Security Events via AMA** 连接器。
这创建了一个 Data Collection Rule,用于从虚拟机收集 Windows 安全事件并将它们转发到 Log Analytics Workspace。
Open Content Hub and select Windows Security Events:
Open Windows Security Events via AMA connector:
Create Data Collection Rule:
Collect all Security Events:
Verify extension installation on the VM:
## 步骤 7:使用 KQL 查询安全事件
收集日志后,我使用 KQL 查询了 Log Analytics Workspace。
### 基本登录失败查询
```
SecurityEvent
| where EventID == 4625
```
### 调查查询
```
SecurityEvent
| where EventID == 4625
| project TimeGenerated, Account, Computer, IpAddress, Activity, LogonTypeName
| order by TimeGenerated desc
```
### 按源 IP 分类的登录失败
```
SecurityEvent
| where EventID == 4625
| where isnotempty(IpAddress)
| summarize FailedLogonAttempts = count() by IpAddress
| order by FailedLogonAttempts desc
```
### 按账户和源 IP 分类的登录失败
```
SecurityEvent
| where EventID == 4625
| summarize FailedAttempts = count() by Account, IpAddress
| order by FailedAttempts desc
```
### 登录失败时间轴
```
SecurityEvent
| where EventID == 4625
| summarize FailedAttempts = count() by bin(TimeGenerated, 1h)
| order by TimeGenerated asc
```
这些查询有助于识别失败登录模式、目标账户、源 IP 地址以及随时间变化身份验证活动。
## 步骤 8:使用地理数据丰富日志
原始的 Windows 安全事件包含源 IP 地址,但不包括地理位置数据。
为了丰富日志,我将 GeoIP 数据集作为 Microsoft Sentinel Watchlist 导入。
实验中使用的 GeoIP 数据集:
https://drive.google.com/file/d/1akZFLmTWRxHECPQaYIHnIfTwPZTctRnz/view?usp=sharing
### Watchlist 配置
| 设置 | 值 |
|---|---|
| 名称 / 别名 | geoip |
| 来源类型 | 本地文件 |
| 表头前的行数 | 0 |
| 搜索键 | network |
导入 watchlist 后,我能够将源 IP 地址与地理数据相关联,并在 Sentinel 工作簿中使用该丰富后的信息。
丰富概念示例:
```
let GeoIPDB = _GetWatchlist("geoip");
SecurityEvent
| where EventID == 4625
| where isnotempty(IpAddress)
| evaluate ipv4_lookup(GeoIPDB, IpAddress, network)
| project TimeGenerated, Account, IpAddress, latitude, longitude, cityname, countryname
```
## 步骤 9:创建 Microsoft Sentinel 攻击地图
我创建了一个 Microsoft Sentinel 工作簿,以按地理位置可视化失败的身份验证尝试。
实验中使用的 Workbook JSON:
https://drive.google.com/file/d/1FLUIkzdbk4ypYg-OEza9e4ZJ9w7kYnu7/view?usp=sharing
### 工作簿步骤
1. 打开 Microsoft Sentinel
2. 转到工作簿
3. 创建一个新的工作簿
4. 删除默认元素
5. 添加查询元素
6. 打开高级编辑器
7. 粘贴工作簿 JSON
8. 保存并运行工作簿
9. 查看攻击地图可视化效果
攻击地图提供了失败登录尝试来源的可视化摘要。
## 结果
本实验室成功演示了 Azure 中的基本 SOC 监控工作流。
### 达成的目标
- 构建了一个面向互联网的 Azure Windows VM 蜜罐
- 生成了身份验证失败活动
- 在 Windows 事件查看器中确认了 Event ID 4625 日志
- 将 Windows 安全事件转发到 Log Analytics Workspace
- 将 Microsoft Sentinel 连接到工作区
- 使用 KQL 查询失败登录事件
- 使用 Sentinel watchlist 丰富源 IP 地址
- 创建了攻击地图工作簿以可视化身份验证活动
## 关键学习点
- Microsoft Sentinel 可用于收集、调查、丰富和可视化 Windows 安全事件
- Event ID 4625 对于识别失败的身份验证尝试很有用
- Azure Monitor Agent 和 Data Collection Rules 是日志摄取 pipeline 的重要组成部分
- KQL 对于 Microsoft Sentinel 中的 SOC 调查和威胁检测至关重要
- Watchlists 可以丰富安全数据并改善调查上下文
- 蜜罐必须是隔离的、一次性的,并在测试后移除
- 详细的文档记录有助于将实验室转化为作品集证据
## 清理
为了降低成本和安全风险,我在测试后删除了实验室资源。
已移除的资源:
- Windows VM
- 公共 IP 地址
- Network Security Group
- Log Analytics Workspace
- Microsoft Sentinel 实例
- Resource Group
## 项目状态
已完成。
未来的改进可能包括:
- 添加 Sentinel 分析规则
- 创建事件自动化 playbook
- 添加警报严重性逻辑
- 将检测映射到 MITRE ATT&CK
- 添加 Defender for Cloud 建议
- 扩展实验室以包含多个日志源