SizweMarole-21389/blue-team-soc-lab

GitHub: SizweMarole-21389/blue-team-soc-lab

基于 AWS EC2 搭建的蓝队 SOC 实战实验室,使用 Splunk 检测模拟攻击并提供完整的检测规则、自动化脚本和事件响应文档。

Stars: 0 | Forks: 0

# 蓝队 SOC 实验室 ![Splunk](https://img.shields.io/badge/Splunk-10.2-black?style=for-the-badge&logo=splunk&logoColor=white) ![AWS](https://img.shields.io/badge/AWS-EC2-orange?style=for-the-badge&logo=amazonaws&logoColor=white) ![Kali Linux](https://img.shields.io/badge/Kali_Linux-Attacker-blue?style=for-the-badge&logo=kalilinux&logoColor=white) ![Ubuntu](https://img.shields.io/badge/Ubuntu-24.04-E95420?style=for-the-badge&logo=ubuntu&logoColor=white) ![Wireshark](https://img.shields.io/badge/Wireshark-PCAP-1679A7?style=for-the-badge&logo=wireshark&logoColor=white) ![Python](https://img.shields.io/badge/Python-3.x-3776AB?style=for-the-badge&logo=python&logoColor=white) ![MITRE ATT&CK](https://img.shields.io/badge/MITRE_ATT%26CK-Mapped-red?style=for-the-badge) ![Status](https://img.shields.io/badge/Status-Active-brightgreen?style=for-the-badge) ## 目录 - [项目概述](#project-overview) - [实验室架构](#lab-architecture) - [使用的工具](#tools-used) - [项目](#projects) - [MITRE ATT&CK 覆盖范围](#mitre-attck-coverage) - [检测规则](#detection-rules) - [如何复现此实验室](#how-to-replicate-the-lab) - [联系方式](#contact) ## 项目概述 本仓库记录了我完全在 AWS EC2 上构建的一个实战蓝队安全运营中心 (SOC) 实验室。其目标是模拟真实世界的攻击场景,使用 Splunk Enterprise 检测它们,并实践从日志收集到创建告警和事件响应的完整分析师工作流程。 我设计此实验室是为了培养并展示可直接应用于初级 SOC 分析师职位的实用技能。本仓库中的每一次检测均已通过 Splunk 的实时结果确认,并包含了所有支持脚本和检测规则。 该实验室涵盖以下攻击类别: - SSH 暴力破解攻击(使用 Kali Linux 上的 Hydra 进行模拟) - 网络侦察(Nmap 端口和服务扫描) - 网络钓鱼电子邮件分析和 IOC 提取 - 数据包捕获和网络取证(tcpdump 和 Wireshark) - 持久化和权限提升(auditd 监控) - 使用自定义 Splunk 查询进行威胁狩猎 - SOC 仪表板构建 - 完整的事件响应报告撰写 ## 实验室架构 ``` +--------------------------------------------------+ | AWS af-south-1 | | (Africa / Cape Town) | | | | +--------------------+ +-------------------+ | | | Splunk Enterprise | | Victim Machine | | | | 10.2.0 | | Ubuntu 24.04 | | | | | | | | | | 15.240.43.62:8000 |<--| 13.246.220.248 | | | | t3.medium | | ip-172-31-3-95 | | | | Ubuntu Server | | Splunk UF running | | | +--------------------+ | auditd enabled | | | +-------------------+ | | ^ | +--------------------------------------------------+ | SSH brute force Nmap recon Persistence sim | +--------------------------------+ | Attacker Machine | | Kali Linux | | Hydra, Nmap, tcpdump, | | custom phishing scripts | +--------------------------------+ ``` **数据流向:** ``` Victim Logs (/var/log/auth.log, /var/log/audit/audit.log) | v Splunk Universal Forwarder | v Splunk Enterprise (Indexer + Search Head) | v Detection Rules --> Alerts --> Incident Response ``` ## 使用的工具 | 工具 | 用途 | 版本 | |------|---------|---------| | Splunk Enterprise | SIEM, 日志分析, 告警 | 10.2.0 | | Splunk Universal Forwarder | 从受害主机发送日志至 Splunk | 9.1.x | | AWS EC2 | 云基础设施 | af-south-1 区域 | | Kali Linux | 攻击者模拟 | Rolling | | Hydra | SSH 暴力破解模拟 | 9.x | | Nmap | 网络侦察模拟 | 7.x | | auditd | Linux 系统调用审计 | 3.x | | tcpdump | 数据包捕获 | 4.x | | Wireshark | PCAP 分析 | 4.x | | Python 3 | 脚本编写与 IOC 提取 | 3.x | ## 项目 | # | 项目 | 技术 | MITRE ID | |---|---------|-----------|----------| | 01 | [SSH 暴力破解检测](projects/01-brute-force-detection/README.md) | 通过 SSH 进行凭据暴力破解 | T1110.001 | | 02 | [Nmap 侦察检测](projects/02-nmap-recon-detection/README.md) | 主动网络扫描 | T1046 | | 03 | [钓鱼邮件分析](projects/03-phishing-analysis/README.md) | 鱼叉式网络钓鱼, IOC 提取 | T1566.001 | | 04 | [PCAP 网络取证](projects/04-pcap-network-forensics/README.md) | 网络流量分析 | T1040 | | 05 | [威胁狩猎](projects/05-threat-hunting/README.md) | 持久化和权限提升 | T1053.003, T1136 | | 06 | [SOC 仪表板](projects/06-soc-dashboard/README.md) | 在 Splunk 中构建仪表板 | N/A | | 07 | [事件响应报告](projects/07-incident-response-report/README.md) | 完整的 IR 文档 | N/A | ## MITRE ATT&CK 覆盖范围 | 战术 | 技术 | ID | 检测方法 | |--------|-----------|-----|-----------------| | 侦察 | 网络服务扫描 | T1046 | 针对 syslog/auth.log 的 Splunk 查询 | | 凭据访问 | 暴力破解:密码猜测 | T1110.001 | auth.log 中的失败密码激增 | | 初始访问 | 鱼叉式网络钓鱼附件 | T1566.001 | 手动 IOC 分析 | | 持久化 | 计划任务/作业:Cron | T1053.003 | auditd + Splunk 告警 | | 持久化 | 创建账户 | T1136 | auditd user_modification 规则 | | 权限提升 | 滥用提权控制 | T1548 | auditd privilege_escalation 规则 | | 发现 | 网络嗅探 | T1040 | tcpdump PCAP 分析 | | 数据窃取 | 通过 C2 通道进行数据窃取 | T1041 | PCAP 和连接日志分析 | ## 检测规则 所有 Splunk 检测规则均存储在 [detection-rules/](detection-rules/) 目录中: - [brute-force-alert.spl](detection-rules/brute-force-alert.spl) - 通过计算每个源 IP 的失败登录次数来检测 SSH 暴力破解 - [recon-detection.spl](detection-rules/recon-detection.spl) - 检测 syslog 中的 Nmap 扫描模式 - [persistence-detection.spl](detection-rules/persistence-detection.spl) - 通过 auditd 检测持久化和权限提升 ## 如何复现此实验室 ### 前置条件 - AWS 账户(免费套餐即可用于受害主机;Splunk 至少需要 t3.medium) - Kali Linux(本地虚拟机或独立的 EC2 实例) - 基本的 Linux 命令行经验 ### 步骤 1 - 启动 EC2 实例 1. 登录 AWS 控制台,并导航至 **af-south-1**(非洲开普敦)区域的 EC2。 2. 为 Splunk Enterprise 启动一个 **t3.medium** Ubuntu 22.04 实例。 3. 启动一个 **t2.micro** Ubuntu 24.04 实例作为受害主机。 4. 开放入站安全组规则: - Splunk:端口 8000(Web UI),端口 9997(接收 Forwarder 数据) - 受害主机:端口 22(SSH) ### 步骤 2 - 安装 Splunk Enterprise ``` # 下载 Splunk Enterprise (从 splunk.com 获取链接) wget -O splunk.deb 'https://download.splunk.com/products/splunk/releases/10.2.0/linux/splunk-10.2.0-amd64.deb' sudo dpkg -i splunk.deb sudo /opt/splunk/bin/splunk start --accept-license sudo /opt/splunk/bin/splunk enable boot-start ``` ### 步骤 3 - 设置 Splunk Universal Forwarder 在受害主机上运行设置脚本: ``` chmod +x scripts/setup-splunk-forwarder.sh sudo ./scripts/setup-splunk-forwarder.sh ``` 有关完整详细信息,请参见 [scripts/setup-splunk-forwarder.sh](scripts/setup-splunk-forwarder.sh)。 ### 步骤 4 - 在受害主机上启用 auditd ``` chmod +x scripts/threat-hunting-rules.sh sudo ./scripts/threat-hunting-rules.sh ``` ### 步骤 5 - 运行攻击模拟 ``` # 来自 Kali 的 SSH 暴力破解 chmod +x scripts/brute-force-simulation.sh ./scripts/brute-force-simulation.sh # 来自 Kali 的 Nmap 侦察 nmap -sV -sS ``` ### 步骤 6 - 将检测规则导入 Splunk 将 [detection-rules/](detection-rules/) 目录中的 SPL 查询复制到 Splunk Search 中,并将每条查询保存为告警。 ## 联系方式 **Sizwe Marole** 初级 SOC 分析师 | 蓝队安全爱好者 - GitHub: [SizweMarole-21389](https://github.com/SizweMarole-21389) - 电子邮件: marolesizwe1@gmail.com - LinkedIn: www.linkedin.com/in/sizwemarole - 位置: 南非 *此实验室完全出于学习和作品集展示的目的而构建。所有的攻击模拟均在我拥有和控制的隔离 AWS 环境中进行。*
标签:AWS EC2, Cloudflare, CTI, Hydra, IOCs提取, MITRE ATT&CK, Nmap, PCAP取证, PoC, Python, SOC实验室, SSH暴力破解, Wireshark, 句柄查看, 安全分析师, 安全检测规则, 安全运营中心, 插件系统, 无后门, 暴力破解, 端点安全, 网络安全, 网络映射, 虚拟驱动器, 蜜罐, 补丁管理, 证书利用, 逆向工具, 钓鱼分析, 隐私保护