SathvikManuka/Splunk-SIEM-Threat-Detection

GitHub: SathvikManuka/Splunk-SIEM-Threat-Detection

一个基于 Splunk 的 SIEM 威胁检测实验室,提供五条覆盖暴力破解、DNS C2、权限提升等场景的 SPL 检测规则并映射 MITRE ATT&CK 框架。

Stars: 0 | Forks: 0

# 🛡️ Splunk SIEM 威胁检测 ![Splunk](https://img.shields.io/badge/Splunk-SIEM-FF6B35?style=flat&logo=splunk&logoColor=white) ![MITRE ATT&CK](https://img.shields.io/badge/MITRE-ATT%26CK-red?style=flat) ![Blue Team](https://img.shields.io/badge/Blue-Team-1E8449?style=flat) ![SPL](https://img.shields.io/badge/SPL-Detection%20Rules-orange?style=flat) ![License](https://img.shields.io/badge/License-MIT-green?style=flat) 一个基于 Splunk 的威胁检测实验室,模拟 SOC 环境。它接收 DNS 和 HTTP 日志,应用 SPL 检测规则来发现异常流量模式,并提供仪表板以监控告警和攻击指标 (IOC) —— 这些均映射至 MITRE ATT&CK 框架。 ## 🎯 涵盖的威胁场景 | 场景 | MITRE ATT&CK 技术 | 检测文件 | |---|---|---| | 暴力破解登录尝试 | T1110 – 暴力破解 | `detections/brute_force.spl` | | 基于 DNS 的 C2 通信 | T1071.004 – DNS | `detections/dns_c2_detection.spl` | | 权限提升 | T1078 – 有效账户 | `detections/privilege_escalation.spl` | | 可疑的 PowerShell 执行 | T1059.001 – PowerShell | `detections/suspicious_powershell.spl` | | 异常 HTTP 流量 | T1071.001 – Web 协议 | `detections/anomalous_http.spl` | ## ⚙️ 功能 - **日志接入** — 在 Splunk 中构建的 DNS 和 HTTP 日志流水线 - **SPL 检测规则** — 5 个生产级检测查询,具有经过调优的阈值 - **MITRE ATT&CK 映射** — 每条规则均标记到特定的技术 ID - **仪表板** — 单一窗格视图,显示活动告警、主要源 IP 和威胁时间线 - **样本日志** — 包含合成的 DNS 和 HTTP 日志,可立即进行测试 - **分析报告** — 针对每个检测场景记录的调查结果 ## 📁 仓库结构 ``` Splunk-SIEM-Threat-Detection/ ├── detections/ │ ├── brute_force.spl # T1110 - Brute Force │ ├── dns_c2_detection.spl # T1071.004 - DNS C2 │ ├── privilege_escalation.spl # T1078 - Valid Accounts │ ├── suspicious_powershell.spl # T1059.001 - PowerShell │ └── anomalous_http.spl # T1071.001 - Web Protocols ├── sample-logs/ │ ├── dns_logs_sample.csv # Synthetic DNS logs with C2 patterns │ └── http_logs_sample.csv # Synthetic HTTP logs with anomalies ├── dashboards/ │ └── threat_detection_dashboard.xml # Splunk dashboard XML ├── reports/ │ └── detection_findings_report.md # Full analysis findings ├── screenshots/ │ └── dashboard_preview.png # Splunk dashboard screenshot └── README.md ``` ## 🚀 设置与使用 ### 前置条件 - Splunk Free 或 Enterprise (v8.x+) — [在此下载](https://www.splunk.com/en_us/download.html) - Python 3.8+(用于日志生成脚本) ### 1. 将样本日志接入 Splunk ``` Settings → Add Data → Upload → select sample-logs/dns_logs_sample.csv Settings → Add Data → Upload → select sample-logs/http_logs_sample.csv ``` 将 sourcetype 设置为 `csv`,index 设置为 `main`。 ### 2. 运行检测查询 打开 Splunk Search & Reporting,粘贴任意 `.spl` 文件的内容并运行: ``` | Search & Reporting → paste contents of detections/brute_force.spl → Run ``` ### 3. 导入仪表板 ``` Dashboards → Create New Dashboard → Source → paste contents of dashboards/threat_detection_dashboard.xml ``` ## 🔍 检测规则 ### 1. 暴力破解检测 (`T1110`) ``` index=main sourcetype=linux_secure "Failed password" | stats count by src_ip, user | where count > 5 | eval mitre_technique="T1110 - Brute Force" | eval severity=if(count>20,"HIGH","MEDIUM") | table src_ip, user, count, severity, mitre_technique | sort -count ``` **逻辑:** 统计每个源 IP 对每个用户的 SSH 登录失败次数。失败 5 次标记为中危;20 次以上标记为高危。这减少了合法输入错误引起的误报,同时能捕获系统性的暴力破解尝试。 ### 2. DNS C2 通信 (`T1071.004`) ``` index=main sourcetype=dns | stats count dc(query) as unique_domains by src_ip | where count > 100 AND unique_domains > 50 | eval mitre_technique="T1071.004 - Application Layer Protocol: DNS" | eval alert="Possible DNS C2 - High query volume with many unique domains" | table src_ip, count, unique_domains, alert, mitre_technique | sort -count ``` **逻辑:** 高 DNS 查询量结合大量唯一域名数是 DNS 隧道或 C2 信标(例如,DGA 生成的域名)的特征。合法的端点很少会在短时间内查询 50 个以上的唯一域名。 ### 3. 权限提升 (`T1078`) ``` index=main sourcetype=WinEventLog EventCode=4672 | stats count by Account_Name, Logon_Type, src_ip | where count > 3 | eval mitre_technique="T1078 - Valid Accounts" | eval alert="Sensitive Privilege Assignment Detected" | table Account_Name, Logon_Type, src_ip, count, alert, mitre_technique | sort -count ``` **逻辑:** 当登录时分配了特殊权限时,会触发 Windows 事件 4672。同一账户或 IP 的多次触发 —— 尤其是在非工作时间 —— 表明存在潜在的权限滥用或横向移动。 ### 4. 可疑的 PowerShell (`T1059.001`) ``` index=main sourcetype=WinEventLog EventCode=4104 | search ScriptBlockText IN ("*-enc*","*bypass*","*hidden*","*DownloadString*","*IEX*","*Invoke-Expression*") | stats count by ComputerName, User, ScriptBlockText | eval mitre_technique="T1059.001 - Command and Scripting Interpreter: PowerShell" | eval severity="HIGH" | table ComputerName, User, ScriptBlockText, count, severity, mitre_technique ``` **逻辑:** 事件 4104 捕获 PowerShell 脚本块日志。像 `-enc`(Base64 编码命令)、`bypass`(执行策略绕过)和 `DownloadString`(下载 payload)等关键字是恶意使用 PowerShell 的强烈指标。 ### 5. 异常 HTTP 流量 (`T1071.001`) ``` index=main sourcetype=access_combined | stats count avg(bytes) as avg_bytes by src_ip, uri_path, status | where count > 200 AND status=200 | eval mitre_technique="T1071.001 - Application Layer Protocol: Web Protocols" | eval alert=if(avg_bytes>500000,"Possible Data Exfiltration","High Volume HTTP") | table src_ip, uri_path, count, avg_bytes, alert, mitre_technique | sort -count ``` **逻辑:** 对相同 URI 路径的高频成功 HTTP 请求 —— 尤其是具有较大平均响应大小 —— 表明存在 Web 抓取、撞库或通过 HTTP 进行的数据外发。 ## 📊 检测结果摘要 请参阅 [`reports/detection_findings_report.md`](https://github.com/SathvikManuka/Splunk-SIEM-Threat-Detection/blob/main/detection_findings_report.md),获取针对样本日志运行所有检测后的完整书面调查结果。 ## 🔧 架构 ``` Sample Log Files (CSV) │ ▼ Splunk Indexer (index=main) │ ├──► DNS Logs (sourcetype=dns) ├──► HTTP Logs (sourcetype=access_combined) └──► Win Logs (sourcetype=WinEventLog) │ ▼ SPL Detection Rules │ ┌─────┴──────┐ │ │ Alerts Dashboard (per query) (unified view) │ │ ▼ ▼ MITRE ATT&CK Analyst Mapping Review ``` ## 📚 展示的技能 - Splunk SIEM 日志接入和流水线配置 - 用于威胁检测的 SPL (Search Processing Language) - MITRE ATT&CK 框架技术映射 - 暴力破解、C2、权限提升和 PowerShell 检测 - SOC 告警分诊和误报调优 - 用于安全运营的仪表板设计 ## 📄 许可证 MIT 许可证 — 可免费用于教育和研究目的。
标签:AMSI绕过, OpenCanary, SPL, 威胁检测, 安全, 超时处理, 逆向工具