Aaditya-Mohanty/AI-Driven-Threat-Hunting-with-Wazuh-and-Llama-3

GitHub: Aaditya-Mohanty/AI-Driven-Threat-Hunting-with-Wazuh-and-Llama-3

利用 Llama 3 大语言模型自动对 Wazuh SIEM 告警进行智能分诊,帮助一线分析师快速识别误报并聚焦真实威胁。

Stars: 1 | Forks: 0

# 使用 Wazuh 和 Llama 3 进行 AI 驱动的威胁狩猎 ## 📖 概述 本项目利用人工智能自动化了 Tier 1 安全运营中心 (SOC) 分析师的分诊流程 [1]。它提取由开源 Wazuh SIEM [9] 生成的安全告警,对其进行处理,并安全地查询 Meta 的 **Llama 3** 大语言模型(通过 Groq 的高速 API),以评估该告警是潜在的安全事件还是常规的误报 [3, 5, 6]。 该项目还实现了现代的**“规则即代码”** DevOps 工作流,自动将每日分诊报告推送到 GitHub,以持续记录威胁狩猎活动 [8]。 ## ✨ 核心功能 * **自动化 SIEM 告警分诊:**自动解析由 Wazuh 生成的 `alert.json` 文件 [10]。 * **AI 分析师集成:**使用自定义的 SOC prompt 评估告警,通过过滤良性异常来减少人为的“告警疲劳” [7, 11]。 * **高速推理:**连接到 Groq 的语言处理单元 (LPU) API,以接近瞬间的速度运行 `llama-3.3-70b-versatile` 模型 [3]。 * **规则即代码 自动化:**利用 Python 的 `subprocess` 模块自动暂存、提交每日的安全发现并将其推送到此代码库 [8]。 ## 🔬 学术灵感 本项目深受近期关于使用 LLM agent 进行 SOC Tier 1 分诊的学术研究的启发。在严格的测试中,Llama 3 架构在对 Wazuh 告警进行分类时展现出了最高的整体准确率 (91.4%),证明了其作为可靠的 SOC “副驾驶”的可行性 [1, 12]。 ## 🛠️ 前置条件 要在本地运行此脚本,您需要: * 已安装 Python 3.x * 一个免费的 [Groq API Key](https://console.groq.com/) [13] * 一个包含 Wazuh 告警的示例 `alert.json` 文件 [10] ## 🚀 安装与设置 **1. 克隆代码库:** ``` git clone https://github.com/YourUsername/Your-Repo-Name.git cd Your-Repo-Name 2. Install dependencies: The script requires the requests and python-dotenv libraries to securely manage API keys and network requests. pip install requests python-dotenv 3. Configure your API Key: Create a .env file in the root directory and securely add your Groq API key: AI_API_KEY="gsk_your_groq_api_key_here" 4. Run the AI Triage Agent: python triage.py 🧠 Example AI Output When the script runs, the AI Analyst outputs its decision in a standardized, industry-recognized format : === AI SOC Analyst Decision === alert_id: 1716460351.2348 alert_description: New wazuh agent connected alert_decision: Not-Interesting reason: The alert is indicating that a new Wazuh agent has connected, which is a normal and expected event in a monitored environment. The level of the rule is 3, which is typically considered informational, and the full log message "Agent started" suggests that this is a routine connection event rather than a potential security incident. Therefore, this alert does not require further investigation. =============================== 🔮 Future Development Potential expansions for this project include: Automated Remediation: Connecting the AI's output back to Wazuh's Active Response module to automatically block malicious IPs or terminate suspicious processes. Cyber Threat Intelligence (CTI) Integration: Cross-referencing alert hashes and IP addresses with platforms like VirusTotal or OpenCTI before making a decision. ```
标签:AI安全分析师, AI辅助安全, DevSecOps, DLL 劫持, GitHub自动化, Groq API, JSON解析, Llama 3, LLM, Python, RaC, Rego, Ruleset as Code, SOAR, Sysdig, Tier 1 自动化, Unmanaged PE, Wazuh, 上游代理, 人工智能, 告警分诊, 告警研判, 大语言模型, 安全报告, 安全日志分析, 安全规则即代码, 安全运营中心, 数字取证, 无后门, 用户模式Hook绕过, 网络安全, 网络安全研究, 网络映射, 自动化脚本, 误报过滤, 逆向工具, 隐私保护