Javier-NarvaezZ/wazuh-siem-lab
GitHub: Javier-NarvaezZ/wazuh-siem-lab
基于 Wazuh 4.7.5 和 Suricata 构建的集中式 SIEM 实验环境,提供跨平台安全事件关联、自动事件响应与 CIS 合规基线审计能力。
Stars: 0 | Forks: 0
# 🔍 Wazuh SIEM 实验室 - 集中式安全监控与事件响应
[](LICENSE)
[]()
[](https://wazuh.com/)
[](https://suricata.io/)
[-yellow.svg)]()
## 目录
- [概述](#overview)
- [架构](#architecture)
- [检测能力](#detection-capabilities)
- [前置条件](#prerequisites)
- [快速开始](#quick-start)
- [攻击场景与验证](#attack-scenarios--validation)
- [项目结构](#project-structure)
- [文档](#documentation)
- [作者](#author)
## 概述
Suricata IDS 实验室建立了网络级别的威胁检测。这第二个项目解决了任何 IDS 都会留下的空白:一旦威胁进入系统,如何查看 endpoint *内部* 发生了什么。Wazuh 填补了这一空白,它将操作系统日志、身份验证事件、文件系统更改以及来自 Suricata 的网络警报关联到一个单一的分析平台中。
该实验室建立在 VirtualBox 的隔离虚拟环境中,包含三台机器:一台 Wazuh Server(Ubuntu 26.04,8GB RAM),一台运行 Suricata IDS 的受监控 endpoint(Ubuntu 26.04),以及一台 Kali Linux 攻击机。这三台机器都在桥接网络 (`192.168.40.0/24`) 上运行,以模拟真实的局域网网段。
**主要目标:**
- 部署 Wazuh 4.7.5 作为集中式 SIEM,并将 Suricata 作为受监控的 agent 连接
- 验证多源事件关联:网络警报 (Suricata) + 操作系统日志 + 身份验证事件
- 演示文件完整性监控 (FIM) 检测未经授权的文件系统更改
- 配置 Active Response,在检测到暴力破解时自动阻止攻击者 IP
- 根据 CIS Ubuntu Linux 22.04 Benchmark v1.0.0 评估 endpoint 的安全状况
## 架构
### 网络拓扑
```
┌─────────────────────────────────────────────────────────┐
│ Physical Network (Bridge Mode) │
│ 192.168.40.0/24 │
└──────────┬──────────────────┬──────────────────┬────────┘
│ │ │
┌────────▼────────┐ ┌───────▼────────┐ ┌───────▼────────┐
│ Wazuh Server │ │ Suricata-IDS │ │ Kali Linux │
│ Ubuntu 26.04 │ │ Ubuntu 26.04 │ │ (Attacker) │
│ 192.168.40.29 │ │ 192.168.40.36 │ │ 192.168.40.33 │
│ │ │ │ │ │
│ Wazuh Manager │ │ Suricata 8.x │ │ Nmap, Hydra │
│ Wazuh Indexer │ │ Wazuh Agent │ │ hping3 │
│ Dashboard │ │ (ID: 001) │ │ │
└─────────────────┘ └────────────────┘ └────────────────┘
│ │
└──────────────────┘
Events flow (port 1514/tcp)
Agent registration (port 1515/tcp)
```
### 数据流
```
[Kali Linux]
│
│ Attack traffic
▼
[Suricata IDS] ──── eve.json ────► [Wazuh Agent]
[OS Auth Logs] ─────────────────► [Wazuh Agent]
[File System] ─── syscheck ────► [Wazuh Agent]
│
│ Port 1514/tcp
▼
[Wazuh Manager]
│
▼
[Wazuh Indexer]
│
▼
[Dashboard / Alerts]
```
### 基础设施
| 组件 | 操作系统 | 内存 | 角色 |
|-----------|-----|-----|------|
| **Wazuh Server** | Ubuntu 26.04 LTS | 8 GB | SIEM Manager + Indexer + Dashboard |
| **Suricata-IDS** | Ubuntu 26.04 LTS | 2 GB | IDS 引擎 + 受监控的 Endpoint |
| **Kali Linux** | Kali 2026.1 | 4 GB | 攻击模拟 |
## 检测能力
### 多源事件关联
Wazuh 从受监控 endpoint 上的四个独立来源聚合事件,实现了独立 IDS 无法提供的交叉关联:
- **网络层 (Suricata):** 实时解析 `eve.json`,将警报映射到 Wazuh 规则组 (`ids`, `suricata`)
- **身份验证层:** 监控 `/var/log/auth.log` 以获取 SSH 失败、PAM 事件和权限提升
- **文件完整性层:** `syscheck` 模块每 60 秒扫描一次 `/etc`, `/bin`, `/sbin`, `/usr/bin`, `/usr/sbin`
- **系统层:** `syslog`, `kern.log`, `dpkg.log` 用于操作系统级别的活动
### 主动响应
在检测到 SSH 暴力破解(规则 5763,≥8 次身份验证失败)后,Wazuh 会在受监控的 endpoint 上触发自动 `firewall-drop` 响应,在无需人工干预的情况下阻止攻击者的 IP 180 秒。这是针对使用 Hydra 和 rockyou.txt 字典的 Kali Linux 进行验证的。
### CIS Benchmark 评估 (SCA)
Security Configuration Assessment 针对 CIS Ubuntu Linux 22.04 LTS Benchmark v1.0.0 运行,评估了涵盖文件系统分区、网络参数、访问控制和服务强化的 182 项控制。该 endpoint 的 AS-IS 分数为 **40%(73 项通过 / 107 项失败)**,为强化阶段(作品集中的项目 3)确立了基线。
### MITRE ATT&CK 映射
实验室期间检测到的技术:
| 技术 | ID | 战术 | 来源 |
|-----------|-----|--------|--------|
| Brute Force: Password Guessing | T1110.001 | Credential Access | auth.log |
| Remote Services: SSH | T1021.004 | Lateral Movement | sshd |
| Network Service Scanning | T1046 | Discovery | Suricata/eve.json |
## 前置条件
### 软件
- VirtualBox 6.1+
- Ubuntu Server 22.04 或 26.04 LTS ISO
- Kali Linux VirtualBox 镜像
- 至少具有 16 GB RAM 的主机(该实验室在三个虚拟机中使用了约 14 GB)
### 知识储备
- 熟悉 Linux 管理和 systemd 服务管理
- 了解 TCP/IP、SSH 和网络分段概念
- 已完成 [Suricata IDS 实验室](https://github.com/Javier-NarvaezZ/suricata-ids-lab) 或具有同等的 IDS 经验
## 快速开始
### 1. 部署 Wazuh Server
```
# 在 Wazuh Server VM 上
curl -sO https://packages.wazuh.com/4.7/wazuh-install.sh
sudo bash wazuh-install.sh -a -i
# 安装结束时将显示凭证
# 请保存它们 — 访问 Dashboard 需要用到
```
### 2. 安装并注册 Wazuh Agent
```
# 在 Suricata-IDS VM 上
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | \
sudo gpg --no-default-keyring \
--keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg \
--import && sudo chmod 644 /usr/share/keyrings/wazuh.gpg
echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] \
https://packages.wazuh.com/4.x/apt/ stable main" | \
sudo tee /etc/apt/sources.list.d/wazuh.list
sudo apt-get update
sudo apt-get install wazuh-agent=4.7.5-1 -y
```
### 3. 配置 Agent
```
# 将 agent 指向 Wazuh Manager
sudo nano /var/ossec/etc/ossec.conf
# 设置:192.168.40.29
sudo systemctl daemon-reload
sudo systemctl enable wazuh-agent
sudo systemctl start wazuh-agent
```
### 4. 部署自定义配置
```
sudo cp configs/ossec.conf /var/ossec/etc/ossec.conf
sudo systemctl restart wazuh-agent
```
### 5. 验证连接
```
# 在 Wazuh Server 上
sudo /var/ossec/bin/agent_control -l
# 预期:ID: 001, Name: Suricata-IDS, Active
```
## 攻击场景与验证
### 场景 1 — 网络侦察 (Nmap)
```
# 从 Kali Linux
nmap -Pn -T4 --min-rate 200 192.168.40.36
```
**预期检测:** Wazuh Security Events → `rule.groups: suricata` → 来自 Suricata `eve.json` 且规则 ID 为 `86601` 的警报。
### 场景 2 — SSH 暴力破解 + Active Response (Hydra)
```
# 从 Kali Linux
sudo gunzip /usr/share/wordlists/rockyou.txt.gz
hydra -l root -P /usr/share/wordlists/rockyou.txt ssh://192.168.40.36 -t 4
```
**预期检测:** 254 次 `authentication_failed` 事件,映射了 MITRE T1110.001,随后在 endpoint 上自动执行 `firewall-drop`,阻止 `192.168.40.33` 180 秒。
```
# 实时监控主动响应 (在 Suricata-IDS VM 上)
sudo tail -f /var/ossec/logs/active-responses.log
```
### 场景 3 — 文件完整性监控
```
# 在 Suricata-IDS VM 上 — 模拟未授权文件创建
sudo touch /etc/cron.d/test-fim
sudo echo "cambio-$(date)" | sudo tee /etc/test-wazuh-fim
sudo chmod 777 /etc/test-wazuh-fim
```
**预期检测:** Wazuh Dashboard → Agents → Suricata-IDS → Integrity Monitoring → `Files modified: /etc/test-wazuh-fim`,用户为 `root`,操作为 `modified`。
### 场景 4 — CIS Benchmark 评估
无需攻击。SCA 模块会在 agent 启动时及之后每 12 小时自动运行。结果可见于:
```
Dashboard → Agents → Suricata-IDS → Security Configuration Assessment → Inventory
```
### 验证总结
| 场景 | 工具 | 检测 | Active Response |
|----------|------|-----------|----------------|
| 网络扫描 | Nmap | SIEM 中 1,174+ 条 Suricata 警报 | — |
| SSH 暴力破解 | Hydra | 254 次身份验证失败,MITRE T1110.001 | IP 被阻止 180 秒 |
| 文件修改 | 手动 | FIM 警报,包含文件 + 用户 + 时间戳 | — |
| CIS 合规性 | SCA 模块 | 40% 得分,107 项控制失败 | — |
## 项目结构
```
wazuh-siem-lab/
├── README.md
├── LICENSE
├── .gitignore
│
├── docs/
│ ├── 01-architecture.md # Network design and data flow
│ ├── 02-setup-guide.md # Step-by-step installation with troubleshooting
│ ├── 03-detection-capabilities.md # FIM, SCA, Active Response configuration
│ ├── 04-attack-scenarios.md # Testing methodology and commands
│ └── 05-results.md # Metrics, findings, and analysis
│
├── configs/
│ └── ossec.conf # Wazuh agent configuration (sanitized)
│
├── scripts/
│ └── run-attacks.sh # Automated attack simulation from Kali
│
└── evidence/
└── screenshots/
|── 00-virtualbox-topology.png
├── 01-virtualbox-topology.png
├── 02-suricata-service-active.png
├── 03-security-events-suricata-overview.png
├── 04-nmap-scan-kali.png
├── 05-security-events-agent001-overview.png
├── 06-brute-force-authentication-failed.png
├── 07-brute-force-top5-alerts.png
├── 08-active-response-firewall-drop.png
├── 09-active-response-ended.png
├── 10-fim-file-creation-command.png
├── 11-fim-dashboard-files-modified.png
├── 12-sca-score-overview.png
├── 13-sca-failed-checks-list.png
├── 14-sca-check-detail-compliance.png
└── 15-rootcheck-trojan-detection.png
```
## 文档
- **[架构](docs/01-architecture.md)** — 网络拓扑、虚拟机规格和数据流
- **[设置指南](docs/02-setup-guide.md)** — 完整的安装演练,包括 Ubuntu 26.04 上的已知问题
- **[检测能力](docs/03-detection-capabilities.md)** — FIM、SCA 和 Active Response 配置详情
- **[攻击场景](docs/04-attack-scenarios.md)** — 渗透测试方法和预期结果
- **[结果与分析](docs/05-results.md)** — 检测指标、CIS 发现和经验教训
## 作者
**Javier Andrés Narváez Hoyos**
- 🎓 Systems Engineering 学生 @ Universidad Simón Bolívar
- 🔐 网络安全作品集 | SOC 分析师培训中
- 📍 哥伦比亚巴兰基亚
- 📧 javiernarvaez499@gmail.com
- 💼 [LinkedIn](https://www.linkedin.com/in/javier-narvaez-913ba5241/)
- 🐙 [GitHub](https://github.com/Javier-NarvaezZ)
为网络安全社区用 💙 构建
标签:CTI, DNS 反向解析, Metaprompt, Suricata, Wazuh, x64dbg, 入侵检测系统, 安全合规, 安全数据湖, 现代安全运营, 网络代理, 自动化响应