faizaanmir/soc-homelab-setup

GitHub: faizaanmir/soc-homelab-setup

一份分步指南,教你使用 Splunk、Sysmon 和 Atomic Red Team 在单机上搭建个人 SOC 检测实验室,练习攻击模拟与检测工程。

Stars: 0 | Forks: 0

# SOC 检测家庭实验室搭建指南 一份分步指南,介绍如何使用免费和开源工具在单台机器上构建个人 SOC 检测实验室。你可以利用它来练习检测工程、测试 Sigma 规则、使用 Atomic Red Team 模拟攻击,并在工作之外积累实践经验。 ## 实验室架构 ``` ┌─────────────────────────────────────────────────┐ │ Host Machine │ │ (Windows 10/11 or Linux) │ │ │ │ ┌─────────────────┐ ┌─────────────────────┐ │ │ │ Victim VM │ │ SIEM / Analyst │ │ │ │ Windows 10 │ │ VM │ │ │ │ + Sysmon │ │ Splunk Free │ │ │ │ + Atomic RT │──▶│ (or Elastic SIEM) │ │ │ │ + winlogbeat │ │ │ │ │ └─────────────────┘ └─────────────────────┘ │ │ │ │ VirtualBox / VMware Workstation │ └─────────────────────────────────────────────────┘ ``` **成本:** 免费 **所需内存:** 最低 8GB(推荐 16GB) **磁盘:** 约 60GB 可用空间 ## 组件 | 工具 | 角色 | 链接 | |---|---|---| | VirtualBox | Hypervisor | https://www.virtualbox.org | | Windows 10 Evaluation | 受害者 VM OS | https://www.microsoft.com/evalcenter | | Sysmon | Endpoint 遥测 | https://learn.microsoft.com/sysinternals/sysmon | | Sysmon Modular Config | 高质量 Sysmon 规则 | https://github.com/olafhartong/sysmon-modular | | Winlogbeat | 日志转发器 | https://www.elastic.co/beats/winlogbeat | | Splunk Free | SIEM(每天免费 500MB) | https://www.splunk.com/en_us/download.html | | Atomic Red Team | 攻击模拟 | https://github.com/redcanaryco/atomic-red-team | | sigma-cli | 将 Sigma 规则转换为 SPL/KQL | https://github.com/SigmaHQ/sigma-cli | ## 设置指南 ### 阶段 1 — Hypervisor 和 VM 参见 [docs/01-vm-setup.md](docs/01-vm-setup.md) 1. 安装 VirtualBox 2. 创建两台 VM:**受害者**(Windows 10)和 **SIEM**(Ubuntu 22.04 或 Windows Server) 3. 将两台 VM 都设置为使用 Host-Only 网络适配器(将实验室与你的真实网络隔离) 4. 在安装任何工具之前,为两台 VM 拍摄快照 —— 方便在攻击模拟后轻松回滚 ### 阶段 2 — 在受害者 VM 上安装 Sysmon 参见 [docs/02-sysmon-setup.md](docs/02-sysmon-setup.md) ``` # 下载 Sysmon Invoke-WebRequest -Uri "https://download.sysinternals.com/files/Sysmon.zip" -OutFile "Sysmon.zip" Expand-Archive Sysmon.zip -DestinationPath .\Sysmon # 下载 sysmon-modular config (高质量社区 config) Invoke-WebRequest -Uri "https://raw.githubusercontent.com/olafhartong/sysmon-modular/master/sysmonconfig.xml" -OutFile "sysmonconfig.xml" # 使用 config 安装 Sysmon .\Sysmon\Sysmon64.exe -accepteula -i sysmonconfig.xml ``` Sysmon 提供:进程创建(事件 1)、网络连接(事件 3)、文件创建(事件 11)、注册表更改(事件 13)、DNS 查询(事件 22)等。 ### 阶段 3 — 在 SIEM VM 上设置 Splunk 参见 [docs/03-splunk-setup.md](docs/03-splunk-setup.md) 1. 从 splunk.com 下载 Splunk Free(实验室无需许可证 —— 每日限制 500MB) 2. 安装并启动 Splunk: ``` sudo dpkg -i splunk-*.deb sudo /opt/splunk/bin/splunk start --accept-license ``` 3. 访问 `http://localhost:8000` 上的 Splunk 4. 创建一个名为 `wineventlog` 的 index ### 阶段 4 — Winlogbeat(日志转发) 参见 [docs/04-winlogbeat-setup.md](docs/04-winlogbeat-setup.md) 在受害者 VM 上安装 Winlogbeat,以将 Windows 事件(Security、Sysmon)转发到 Splunk: ``` # winlogbeat.yml (关键部分) winlogbeat.event_logs: - name: Security - name: Microsoft-Windows-Sysmon/Operational output.logstash: hosts: [":5044"] ``` ### 阶段 5 — Atomic Red Team(攻击模拟) 参见 [docs/05-atomic-red-team.md](docs/05-atomic-red-team.md) ``` # 安装 Atomic Red Team IEX (IWR 'https://raw.githubusercontent.com/redcanaryco/invoke-atomicredteam/master/install-atomicredteam.ps1' -UseBasicParsing) Install-AtomicRedTeam -getAtomics # 模拟一个 technique (例如 T1059.001 - PowerShell) Invoke-AtomicTest T1059.001 # 模拟凭据转储 (T1003.001) Invoke-AtomicTest T1003.001 ``` 运行某项技术后,前往 Splunk 搜索生成的事件。尝试编写一个能检测到它的 SPL 查询。 ### 阶段 6 — 测试 Sigma 规则 参见 [docs/06-sigma-testing.md](docs/06-sigma-testing.md) ``` # 安装 sigma-cli pip install sigma-cli sigma plugin install splunk # 将 Sigma rule 转换为 SPL 并在 Splunk 中测试 sigma convert -t splunk ../sigma-detection-rules/credential-access/ntlm-password-spray.yml ``` ## 实践工作流 ``` 1. Pick a MITRE ATT&CK technique 2. Read the technique page on attack.mitre.org 3. Simulate it with Atomic Red Team 4. Find the raw events in Splunk 5. Write an SPL query that detects it 6. Convert to a Sigma rule 7. Document findings in a short write-up ``` 重复上述过程。这就是检测工程师积累直觉的方法。 ## 建议优先模拟的技术 | 技术 | ID | Atomic 测试 | |---|---|---| | PowerShell 编码命令 | T1059.001 | `Invoke-AtomicTest T1059.001` | | 计划任务持久化 | T1053.005 | `Invoke-AtomicTest T1053.005` | | LSASS 凭据转储 | T1003.001 | `Invoke-AtomicTest T1003.001` | | 注册表 Run 键持久化 | T1547.001 | `Invoke-AtomicTest T1547.001` | | Certutil 下载 cradle | T1105 | `Invoke-AtomicTest T1105` | ## 资源 - [MITRE ATT&CK](https://attack.mitre.org) - [Sigma 规则(社区)](https://github.com/SigmaHQ/sigma) - [Atomic Red Team 文档](https://github.com/redcanaryco/atomic-red-team) - [Sysmon Modular Config](https://github.com/olafhartong/sysmon-modular) - [Splunk Security Essentials 应用](https://splunkbase.splunk.com/app/3435) - [LOLBAS 项目](https://lolbas-project.github.io) *作者:Faizaan Sajjad — Security Specialist,Orange Cyber Defense* *专为个人技能发展而构建。所有模拟均在隔离的实验室环境中进行。*
标签:Reconnaissance, Sysmon, 安全实验室, 安全运营中心, 攻击模拟, 网络映射, 驱动签名利用