hashtags2023/homelab-soc
GitHub: hashtags2023/homelab-soc
该项目是一个基于 VirtualBox 的家庭网络安全实验室,模拟企业网络供用户在隔离环境中练习威胁检测、日志分析和事件响应等蓝队技能。
Stars: 0 | Forks: 0
# 🏠 家庭 SOC 实验室 — 安全运营与分析实验室
[](https://github.com/hashtags2023/homelab-soc)
[](https://www.virtualbox.org/)
[](#)
## 📋 目录
- [概述](#overview)
- [实验室架构](#lab-architecture)
- [工具与技术](#tools--technologies)
- [虚拟机配置](#vm-setup)
- [网络配置](#network-configuration)
- [实验室练习](#lab-exercises)
- [发现与笔记](#findings--notes)
- [资源](#resources)
## 概述
这个家庭实验室模拟了一个小型企业网络环境,用于练习:
- **威胁检测** — 使用 SIEM 工具实时识别攻击
- **日志分析** — 解析并关联 Windows、Linux 和 Web 服务器日志
- **网络监控** — 使用 Wireshark 和 Zeek 捕获并分析流量
- **漏洞评估** — 扫描并利用故意存在漏洞的机器
- **事件响应** — 记录并响应模拟攻击
所有攻击和防御活动均在**隔离的虚拟网络**中进行,不连接互联网或生产系统。
## 实验室架构
```
┌─────────────────────────────────────────────────────┐
│ Host Machine │
│ (VirtualBox Hypervisor) │
│ │
│ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Kali Linux │ │ Security Onion / │ │
│ │ (Attacker) │◄──────►│ SIEM / Monitor │ │
│ │ 10.0.0.10 │ │ 10.0.0.5 │ │
│ └──────┬───────┘ └──────────────────────┘ │
│ │ │
│ ▼ [Internal NAT Network: 10.0.0.0/24] │
│ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Metasploitable│ │ Windows Server │ │
│ │ (Target) │ │ (Target) │ │
│ │ 10.0.0.20 │ │ 10.0.0.30 │ │
│ └──────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────┘
```
**网络:** 所有虚拟机均运行在隔离的 VirtualBox 内部网络(`soclab-net`)上。目标机器无法访问互联网。
## 工具与技术
| 类别 | 工具 | 用途 |
|---|---|---|
| Hypervisor | VirtualBox | 承载所有虚拟机 |
| 攻击机 OS | Kali Linux | 进攻工具(nmap、Metasploit、Burp Suite) |
| 目标机 (Linux) | Metasploitable 2/3 | 故意存在漏洞的 Linux 服务器 |
| 目标机 (Windows) | Windows Server 2019 (评估版) | Windows AD/事件日志练习 |
| SIEM | Splunk Free / Security Onion | 日志聚合与告警 |
| 网络监控 | Wireshark / Zeek | 数据包捕获与流量分析 |
| IDS | Snort / Suricata | 入侵检测特征 |
| 日志转发器 | Sysmon + Winlogbeat | 将 Windows 事件转发至 SIEM |
| 漏洞扫描器 | OpenVAS / Nessus Essentials | 自动化漏洞扫描 |
## 虚拟机配置
### 1. Kali Linux(攻击机)
```
ISO: https://www.kali.org/get-kali/
RAM: 2–4 GB
Storage: 40 GB
Network: Internal Network → soclab-net
```
- 默认凭据:`kali / kali`
- 安装后更新:`sudo apt update && sudo apt upgrade -y`
### 2. Metasploitable 2(Linux 目标机)
```
Download: https://sourceforge.net/projects/metasploitable/
RAM: 512 MB – 1 GB
Storage: 8 GB (pre-built .vmdk)
Network: Internal Network → soclab-net
IP: Set static: 10.0.0.20
```
- 默认凭据:`msfadmin / msfadmin`
- ⚠️ 切勿将此机器暴露于互联网
### 3. Windows Server 2019(Windows 目标机)
```
ISO: https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2019
RAM: 2–4 GB
Storage: 60 GB
Network: Internal Network → soclab-net
IP: Set static: 10.0.0.30
```
- 安装 **Sysmon** 以进行详细的事件记录
- 安装 **Winlogbeat** 以将日志转发至 SIEM
### 4. Security Onion(SIEM / 监控)
```
ISO: https://github.com/Security-Onion-Solutions/securityonion
RAM: 4–8 GB (minimum)
Storage: 100 GB
Network: NAT (internet) + Internal Network → soclab-net
IP: 10.0.0.5
```
- 包含 Elasticsearch、Kibana、Zeek、Suricata 和 Strelka
- 用于聚合所有实验室日志并可视化告警
## 网络配置
### VirtualBox 内部网络设置
1. 对于每台虚拟机,进入 **Settings → Network → Adapter 1**
2. 设置 **Attached to:** 为 `Internal Network`
3. 设置 **Name:** 为 `soclab-net`
4. 在每台虚拟机的 OS 设置中分配静态 IP
### 静态 IP 分配 (Linux)
```
# 编辑 /etc/network/interfaces 或使用 nmcli
sudo nmcli con mod "Wired connection 1" ipv4.addresses 10.0.0.20/24
sudo nmcli con mod "Wired connection 1" ipv4.method manual
sudo nmcli con up "Wired connection 1"
```
### 静态 IP 分配 (Windows)
```
Control Panel → Network Adapters → IPv4 Properties
IP: 10.0.0.30
Subnet: 255.255.255.0
Gateway: (leave blank or 10.0.0.1)
```
## 实验室练习
### 练习 1 — 网络侦察
**目标:** 练习对 Metasploitable 进行主动和被动侦察
**工具:** nmap、netdiscover
```
# Host discovery
netdiscover -r 10.0.0.0/24
# Service + version scan
nmap -sV -sC -O 10.0.0.20 -oN recon/metasploitable_scan.txt
# Full port scan
nmap -p- --min-rate 5000 10.0.0.20 -oN recon/full_ports.txt
```
📄 **文档记录:** 开放的端口、服务、OS 版本以及任何意外发现
### 练习 2 — 使用 Metasploit 进行漏洞利用
**目标:** 利用 Metasploitable 上的已知漏洞
**工具:** Metasploit Framework
```
msfconsole
use exploit/unix/ftp/vsftpd_234_backdoor
set RHOSTS 10.0.0.20
run
```
📄 **文档记录:** 使用的 CVE、获得了什么权限、攻击者接下来能做什么
### 练习 3 — 使用 Wireshark 进行流量分析
**目标:** 捕获并分析攻击流量
**工具:** Wireshark(在 Security Onion 或 Kali 上运行)
- 在 `soclab-net` 接口上启动 Wireshark 捕获
- 从 Kali 向 Metasploitable 运行 nmap 扫描
- 在 Wireshark 中,过滤:`tcp.flags.syn == 1 && tcp.flags.ack == 0`
- 观察 SYN 数据包 — 端口扫描在数据包层面是什么样的?
📄 **文档记录:** 截图、扫描模式的样貌以及您将如何检测它
### 练习 4 — Windows 事件日志分析
**目标:** 检测 Windows Server 上的暴力破解登录尝试
**工具:** Hydra (Kali)、Splunk/Security Onion (监控)
```
# 从 Kali —— 模拟 brute force
hydra -l administrator -P /usr/share/wordlists/rockyou.txt smb://10.0.0.30
```
- 在您的 SIEM 中,搜索 **Event ID 4625**(登录失败)
- 设置在 60 秒内出现 5 次以上失败的告警规则
📄 **文档记录:** 告警规则逻辑、触发告警的截图以及如何响应
### 练习 5 — 漏洞扫描
**目标:** 运行完整的漏洞扫描并解读结果
**工具:** OpenVAS 或 Nessus Essentials
- 扫描 `10.0.0.20` (Metasploitable)
- 导出报告
- 识别前 3 个严重漏洞
- 对于每一个:查找 CVE,了解影响,记录修复方法
📄 **文档记录:** 漏洞名称、CVE、CVSS 评分、修复步骤
## 发现与笔记
### [YYYY-MM-DD] 练习 1 — Metasploitable 侦察
- **发现:** 发现 X 个开放端口,服务包括 vsftpd 2.3.4、Samba 3.x、Apache 2.x
- **有趣之处:** 端口 6200 — vsftpd 后门
- **结论:** 默认服务横幅会揭示确切版本;攻击者可以直接去查找对应的 CVE
### [YYYY-MM-DD] 练习 2 — vsftpd 漏洞利用
- **CVE:** CVE-2011-2523
- **结果:** 使用 Metasploit 在 60 秒内获得了 root shell
- **结论:** 未打补丁且暴露版本的服务极易被利用。补丁管理至关重要。
*(完成练习后添加新条目)*
## 资源
### 免费实验室平台(无需配置)
| 平台 | 最适合 | 链接 |
|---|---|---|
| TryHackMe | 引导式新手房间 | https://tryhackme.com |
| Hack The Box | 中级挑战 | https://hackthebox.com |
| Blue Team Labs Online | 防御/SOC 专用 | https://blueteamlabs.online |
| CyberDefenders | DFIR 和 SOC 场景 | https://cyberdefenders.org |
### 学习参考资料
- [Professor Messer CompTIA Security+](https://www.professormesser.com/security-plus/sy0-701/sy0-701-video/sy0-701-comptia-security-plus-course/)
- [TCM Security 免费课程](https://academy.tcm-sec.com/)
- [SANS 阅读室](https://www.sans.org/reading-room/)
- [恶意软件流量分析](https://www.malware-traffic-analysis.net/) — 用于分析的真实 pcap 文件
### 工具文档
- [Sysmon 配置参考](https://github.com/SwiftOnSecurity/sysmon-config)
- [Security Onion 文档](https://docs.securityonion.net/)
- [Splunk 免费培训](https://www.splunk.com/en_us/training/free-courses/overview.html)
## ⚠️ 法律与道德声明
本实验室的所有活动均在**故意存在漏洞的虚拟机**上,以及由我拥有并控制的**隔离网络**中进行。未针对任何外部系统。本实验室仅供教育目的使用。
*最后更新:2025 | hashtags2023 | CSU Sacramento — 计算机科学理学学士 (B.S. Computer Science)*
# homelab-soc
标签:AMSI绕过, Metaprompt, 个人靶场, 威胁检测, 安全运营, 库, 应急响应, 扫描框架, 虚拟化, 速率限制