DurgaRamireddy/Splunk-HOME-SOC-Detection-Lab---End-to-End-Alert-Lifecycle
GitHub: DurgaRamireddy/Splunk-HOME-SOC-Detection-Lab---End-to-End-Alert-Lifecycle
基于 Splunk 的端到端 SOC 检测实验室,模拟多阶段攻击并覆盖完整告警生命周期。
Stars: 1 | Forks: 0
# Splunk HOME SOC 检测实验室 - 端到端告警生命周期
**工具:** Splunk 9.3.2 · Windows 10 · Kali Linux · Ubuntu 22.04 · Hydra · PowerShell
**MITRE ATT&CK:** T1110 · T1078 · T1059.001 · T1547.001 · T1059
**类型:** 家庭实验室 · 蓝队 · 威胁检测 · 应急响应
## 概述
本项目模拟了真实的 SOC Tier 1 分析师端到端工作流程:
1. 在 Ubuntu 上部署 Splunk 作为 SIEM
2. 通过 HTTP Event Collector 将 Windows 10 安全日志转发至 Splunk
3. 从 Kali Linux 模拟多阶段攻击
4. 使用 SPL 查询检测每一个攻击阶段
5. 构建 SOC 运营仪表板
6. 撰写包含 MITRE ATT&CK 映射的正式事件报告
## 实验架构
```
┌──────────────────────────────────────────────────────┐
│ VMware Host-Only Network │
│ 192.168.161.0/24 │
│ │
│ ┌─────────────┐ ┌─────────────┐ ┌──────────┐ │
│ │ Ubuntu VM │ │ Windows 10 │ │ Kali │ │
│ │Splunk 9.3.2 │◄───│ Log Source │ │ Attacker │ │
│ │.130 : 8000 │ │ .131 │◄───│ .153 │ │
│ │ HEC: 8088 │ │ │ │ Hydra │ │
│ └─────────────┘ └─────────────┘ └──────────┘ │
└──────────────────────────────────────────────────────┘
```
| VM | OS | IP | 角色 |
|---|---|---|---|
| Ubuntu | Ubuntu 22.04 LTS | 192.168.161.130 | Splunk SIEM |
| Windows 10 | Windows 10 | 192.168.161.131 | 受害者 / 日志源 |
| Kali Linux | Kali 2024 | 192.168.161.153 | 攻击者 |
## 攻击链与检测
| 阶段 | MITRE TTP | 技术 | EventID | 结果 |
|---|---|---|---|---|
| 1 | T1110 | 通过 Hydra 暴力破解 | 4625 | 检测到 49 次失败登录 |
| 2 | T1078 | 有效账户登录 | 4624 | 监控到 77 次成功登录 |
| 3 | T1059.001 | PowerShell 编码命令 | 4104 | 捕获到 6 个脚本块事件 |
| 4 | T1547.001 | 注册表 Run 键持久化 | 4104 | 检测到 Updater 键 |
| 5 | T1059 | 进程创建 | 4688 | 记录了 52 个进程事件 |
## 设置
### 步骤 1 - Ubuntu 上的 Splunk
```
# 安装
sudo dpkg -i splunk-9.3.2.deb
sudo /opt/splunk/bin/splunk start --accept-license
sudo /opt/splunk/bin/splunk enable boot-start
# 启用 HEC
# Settings -> Data Inputs -> HTTP Event Collector -> Global Settings -> Enable -> Port 8088
# New Token -> name: winlogbeat -> index: main -> copy token
```
### 步骤 2 - Windows 审核策略
```
# 启用关键审计类别
auditpol /set /subcategory:"Logon" /success:enable /failure:enable
auditpol /set /subcategory:"Process Creation" /success:enable /failure:enable
auditpol /set /subcategory:"Credential Validation" /success:enable /failure:enable
# 启用 PowerShell Script Block Logging
$path = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging"
New-Item -Path $path -Force
Set-ItemProperty -Path $path -Name "EnableScriptBlockLogging" -Value 1
```
### 步骤 3 - 通过 HEC 进行 Windows 日志转发
```
# splunk-forward.ps1
$splunkUrl = "http://192.168.161.130:8088/services/collector"
$token = "YOUR-HEC-TOKEN-HERE"
$headers = @{Authorization = "Splunk $token"}
Get-WinEvent -LogName Security -MaxEvents 50 | ForEach-Object {
$event = @{
event = @{
EventID = $_.Id
TimeCreated = $_.TimeCreated.ToString()
Message = $_.Message
Computer = $_.MachineName
}
sourcetype = "WinEventLog:Security"
index = "main"
}
$body = $event | ConvertTo-Json -Compress
Invoke-RestMethod -Uri $splunkUrl -Method Post -Headers $headers -Body $body
}
```
## 攻击模拟
### T1110 - 暴力破解 (Kali -> Windows)
```
# 提取 wordlist
sudo gunzip /usr/share/wordlists/rockyou.txt.gz
# 运行 Hydra brute force
hydra -l Durga -P /usr/share/wordlists/rockyou.txt smb://192.168.161.131 -t 2 -v
```
```
# 在 Windows 本地模拟失败登录
1..20 | ForEach-Object {
$cred = New-Object System.Management.Automation.PSCredential(
"FakeUser", (ConvertTo-SecureString "wrongpassword$_" -AsPlainText -Force))
try { Start-Process cmd -Credential $cred -ErrorAction Stop } catch {}
}
```
### T1547.001 + T1059.001 - 通过注册表实现持久化
```
# 写入恶意 autostart 注册表键
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" `
-Name "Updater" `
-Value "powershell.exe -ExecutionPolicy Bypass -enc SGVsbG8gV29ybGQ="
# 验证其已写入
Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run"
```
## Splunk 检测查询 (SPL)
### 暴力破解检测 - T1110
```
index=main EventID=4625
| stats count by Computer
| where count > 3
| sort -count
```
### 成功登录监控 - T1078
```
index=main EventID=4624
| stats count by Computer
```
### PowerShell 滥用检测 - T1059.001
```
index=main sourcetype="WinEventLog:PowerShell" EventID=4104
| table TimeCreated Computer Message
```
### 完整攻击时间线
```
index=main (EventID=4625 OR EventID=4624 OR EventID=4104 OR EventID=4688)
| timechart count by EventID
```
## Splunk 仪表板
在 Splunk 中构建的 4 面板 SOC 运营仪表板:
| 面板 | 查询 | 图表类型 |
|---|---|---|
| 暴力破解失败登录 | EventID=4625 stats by Computer | 柱状图 |
| 成功登录 | EventID=4624 stats by Computer | 表格 |
| PowerShell 执行 | EventID=4104 table | 表格 |
| 攻击时间线 | timechart by EventID | 折线图 |

