ag48665/Splunk-SOC-Lab
GitHub: ag48665/Splunk-SOC-Lab
基于 Splunk 的 SOC 实验室项目,利用 Windows 安全日志与 Sysmon 进行威胁狩猎、检测工程及安全监控仪表板的搭建。
Stars: 0 | Forks: 0
# Splunk SOC 实验室
## 概述
本项目记录了使用 Splunk Enterprise、Windows 安全事件日志和 Sysmon 构建安全运营中心 (SOC) 实验室的过程。
此实验室的目标是模拟基础的 SOC 分析师活动,包括:
* 日志收集
* 事件监控
* 威胁狩猎
* 安全调查
* 检测工程
* 告警创建
* 仪表板创建
* Windows 安全事件分析
* Sysmon 事件监控
## 环境
| 组件 | 详情 |
| -------------------- | --------------------------------------------------- |
| SIEM | Splunk Enterprise 10.4 |
| Endpoint | Windows 11 |
| 数据源 | Windows 安全事件日志 |
| 额外遥测数据 | Sysmon |
| 日志类型 | WinEventLog:Security |
| Sysmon Sourcetype | XmlWinEventLog:Microsoft-Windows-Sysmon/Operational |
## 数据收集
Windows 安全事件日志通过本地事件日志监控被采集到 Splunk 中。
收集的 Windows 安全事件包括:
* 成功登录 (4624)
* 失败登录 (4625)
* 特权登录 (4672)
* 用户账户创建 (4720)
* 安全审计事件
此外,部署了 Sysmon 以提供增强的端点可见性,用于:
* 进程创建
* 网络连接
* 文件创建
* 进程关系
* 命令行监控
# Windows 安全事件监控
## 失败登录检测
检测不成功的身份验证尝试。
```
index=* sourcetype="WinEventLog:Security" EventCode=4625
| stats count by Account_Name
| sort -count
```
**MITRE ATT&CK:** T1110 - Brute Force

## 暴力破解检测
检测产生多次失败身份验证尝试的账户。
```
index=* sourcetype="WinEventLog:Security" EventCode=4625
| stats count as FailedAttempts by Account_Name
| where FailedAttempts > 5
```
**MITRE ATT&CK:** T1110 - Brute Force

## 成功登录监控
按账户显示成功的身份验证事件。
```
index=* sourcetype="WinEventLog:Security" EventCode=4624
| stats count by Account_Name
| sort - count
```
**MITRE ATT&CK:** T1078 - Valid Accounts

## 用户账户创建检测
检测新本地用户账户的创建。
```
index=* EventCode=4720
```
**MITRE ATT&CK:** T1136 - Create Account

## 特权登录检测
检测获得提升权限的登录。
```
index=* EventCode=4672
| stats count by Account_Name
| sort -count
| head 10
```
**MITRE ATT&CK:** T1078 - Valid Accounts

## Top 10 安全事件 ID
显示最常见的 Windows 安全事件。
```
index=* sourcetype="WinEventLog:Security"
| stats count by EventCode
| sort -count
| head 10
```

# Sysmon 威胁狩猎
部署了 Sysmon 以增强端点可见性,并提供高级的进程、文件和网络监控能力。
## Sysmon 数据源
| 组件 | 详情 |
| ----------------- | --------------------------------------------------- |
| Source | Microsoft-Windows-Sysmon/Operational |
| Sourcetype | XmlWinEventLog:Microsoft-Windows-Sysmon/Operational |
| 采集方式 | 本地事件日志采集 |
| Index | main |
## Sysmon Event ID 分布
此搜索从 XML 日志中提取 Sysmon Event ID,并总结最常见的 Sysmon 事件。
```
index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"
| rex "(?\d+) "
| stats count by SysmonEventID
| sort SysmonEventID
```

## 进程创建监控
使用 Sysmon Event ID 1 监控新创建的进程。
```
index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"
| rex "(?\d+) "
| search SysmonEventID=1
```
**MITRE ATT&CK:** T1059 - Command and Scripting Interpreter

## PowerShell 执行检测
检测 PowerShell 命令的执行。
```
index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"
| search "powershell.exe"
```
**MITRE ATT&CK:** T1059.001 - PowerShell

## 命令提示符执行检测
检测 cmd.exe 的执行。
```
index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"
| search "cmd.exe"
```
**MITRE ATT&CK:** T1059.003 - Windows Command Shell

## 网络连接监控
使用 Sysmon Event ID 3 监控出站网络连接。
```
index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"
| rex "(?\d+) "
| search SysmonEventID=3
```
**MITRE ATT&CK:** T1049 - System Network Connections Discovery

## 文件创建监控
使用 Sysmon Event ID 11 检测文件创建活动。
```
index=* sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational"
| rex "(?\d+) "
| search SysmonEventID=11
```
**MITRE ATT&CK:** T1105 - Ingress Tool Transfer

# Splunk 告警
## PowerShell 执行检测告警
创建了一个定时的 Splunk 告警来检测 PowerShell 执行事件。
* 告警类型:定时
* 计划:每小时
* 触发条件:结果数 > 0
* 动作:添加到已触发告警
* 严重程度:中

## CMD 执行检测告警
创建了一个定时的 Splunk 告警来检测命令提示符执行事件。
* 告警类型:定时
* 计划:每小时
* 触发条件:结果数 > 0
* 动作:添加到已触发告警

# SOC 威胁狩猎仪表板
创建了一个自定义的 Splunk 仪表板,以集中进行 Windows 安全和 Sysmon 监控。
仪表板面板包括:
* Sysmon 事件分布
* PowerShell 执行检测
* CMD 执行检测
* 网络连接监控
* 文件创建监控
* 失败登录检测
* 成功登录监控
* 用户账户创建检测

## 如何使用此实验室
1. 安装 Splunk Enterprise。
2. 配置 Windows 安全事件日志收集。
3. 安装 Sysmon 并启用 Sysmon 事件日志记录。
4. 配置 Splunk 以摄取 Sysmon Operational 日志。
5. 执行本仓库中提供的 SPL 查询。
6. 查看检测、仪表板和告警。
7. 生成测试活动以验证检测。
示例测试活动:
* 失败登录
* PowerShell 执行
* CMD 执行
* 网络连接
* 用户账户创建
此实验室可以通过添加额外的检测、Sigma 规则和攻击模拟来进行扩展。
## 展示技能
* Splunk Enterprise 管理
* Windows 事件日志分析
* Sysmon 部署和监控
* SPL (Search Processing Language)
* 安全监控
* 威胁狩猎
* 检测工程
* 告警创建
* 仪表板开发
* SIEM 操作
* MITRE ATT&CK 映射
* 事件检测
## 未来改进
* 创建额外的基于 Sysmon 的检测规则
* 开发跨多种事件源的关联搜索
* 将 Sigma 检测规则集成到 Splunk 中
* 构建高级 SOC 仪表板
* 创建网络钓鱼检测用例
* 开发暴力破解检测剧本
* 添加 MITRE ATT&CK 覆盖矩阵
* 使用 Atomic Red Team 模拟对手行为
* 实施事件响应工作流
* 构建基于风险的告警用例
* 集成威胁情报源
标签:安全运营中心, 红队行动, 网络映射