OnlineUnknowns/Critical-Core-Secure-OT-ICS
GitHub: OnlineUnknowns/Critical-Core-Secure-OT-ICS
面向核设施、电网等关键基础设施的 OT/ICS 网络安全防御平台,提供工控协议深度检测、行为异常分析与零信任资产管理能力。
Stars: 2 | Forks: 0
```
██████╗██████╗ ██╗████████╗██╗ ██████╗ █████╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗
██╔════╝██╔══██╗██║╚══██╔══╝██║██╔════╝██╔══██╗██║ ██╔════╝██╔═══██╗██╔══██╗██╔════╝
██║ ██████╔╝██║ ██║ ██║██║ ███████║██║ ██║ ██║ ██║██████╔╝█████╗
██║ ██╔══██╗██║ ██║ ██║██║ ██╔══██║██║ ██║ ██║ ██║██╔══██╗██╔══╝
╚██████╗██║ ██║██║ ██║ ██║╚██████╗██║ ██║███████╗╚██████╗╚██████╔╝██║ ██║███████╗
╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
███████╗███████╗ ██████╗██╗ ██╗██████╗ ███████╗
██╔════╝██╔════╝██╔════╝██║ ██║██╔══██╗██╔════╝
███████╗█████╗ ██║ ██║ ██║██████╔╝█████╗
╚════██║██╔══╝ ██║ ██║ ██║██╔══██╗██╔══╝
███████║███████╗╚██████╗╚██████╔╝██║ ██║███████╗
╚══════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
```
**工业关键基础设施防御平台**
[](https://python.org)
[](https://isocpp.org)
[](https://docker.com)
[](LICENSE)
[]()
[]()
[]()
[]()
## 🛡️ 任务概述
**CriticalCoreSecure** 是一个生产级、多层的网络安全平台,专为地球上要求最苛刻的运营环境而设计。该平台专为**核设施**、**军事设施**、**电网**和**工业控制系统 (ICS/SCADA)** 设计,提供持续的网络可见性、实时威胁检测、行为异常分析和自动化防御响应——所有这些都不会影响正常运行时间。
CriticalCoreSecure 采用**零信任架构**和**纵深防御**方法论构建,将每个数据包、设备和用户视为不受信任的实体,直到经过加密验证。
## 🏗️ 系统架构
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ CRITICALCORESECURE PLATFORM │
│ Defense-in-Depth Architecture │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ MANAGEMENT LAYER (Zone 0) │ │
│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────────┐ │ │
│ │ │ Flask SIEM │ │ Audit Logger │ │ Threat Intelligence DB │ │ │
│ │ │ Dashboard │ │ Engine │ │ (PostgreSQL/SQLite) │ │ │
│ │ └──────────────┘ └──────────────┘ └──────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ ▲ │
│ ▼ │ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ DETECTION LAYER (Zone 1) │ │
│ │ ┌───────────────┐ ┌──────────────────┐ ┌────────────────────────┐ │ │
│ │ │ Anomaly │ │ Signature-Based │ │ Behavioral Analytics │ │ │
│ │ │ Detector │ │ IDS Engine │ │ + Event Correlation │ │ │
│ │ └───────────────┘ └──────────────────┘ └────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ ▲ │
│ ▼ │ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ CAPTURE LAYER (Zone 2) │ │
│ │ ┌────────────────────────┐ ┌────────────────────────────────┐ │ │
│ │ │ C++ Packet Engine │ │ Protocol Parsers │ │ │
│ │ │ (DPI / High-Perf) │ │ Modbus | DNP3 | OPC-UA │ │ │
│ │ └────────────────────────┘ └────────────────────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │ ▲ │
│ ▼ │ │
│ ┌─────────────────────────────────────────────────────────────────────┐ │
│ │ OPERATIONAL NETWORK (Zone 3 - ICS/OT) │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │ │
│ │ │ PLCs │ │ RTUs │ │ HMIs │ │ Field Sensors │ │ │
│ │ │ Modbus │ │ DNP3 │ │ OPC-UA │ │ & Actuators │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────────────┘ │ │
│ └─────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
```
## 🌐 网络分段架构
```
INTERNET / EXTERNAL THREAT SURFACE
│
▼
╔═══════════════════════════════╗
║ PERIMETER FIREWALL ║
║ (Stateful + Deep Inspection) ║
╚═══════════════════════════════╝
│
┌─────────────────────────────┼──────────────────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌──────────────────┐
│ DMZ ZONE │ │ CORPORATE IT │ │ MANAGEMENT │
│ (Zone 5) │ │ ZONE (Zone 4) │ │ ZONE (Zone 0) │
│ │ │ │ │ │
│ Web Servers │ │ Active Dir │ │ SIEM Dashboard │
│ Email Gateway │ │ File Servers │ │ Config Mgmt │
│ DNS/NTP │ │ Workstations │ │ Audit Systems │
└────────┬────────┘ └────────┬────────┘ └────────┬─────────┘
│ │ │
└───────────────────────────┼──────────────────────────────┘
▼
╔══════════════════════════════╗
║ INTERNAL DATA DIODE / ║
║ UNIDIRECTIONAL GATEWAY ║
╚══════════════════════════════╝
│
┌──────────────────────────┼─────────────────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ CONTROL ZONE │ │ SUPERVISION │ │ SAFETY ZONE │
│ (Zone 2) │ │ ZONE (Zone 1) │ │ (Zone S - SIS) │
│ │ │ │ │ │
│ Engineering │ │ SCADA Servers │ │ Safety PLCs │
│ Workstations │ │ Historian │ │ Emergency Stop │
│ PLCs/RTUs │ │ HMI Clusters │ │ SIS Controllers │
└────────┬────────┘ └────────┬─────────┘ └────────┬─────────┘
│ │ │
└─────────────────────────┼────────────────────────────┘
▼
╔══════════════════════════════╗
║ FIELD DEVICE ZONE ║
║ (Zone 3) ║
╚══════════════════════════════╝
│
┌─────────────────────────┼──────────────────────────────┐
▼ ▼ ▼
┌────────────────┐ ┌──────────────────┐ ┌────────────────────┐
│ Sensors & │ │ Actuators & │ │ Embedded │
│ Transmitters │ │ Control Valves │ │ Controllers │
│ (Modbus/DNP3) │ │ (4-20mA/HART) │ │ (OPC-UA/Profibus) │
└────────────────┘ └──────────────────┘ └────────────────────┘
```
## 🔒 零信任架构
```
╔══════════════════════════════════════════════════════════════════════════════╗
║ ZERO TRUST ENFORCEMENT MODEL ║
║ "Never Trust, Always Verify, Assume Breach" ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ ║
║ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ║
║ │ ASSET │ │ IDENTITY │ │ NETWORK │ │ DATA │ ║
║ │ TRUST │ │ VERIF. │ │ MICRO- │ │ POLICY │ ║
║ │ │ │ │ │ SEG. │ │ │ ║
║ │ ● Device │ │ ● MFA │ │ ● Zones │ │ ● Encrypt│ ║
║ │ Cert │ │ ● PKI │ │ ● ACLs │ │ all │ ║
║ │ ● Integ │ │ ● Tokens │ │ ● VLANs │ │ ● Label │ ║
║ │ Check │ │ ● RBAC │ │ ● Flows │ │ class │ ║
║ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ ║
║ │ │ │ │ ║
║ └───────────────┴───────────────┴───────────────┘ ║
║ │ ║
║ ▼ ║
║ ┌────────────────────────────────┐ ║
║ │ POLICY DECISION POINT │ ║
║ │ (Continuous Evaluation Engine) │ ║
║ └────────────────┬───────────────┘ ║
║ │ ║
║ ┌────────────────┴───────────────┐ ║
║ │ │ ║
║ ▼ ▼ ║
║ ┌──────────────────────┐ ┌──────────────────────────┐ ║
║ │ ACCESS GRANTED │ │ ACCESS DENIED │ ║
║ │ (Least Privilege) │ │ + Alert Generated │ ║
║ │ + Session Monitor │ │ + Incident Logged │ ║
║ └──────────────────────┘ └──────────────────────────┘ ║
╚══════════════════════════════════════════════════════════════════════════════╝
```
## 📡 ICS 协议通信流程
```
FIELD DEVICES PROTOCOL LAYER MONITORING LAYER
───────────── ────────────── ────────────────
┌─────────────┐ ┌────────────────┐ ┌─────────────────┐
│ Modbus PLC │──TCP/502──────▶│ Modbus Parser │──────▶│ Packet Monitor │
│ RTU Device │ │ (FC01-FC23) │ │ (DPI Engine) │
└─────────────┘ └────────────────┘ └────────┬────────┘
│
┌─────────────┐ ┌────────────────┐ │
│ DNP3 Master│──TCP/20000─── ▶│ DNP3 Parser │──────────────── ┤
│ Outstation │ │ (Classes 0-3) │ │
└─────────────┘ └────────────────┘ │
│
┌─────────────┐ ┌────────────────┐ │
│ OPC-UA │──TCP/4840─────▶│ OPC-UA Analyzer│──────────────── ┤
│ Server │ │ (Namespace/Node)│ │
└─────────────┘ └────────────────┘ │
▼
┌─────────────────────┐
│ ANOMALY DETECTOR │
│ ───────────────── │
│ • Baseline Compare │
│ • ML Scoring │
│ • Rate Analysis │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ THREAT ANALYZER │
│ ───────────────── │
│ • Rule Matching │
│ • MITRE ATT&CK/ICS │
│ • CVE Correlation │
└──────────┬──────────┘
│
┌──────────▼──────────┐
│ ALERT MANAGER │
│ ───────────────── │
│ Critical / High │
│ Medium / Low │
└─────────────────────┘
```
## 🔍 威胁检测生命周期
```
DETECT ANALYZE CORRELATE RESPOND RECOVER
───────── ───────── ───────── ───────── ─────────
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
│ Packet │ │Signature│ │ Event │ │ Auto- │ │Forensic │
│ Capture │─────▶│ Match │────▶│ Cluster │────▶│ Block │────▶│ Storage │
│ (DPI) │ │ Engine │ │ Engine │ │ Policy │ │ Engine │
└────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘
│ │ │ │ │
┌────▼────┐ ┌────▼────┐ ┌────▼────┐ ┌────▼────┐ ┌────▼────┐
│Protocol │ │Anomaly │ │MITRE │ │Incident │ │Timeline │
│ Parser │ │ Score │ │ATT&CK │ │ Ticket │ │Rebuild │
│Validator│ │ (0-100) │ │Mapping │ │Created │ │Analysis │
└────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘
│ │ │ │ │
└────────────────┴───────────────┴───────────────┴───────────────┘
│
┌─────────▼─────────┐
│ SIEM DASHBOARD │
│ (Flask + SQLite) │
└───────────────────┘
```
## 🚨 事件响应流程
```
INCIDENT DETECTED
│
┌────────────▼────────────┐
│ Severity Assessment │
│ CRITICAL / HIGH / │
│ MEDIUM / LOW / INFO │
└────────────┬────────────┘
│
┌──────────────────────┼──────────────────────┐
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌──────────────┐
│ CRITICAL │ │ HIGH │ │ MEDIUM/LOW │
│ │ │ │ │ │
│ ● Isolate │ │ ● Alert SOC │ │ ● Log Event │
│ Segment │ │ ● Block IP │ │ ● Monitor │
│ ● Page Team │ │ ● Snapshot │ │ ● Baseline │
│ ● Preserve │ │ Memory │ │ Update │
│ Evidence │ │ ● Escalate │ │ │
└──────┬──────┘ └──────┬──────┘ └──────┬───────┘
│ │ │
└─────────────────────┼───────────────────────┘
▼
┌───────────────────────┐
│ FORENSIC COLLECTION │
│ ● PCAP Capture │
│ ● Log Preservation │
│ ● Memory Dump │
│ ● Chain of Custody │
└───────────┬───────────┘
▼
┌───────────────────────┐
│ RECOVERY & HARDENING │
│ ● Root Cause Report │
│ ● Rule Update │
│ ● Patch Management │
│ ● Lesson Learned Doc │
└───────────────────────┘
```
## 🏛️ 资产信任模型
```
ASSET TRUST HIERARCHY
══════════════════════
TRUST LEVEL 5 TRUST LEVEL 4 TRUST LEVEL 3
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ VERIFIED │ │ APPROVED │ │ MONITORED │
│ CRITICAL │ │ SECONDARY │ │ STANDARD │
│ │ │ │ │ │
│ Safety PLC │ │ SCADA Host │ │ Workstation │
│ SIS Control │ │ Historian │ │ Network Sw │
│ Nuke Ctrl │ │ Engineering │ │ Printers │
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Cert-Based │ │ Token-Based │ │ Password │
│ Mutual TLS │ │ Auth │ │ + MFA │
│ Hardware │ │ + Cert │ │ │
│ Attestation │ │ │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
TRUST LEVEL 2 TRUST LEVEL 1 TRUST LEVEL 0
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ PROBATION │ │ UNTRUSTED │ │ BLOCKED │
│ REVIEW │ │ QUARANTINE │ │ HOSTILE │
│ │ │ │ │ │
│ New Device │ │ Unknown MAC │ │ Blacklisted │
│ Temp Access │ │ No Cert │ │ Attacker IP │
│ Read-Only │ │ Isolated │ │ Rogue Device│
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ 30-Day │ │ Alert SOC │ │ Drop All │
│ Monitoring │ │ Quarantine │ │ Packets │
│ + Review │ │ VLAN │ │ Log + Alert │
└─────────────┘ └─────────────┘ └─────────────┘
```
## 📁 项目结构
```
CriticalCoreSecure/
│
├── 📂 core/ # Core security engine
│ ├── 🐍 main.py # Platform orchestrator & entry point
│ ├── 🐍 packet_monitor.py # Network traffic capture & DPI
│ ├── 🐍 anomaly_detector.py # ML-based behavioral analysis
│ ├── 🐍 threat_analyzer.py # Threat intelligence & correlation
│ ├── 🐍 asset_validator.py # Device fingerprinting & trust mgmt
│ └── 📂 engine_cpp/ # High-performance C++ modules
│ ├── ⚙️ packet_engine.cpp # Raw packet processing engine
│ ├── ⚙️ protocol_parser.cpp # ICS protocol parsers (Modbus/DNP3/OPC-UA)
│ └── ⚙️ intrusion_detector.cpp# Signature-based IDS engine
│
├── 📂 dashboard/ # SIEM web interface
│ ├── 🐍 app.py # Flask application & API routes
│ ├── 📂 templates/ # Jinja2 HTML templates
│ │ ├── 🌐 base.html # Base layout template
│ │ ├── 🌐 index.html # Live threat dashboard
│ │ ├── 🌐 alerts.html # Alert management
│ │ ├── 🌐 assets.html # Asset inventory & health
│ │ └── 🌐 logs.html # Forensic log viewer
│ └── 📂 static/ # Frontend assets
│ ├── 📂 css/ # Styles
│ └── 📂 js/ # Dashboard scripts
│
├── 📂 configs/ # Security configuration
│ ├── 📋 security_rules.yaml # IDS signatures & detection rules
│ ├── 📋 zones.yaml # Network zone definitions
│ └── 📋 assets.yaml # Asset registry & trust levels
│
├── 📂 docs/ # Technical documentation
│ ├── 📄 architecture.md # System architecture deep-dive
│ ├── 📄 threat_model.md # MITRE ATT&CK/ICS threat model
│ └── 📄 network_map.md # Network topology documentation
│
├── 📂 deployment/ # Infrastructure as Code
│ ├── 🐳 Dockerfile # Container build spec
│ ├── 🐳 docker-compose.yml # Multi-container orchestration
│ └── 🔧 install.sh # Bare-metal install script
│
├── 📂 tests/ # Security test suite
│ ├── 🧪 test_packet_monitor.py
│ ├── 🧪 test_anomaly_detector.py
│ ├── 🧪 test_threat_analyzer.py
│ └── 🧪 test_asset_validator.py
│
├── 📋 requirements.txt # Python dependencies
├── 📄 LICENSE # MIT License
└── 📖 README.md # This file
```
## ⚡ 快速入门
### 前置条件
```
# 系统要求
OS: Ubuntu 22.04 LTS / Debian 12 (Recommended)
RAM: 8GB minimum, 16GB recommended
CPU: 4 cores minimum (x86_64)
Storage: 50GB minimum
Network: Promiscuous mode NIC for capture
```
### Docker 部署(推荐)
```
# 1. Clone 仓库
git clone https://github.com/your-org/CriticalCoreSecure.git
cd CriticalCoreSecure
# 2. 配置环境
cp configs/assets.yaml.example configs/assets.yaml
cp configs/zones.yaml.example configs/zones.yaml
# 编辑 configs 以匹配您的网络拓扑
# 3. 使用 Docker Compose 部署
docker-compose up -d
# 4. 访问 dashboard
open http://localhost:5000
# 默认凭据:admin / changeme (请立即修改)
```
### 裸机安装
```
# 以 root 身份运行安装脚本
sudo chmod +x deployment/install.sh
sudo ./deployment/install.sh
# 启动平台
sudo systemctl start criticalcore
sudo systemctl enable criticalcore
# 查看日志
journalctl -u criticalcore -f
```
### 手动 Python 设置
```
# 创建隔离的虚拟环境
python3 -m venv venv
source venv/bin/activate
# 安装依赖项
pip install -r requirements.txt
# 初始化数据库
python3 core/main.py --init-db
# 使用您的网络接口启动
sudo python3 core/main.py --interface eth0 --config configs/security_rules.yaml
# 单独启动 dashboard
python3 dashboard/app.py --port 5000 --host 0.0.0.0
```
## 🔧 配置
### 网络区域 (`configs/zones.yaml`)
```
zones:
- id: 0
name: "Management Zone"
cidr: "10.0.0.0/24"
trust_level: high
- id: 3
name: "ICS/OT Field Zone"
cidr: "192.168.100.0/24"
trust_level: critical
protocols: [modbus, dnp3, opcua]
```
### 安全规则 (`configs/security_rules.yaml`)
```
rules:
- id: "ICS-001"
name: "Unauthorized Modbus Write"
protocol: modbus
function_codes: [5, 6, 15, 16]
severity: critical
action: alert_and_log
```
## 📊 使用示例
### 监控指定接口
```
sudo python3 core/main.py \
--interface eth1 \
--protocols modbus,dnp3 \
--alert-level high \
--log-file /var/log/criticalcore/monitor.log
```
### 仅运行异常检测
```
python3 core/anomaly_detector.py \
--input-pcap captures/traffic.pcap \
--baseline configs/baseline.json \
--threshold 0.85
```
### 验证资产清单
```
python3 core/asset_validator.py \
--scan-network 192.168.100.0/24 \
--compare configs/assets.yaml \
--alert-new-devices
```
### API 访问
```
# 获取活动警报
curl http://localhost:5000/api/alerts?severity=critical
# 获取资产状态
curl http://localhost:5000/api/assets
# 触发手动扫描
curl -X POST http://localhost:5000/api/scan \
-H "Authorization: Bearer
**为防御者而生。为前线而加固。**
`[ ICS ] [ SCADA ] [ OT ] [ Nuclear ] [ Military ] [ Zero Trust ] [ Defense-in-Depth ]`
标签:AWS, DPI, ICS安全, OT安全, PKINIT, SCADA安全, 军事基础设施防护, 工业协议监控, 工业控制系统, 工控协议分析, 工控安全, 工控网络防护, 异常检测, 核设施防护, 测试用例, 深度包检测, 网络安全, 网络安全分析, 请求拦截, 逆向工具, 防御系统, 隐私保护, 零信任架构