## 检测截图




## 关键结果
| 指标 | 数量 |
|---|---|
| 摄取的总事件数 | 350+ |
| 失败登录事件 (4625) | 49 |
| 成功登录事件 (4624) | 77 |
| PowerShell 执行事件 (4104) | 6 |
| 进程创建事件 (4688) | 52 |
| 识别出的 IOC | 8 |
| 覆盖的 MITRE TTP | 5 |
## 仓库文件
```
splunk-soc-lab/
├── README.md
├── Home SOC Lab Report - Splunk SOC Detection.docx
├── scripts/
│ ├── splunk-forward.ps1 # Windows -> Splunk log forwarding
│ └── audit-policy-setup.ps1 # Windows audit policy config
├── splunk/
│ └── detection-queries.spl # All SPL detection searches
└── screenshots/
├── splunk-dashboard.png
├── 4625-brute-force.png
├── 4624-valid-accounts.png
├── 4104-powershell.png
└── attack-timeline.png
```
## 展示的技能
- Linux 上的 Splunk Enterprise 部署与配置
- 通过 HTTP Event Collector (HEC) 进行日志管道工程
- Windows 安全事件日志分析 (EventID 分类)
- 通过 `auditpol` 和组策略配置审核策略
- 使用 Hydra、PowerShell 和注册表操作进行威胁模拟
- 编写用于威胁检测的 SPL 查询
- 在 Splunk 中创建 SOC 仪表板
- 包含 IOC 和 MITRE ATT&CK 映射的事件文档
## 参考资料
- [MITRE ATT&CK Framework](https://attack.mitre.org)
- [Splunk Documentation](https://docs.splunk.com)
- [Windows Security Event IDs](https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/)
**作者:** Durga Sai Sri Ramireddy | 休斯顿大学 网络安全硕士
[](https://linkedin.com/in/durga-ramireddy)
[](https://github.com/DurgaRamireddy)
标签:AI合规, AMSI绕过, Cloudflare, EDR, HEC, HTTP Event Collector, Hydra, IPv6, MITRE ATT&CK, OpenCanary, PoC, PowerShell, SOC实验室, SPL查询, VMware, Windows 10, 事件响应报告, 仪表盘, 仪表盘设计, 企业安全, 初始访问, 威胁检测, 安全教育, 安全运营, 库, 应急响应, 执行, 扫描框架, 攻击模拟, 日志转发, 暴力破解, 私有化部署, 端点安全, 网络安全, 网络资产管理, 脆弱性评估, 虚拟化环境, 补丁管理, 计算机防御, 速率限制, 防御规避, 隐私保护, 驱动签名利用