raghav-marda/cyber-sentinel-cni

GitHub: raghav-marda/cyber-sentinel-cni

面向关键基础设施的AI驱动网络安全弹性平台,通过行为异常检测和MITRE ATT&CK威胁归因来应对隐蔽网络攻击。

Stars: 0 | Forks: 0

# 🛡️ Cyber Sentinel CNI **面向关键国家基础设施的 AI 驱动网络弹性** ![Status](https://img.shields.io/badge/status-in%20development-yellow) ![Hackathon](https://img.shields.io/badge/ET%20AI%20Hackathon-2026-blue) ![Problem Statement](https://img.shields.io/badge/PS-7-orange) ![Python](https://img.shields.io/badge/python-3.10%2B-blue) ![License](https://img.shields.io/badge/license-Hackathon%20Prototype-lightgrey) 为 **ET AI Hackathon 2026 — 问题陈述 7** 个人独立开发。 ## 📋 目录 - [概述](#-overview) - [架构](#-architecture) - [模块与进度](#-modules--progress) - [核心成果](#-key-results) - [技术栈](#-tech-stack) - [项目结构](#-project-structure) - [快速开始](#-getting-started) - [数据集](#-datasets) - [路线图](#-roadmap) ## 🎯 概述 关键国家基础设施——电网、政府系统、金融网络——面临着蓄意以“低频缓慢”方式运作以逃避基于签名的检测的攻击者。CERT-In 报告称,仅在 2023 年就处理了超过 **159 万起网络安全事件**,其中大多数漏洞在最初被攻破数周或数月后才被发现。 **Cyber Sentinel CNI** 通过一个行为智能层来应对这一问题,该智能层能够: 1. 学习*正常*网络行为的表现——无需攻击签名 2. 实时标记偏差并解释*为什么*它们是可疑的 3. 将标记的行为映射到 **MITRE ATT&CK** 框架,以识别攻击者的技术、可能的下一步动作以及已知的威胁行为者关联 4. 推荐具体的、源自 MITRE 的防御性缓解措施 5. *(进行中)* 编排自动化遏制,确定漏洞优先级,并在数字孪生上模拟攻击路径 ## 🏗️ 架构 ``` ┌─────────────────────────┐ │ Raw Network Traffic │ │ (NSL-KDD / live feed) │ └────────────┬─────────────┘ │ ┌────────────▼─────────────┐ │ MODULE 1 │ │ Behavioural Anomaly │ │ Detection Engine │ │ (Ensemble: Statistical │ │ Z-score + Isolation │ │ Forest) │ └────────────┬─────────────┘ │ flagged anomaly + severity ┌────────────▼─────────────┐ │ Pipeline Bridge │ │ (event → NL description) │ └────────────┬─────────────┘ │ behaviour description ┌────────────▼─────────────┐ │ MODULE 2 │ │ APT Attribution Agent │ │ (Hybrid RAG: TF-IDF + │ │ keyword rules over MITRE │ │ ATT&CK, 697 techniques) │ └────────────┬─────────────┘ │ technique + tactics + threat group ┌────────────▼─────────────┐ │ MODULES 3-5 (in progress) │ │ Incident Response │ │ Orchestrator · Vuln │ │ Prioritization · Digital │ │ Twin │ └────────────┬─────────────┘ │ ┌────────────▼─────────────┐ │ Unified Dashboard │ └───────────────────────────┘ ``` ## 📦 模块与进度 | # | 模块 | 状态 | 深度 | |---|--------|--------|-------| | 1 | **行为异常检测引擎** | ✅ 完成 | 完整的 ML 构建——集成模型,经过严格评估 | | 2 | **APT 活动归因与预测 Agent** | ✅ 完成 | 完整的 RAG 构建——混合检索,经过定量评估 | | 3 | **自治事件响应编排器** | 🔜 进行中 | — | | 4 | **政府基础设施漏洞优先级排序** | ⏳ 已规划 | — | | 5 | **网络弹性数字孪生** | ⏳ 已规划 | — | 有关完整的范围和成功标准,请参阅 [`docs/SCOPE.md`](docs/SCOPE.md)。 ## 📊 核心成果 ### 模块 1——异常检测(在仅含正常流量的基线上训练) | 方法 | Precision | Recall | F1 | ROC-AUC | |---|---|---|---|---| | 统计 Z-score 基线 | 0.851 | 0.858 | 0.854 | 0.894 | | Isolation Forest | 0.974 | 0.648 | 0.778 | 0.939 | | **集成模型(最终模型)** | **0.871** | **0.878** | **0.874** | 0.935 | **按攻击类别的检测率:** | DoS | Probe | R2L | U2R | |---|---|---|---| | 79.3% | 88.3% | 8.6%¹ | 28.4%¹ | ¹ *R2L/U2R 攻击流量小且行为隐蔽——这是 NSL-KDD 研究中一个已知的、有文档记录的挑战。在此透明地将其标记为局限性和未来的改进方向(见[路线图](#-roadmap)),未作隐藏。* **驱动检测的主要特征:** `dst_host_rerror_rate`、`dst_host_srv_rerror_rate`、`count`、`srv_rerror_rate`——均为连接错误和流量模式指标,与预期的攻击行为一致。 ### 模块 2——APT 归因 Agent(基于 MITRE ATT&CK 的 RAG,包含 697 项技术) | 指标 | 得分 | |---|---| | Top-1 检索准确率 | 62.7% | | Top-3 检索准确率 | **96.0%** | | 已索引技术数 | 697 | | 已映射威胁组织数 | 189 | | 关联缓解措施数 | 268 | *(在 150 项预留的技术描述上进行评估——随机猜测的 Top-3 准确率约为 0.4%。)* **示例——多阶段活动重建:** 给定一系列 5 个被标记的异常,该 Agent 正确地重建了杀伤链(**Discovery → Credential Access → Privilege Escalation → Stealth → Exfiltration**),并根据技术重叠度(Jaccard 相似度)对最匹配的已知 APT 组织进行了排名。 完整评估产物:[`anomaly-detection/rigorous_evaluation_summary.json`](anomaly-detection/rigorous_evaluation_summary.json)、[`attribution-agent/attribution_evaluation_summary.json`](attribution-agent/attribution_evaluation_summary.json) ## 🛠️ 技术栈 - **机器学习/数据:** Python、pandas、scikit-learn(Isolation Forest、TF-IDF)、NumPy - **威胁情报:** MITRE ATT&CK STIX 2.1 Enterprise 数据集 - **可视化:** matplotlib、seaborn - **仪表板:** *(已规划)* Streamlit / React - **数据集:** NSL-KDD(网络入侵)、MITRE ATT&CK Enterprise(威胁框架) ## 📁 项目结构 ``` cyber-sentinel-cni/ ├── README.md ├── docs/ │ └── SCOPE.md # Full scope, success criteria, judging alignment ├── data/ │ ├── nsl-kdd/ # NSL-KDD train/test datasets │ └── mitre-cti/ # MITRE ATT&CK Enterprise STIX bundle ├── anomaly-detection/ # Module 1 │ ├── preprocess.py # Data loading + feature encoding │ ├── anomaly_model.py # Isolation Forest + real-time scoring │ ├── advanced_evaluation.py # IF vs LOF comparison, per-category breakdown │ ├── rigorous_evaluation.py # Statistical baseline, ensemble, ROC-AUC, tuning │ └── *.png / *.json # Visualizations + saved metrics ├── attribution-agent/ # Module 2 │ ├── mitre_parser.py # STIX bundle parser │ ├── attribution_agent.py # Hybrid RAG retrieval engine │ ├── pipeline_bridge.py # Connects Module 1 → Module 2 │ ├── rigorous_evaluation.py # Retrieval accuracy + campaign narrative builder │ └── *.json # Evaluation results ├── incident-response-orchestrator/ # Module 3 (in progress) ├── vulnerability-prioritization/ # Module 4 (planned) ├── digital-twin/ # Module 5 (planned) └── frontend/ # Unified dashboard (planned) ``` ## 🚀 快速开始 ``` git clone https://github.com/raghav-marda/cyber-sentinel-cni.git cd cyber-sentinel-cni # Module 1 — 异常检测 cd anomaly-detection pip install pandas scikit-learn numpy matplotlib seaborn joblib python3 preprocess.py # verify data loads correctly python3 anomaly_model.py # train + evaluate model python3 rigorous_evaluation.py # full rigorous evaluation with ensemble # Module 2 — APT 归因 cd ../attribution-agent python3 mitre_parser.py # verify MITRE data parses correctly python3 attribution_agent.py # run example attributions python3 pipeline_bridge.py # test full Module1 -> Module2 pipeline python3 rigorous_evaluation.py # retrieval accuracy + campaign narrative demo ``` ## 💾 数据集 - **[NSL-KDD](https://www.unb.ca/cic/datasets/nsl.html)** —— 带标签的网络入侵数据集(125,973 条训练 / 22,544 条测试记录),是经典 KDD Cup 99 数据集的改进版本 - **[MITRE ATT&CK](https://attack.mitre.org/)** —— Enterprise 矩阵,STIX 2.1 格式:697 个活跃技术、189 个威胁组织、268 项缓解措施、21,000+ 个关系 ## 🗺️ 路线图 - [x] 模块 1:行为异常检测(集成模型,经过严格评估) - [x] 模块 2:APT 归因 Agent(混合 RAG,经过定量评估) - [ ] 模块 3:自治事件响应编排器(基于规则的手册自动化) - [ ] 模块 4:漏洞优先级排序(基于 CVE 的风险排名) - [ ] 模块 5:网络弹性数字孪生(攻击路径模拟面板) - [ ] 集成所有 5 个模块的统一仪表板 - [ ] 通过在带标签子集上进行监督微调来改进 R2L/U2R 检测 - [ ] 将检索从 TF-IDF 升级为语义嵌入(生产环境增强) ## 👤 作者 **Raghav Marda** —— 个人独立开发者,Amity University Mumbai,Google Student Ambassador 2026 *最后更新:构建的第 5 天(详细时间线请参见提交历史)*
标签:Python, 威胁情报, 开发者工具, 异常检测, 数字孪生, 无后门, 网络安全, 自动化响应, 逆向工具, 隐私保护