sanawar-imran-securityengineer/Ai-powered-Threat-Detection-and-incident-Response

GitHub: sanawar-imran-securityengineer/Ai-powered-Threat-Detection-and-incident-Response

该项目通过 Shuffle SOAR 将 Wazuh 告警检测、外部威胁情报富化、TheHive 案件管理和 Discord 实时通知整合为一个自动化的事件响应工作流,帮助 SOC 团队减少手动操作并加快安全事件的处置速度。

Stars: 0 | Forks: 0

# 🚀 SOAR-Flow

## 📌 项目描述 本项目演示了如何将 **Shuffle SOAR** 与 **Wazuh SIEM** 及 **TheHive** 进行集成,以实现事件响应的自动化。 - ✅ 接收来自 Wazuh 的安全告警 - ✅ 使用外部威胁情报(VirusTotal、AbuseIPDB)丰富告警信息 - ✅ 在 TheHive 中创建事件,用于案件管理 - ✅ 向 Discord 频道发送通知 - ✅ (附加)自动威胁缓解(例如,拦截恶意 IP) 通过实现此 SOAR 工作流,您可以自动化安全运营,缩短响应时间,并提升 SOC 环境下的工作效率。 ## 🔧 所用工具 | Logo | 工具 | 描述 | |:---:|------|-------------| | | **Wazuh SIEM** | 用于威胁检测的安全信息与事件管理 (SIEM) 解决方案 | | | **TheHive** | 开源的安全事件响应平台 (SIRP) | | | **Shuffle** | 开源的安全编排、自动化与响应 (SOAR) 平台 | | | **VirusTotal API** | 用于恶意软件和 URL 信誉检查 | | | **AbuseIPDB API** | 用于检查 IP 地址是否为恶意地址 | | | **Discord Webhook** | 向 Discord 频道发送告警以实现实时监控 | ## 🛠️ 安装与设置 ### 虚拟机 1 — Wazuh 与 TheHive **规格要求** - 内存:12GB+ - 硬盘:60GB+ - 操作系统:Ubuntu 24.04 LTS #### 1️⃣ 安装 Wazuh SIEM 请遵循官方指南:[Wazuh 安装指南](https://documentation.wazuh.com/current/installation-guide/index.html) ``` # 更新和升级 apt-get update && apt-get upgrade # 安装 Wazuh 4.10 curl -sO https://packages.wazuh.com/4.10/wazuh-install.sh && sudo bash ./wazuh-install.sh -a # 提取 Wazuh 凭据 sudo tar -xvf wazuh-install-files.tar ``` **Wazuh Dashboard 凭据:** - 用户名:`admin` - 密码:`***************` *(在安装过程中生成)* 访问 Dashboard 的地址:`https://` #### 2️⃣ 安装 TheHive 请遵循官方指南:[TheHive 安装指南](https://docs.thehive-project.org/thehive/installation-and-configuration/) **安装依赖项:** ``` apt install wget gnupg apt-transport-https git ca-certificates ca-certificates-java curl software-properties-common python3-pip lsb-release ``` **安装 Java:** ``` wget -qO- https://apt.corretto.aws/corretto.key | sudo gpg --dearmor -o /usr/share/keyrings/corretto.gpg echo "deb [signed-by=/usr/share/keyrings/corretto.gpg] https://apt.corretto.aws stable main" | sudo tee -a /etc/apt/sources.list.d/corretto.sources.list sudo apt update sudo apt install java-common java-11-amazon-corretto-jdk echo JAVA_HOME="/usr/lib/jvm/java-11-amazon-corretto" | sudo tee -a /etc/environment export JAVA_HOME="/usr/lib/jvm/java-11-amazon-corretto" ``` **安装 Cassandra:** ``` wget -qO - https://downloads.apache.org/cassandra/KEYS | sudo gpg --dearmor -o /usr/share/keyrings/cassandra-archive.gpg echo "deb [signed-by=/usr/share/keyrings/cassandra-archive.gpg] https://debian.cassandra.apache.org 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list sudo apt update sudo apt install cassandra ``` **安装 ElasticSearch:** ``` wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg sudo apt-get install apt-transport-https echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list sudo apt update sudo apt install elasticsearch ``` **安装 TheHive:** ``` wget -O- https://archives.strangebee.com/keys/strangebee.gpg | sudo gpg --dearmor -o /usr/share/keyrings/strangebee-archive-keyring.gpg echo 'deb [signed-by=/usr/share/keyrings/strangebee-archive-keyring.gpg] https://deb.strangebee.com thehive-5.2 main' | sudo tee -a /etc/apt/sources.list.d/strangebee.list sudo apt-get update sudo apt-get install -y thehive ``` **TheHive 默认凭据:** - 端口:`9000` - 登录账号:`admin@thehive.local` - 密码:`secret` ### 虚拟机 2 — Shuffle **规格要求** - 内存:4GB+ - 硬盘:40GB+ - 操作系统:Ubuntu 24.04 LTS #### 3️⃣ 安装 Shuffle SOAR 请遵循官方指南:[Shuffle 安装指南](https://shuffler.io/docs/installation) ``` # 如果尚未安装 Docker 则进行安装 sudo apt update && sudo apt install -y docker.io docker-compose # 启用并启动 Docker sudo systemctl enable docker sudo systemctl start docker # 克隆 Shuffle 仓库 git clone https://github.com/Shuffle/Shuffle.git cd Shuffle # 使用 Docker Compose 构建并运行 Shuffle sudo docker-compose up -d ``` 访问 Shuffle Web UI 的地址:`http://:3001` #### 4️⃣ 创建 Discord Webhook 1. 进入您的 Discord 服务器 → **设置 → 集成 → Webhooks** 2. 点击 **新建 Webhook** → 将其命名为 `SOC Alerts` 3. 复制 Webhook URL(之后会用到) ## ⚙️ TheHive 配置 ### 配置 Cassandra 编辑配置文件: ``` nano /etc/cassandra/cassandra.yaml ``` 更新以下值: ``` cluster_name: 'SOAR-Flow' listen_address: rpc_address: seeds: ":7000" ``` 重启 Cassandra: ``` systemctl stop cassandra.service rm -rf /var/lib/cassandra/* systemctl start cassandra.service ``` ### 配置 ElasticSearch 编辑配置文件: ``` nano /etc/elasticsearch/elasticsearch.yml ``` 更新以下值: ``` cluster.name: thehive node.name: node-1 network.host: http.port: 9200 discovery.seed_hosts: ["127.0.0.1"] cluster.initial_master_nodes: ["node-1"] ``` 启动 ElasticSearch: ``` systemctl start elasticsearch systemctl enable elasticsearch systemctl status elasticsearch ``` ### 配置 TheHive 确保拥有正确的所有权: ``` ls -la /opt/thp chown -R thehive:thehive /opt/thp ``` 编辑配置文件: ``` nano /etc/thehive/application.conf ``` 更新数据库和索引配置: ``` db.janusgraph { storage { backend = cql hostname = [""] cql { cluster-name = SOAR-Flow keyspace = thehive } } } index.search { backend = elasticsearch hostname = [""] index-name = thehive } application.baseUrl = "http://:9000" ``` 启动 TheHive: ``` systemctl start thehive systemctl enable thehive systemctl status thehive ``` ## 🔄 工作流 — 实现事件响应自动化 ### 📌 工作流概述 此工作流利用 Shuffle 实现事件响应的自动化: 1️⃣ 当检测到可疑活动时,接收来自 Wazuh SIEM 的告警 2️⃣ 使用 VirusTotal 和 AbuseIPDB API 丰富告警信息 3️⃣ 在 TheHive 中创建事件,用于案件追踪 4️⃣ 向 Discord 发送包含告警详情的通知 5️⃣ *(可选)* 执行自动缓解措施(例如,拦截恶意 IP) ### 📌 Shuffle 工作流步骤 **🔹 步骤 1:添加 Wazuh 告警作为触发器** - 在 Shuffle 中创建一个新的工作流,并添加一个 **Webhook** 触发器 - 配置 Wazuh 通过 Webhook 发送告警 **🔹 步骤 2:使用 VirusTotal 和 AbuseIPDB 丰富数据** - 添加一个 **HTTP Request** 节点,使用 VirusTotal API 检查 IP/哈希值 - 添加另一个 **HTTP Request** 节点,查询 AbuseIPDB 以识别恶意 IP **🔹 步骤 3:在 TheHive 中创建事件** - 使用 TheHive API 创建一个包含告警详情的新案件 **🔹 步骤 4:向 Discord 发送告警** - 使用 Discord Webhook 向 SOC 频道发送格式化消息 **🔹 步骤 5:(可选)自动缓解** - 如果 IP 风险较高,则触发防火墙规则以拦截攻击者 ## 🚀 运行工作流 ### 步骤 1:配置 Wazuh 向 Shuffle 发送告警 编辑 Wazuh 的 `ossec.conf` 文件以发送 Webhook 告警: ``` custom-webhook http://:5001/webhook json ``` 重启 Wazuh 以应用更改: ``` sudo systemctl restart wazuh-manager ``` ### 步骤 2:配置 TheHive API 密钥 在 TheHive 中生成一个 API 密钥,并将其添加到 Shuffle 的 HTTP Request 节点中。 ### 步骤 3:在 Shuffle 中配置 Discord Webhook 在 Shuffle 的 HTTP Request 节点中使用 Discord Webhook URL。示例 payload: ``` { "content": "🚨 New Security Alert 🚨\n\nIP: 192.168.1.100\nSeverity: High\nSource: Wazuh SIEM" } ``` ### 步骤 4:测试工作流 1. 在 Wazuh 中触发一个告警(例如,SSH 登录失败) 2. 验证 TheHive 中是否已创建事件 3. 检查告警是否已发送至 Discord ## 📌 示例输出 **✅ TheHive 事件已创建:** ``` [INFO] New Incident Created in TheHive: Title: Suspicious SSH Login Attempts Severity: High Source: Wazuh SIEM ``` **✅ Discord 告警:** ## 🎯 未来增强功能 - 🔹 添加自动缓解措施(例如,通过防火墙规则拦截攻击者 IP) - 🔹 集成更多威胁情报源(例如,MISP、Shodan API) - 🔹 扩展自动化以处理不同类型的事件 ## 📜 许可证 本项目基于 **MIT License** 授权。
标签:FTP漏洞扫描, JS文件枚举, SIEM集成, SOAR, 威胁情报, 安全编排, 安全运营, 开发者工具, 扫描框架, 版权保护, 网络信息收集, 自动化响应, 请求拦截, 逆向工具