TFT444/RetailShield

GitHub: TFT444/RetailShield

Stars: 1 | Forks: 0

# RetailShield v1.0 — 作者 Tanvir Farhad, ShieldTech Ltd # RetailShield [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/05/b2815d0dea051034.svg)](https://github.com/TFT444/RetailShield/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![Azure Sentinel](https://img.shields.io/badge/SIEM-Azure%20Sentinel-0078D4?logo=microsoftazure)](https://azure.microsoft.com/en-gb/products/microsoft-sentinel) [![MITRE ATT&CK](https://img.shields.io/badge/Framework-MITRE%20ATT%26CK-red)](https://attack.mitre.org/) [![Built With KQL](https://img.shields.io/badge/Language-KQL-orange)](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/) [![Python](https://img.shields.io/badge/Python-3.11%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/) [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/) [![Status](https://img.shields.io/badge/Status-In%20Development-yellow)]() [![Author](https://img.shields.io/badge/Author-Tamim%20%7C%20ShieldTech%20Ltd-informational)]() ## 目录 1. [问题陈述](#problem-statement) 2. [架构](#architecture) 3. [MITRE ATT&CK 映射](#mitre-attck-mapping) 4. [功能](#features) 5. [文件夹结构](#folder-structure) 6. [快速开始](#quick-start) 7. [贡献](#contributing) 8. [作者](#author) 9. [许可证](#license) ## 问题陈述 零售业是英国乃至全球遭受数据泄露攻击最多的行业。其后果不再仅仅是声誉损失——它们关乎企业存亡。 | 事件 | 组织 | 影响 | |---|---|---| | 供应链勒索软件 (2025) | Marks & Spencer | **3亿英镑** 营业利润损失;在线销售暂停数周 | | 数据窃取 (2018) | Nike (经第三方) | **1.4 TB** 客户与知识产权数据泄露 | | 销售点恶意软件 | 多家英国零售商 | 数百万支付卡信息泄露 | | 内部威胁与欺诈 | 零售业平均 | 每名员工每年损失超过1,000英镑 (CIFAS 2024) | 零售商面临独特的攻击面:分散的 POS 网络、季节性劳动力高峰、庞大的第三方供应商生态系统,以及掩盖恶意活动的高容量交易数据。通用的 SIEM 规则缺乏零售行业特定的上下文,导致警报疲劳。 **RetailShield** 弥补了这一差距——它专为零售行业 TTP 打造了定制化检测逻辑,自动化 Logic App 剧本可在数秒内响应,并提供一个仪表板,使 SOC 分析师能够立即获得态势感知,而不至于被海量噪音淹没。 ## 架构 ``` ┌─────────────────────────────────────────────────┐ │ RETAIL DATA SOURCES │ │ POS Systems │ ERP/SAP │ IAM │ Cloud Apps │ EDR │ └───────────────────────┬─────────────────────────┘ │ Log Ingestion ▼ ┌─────────────────────────────────────────────────┐ │ MICROSOFT SENTINEL (SIEM) │ │ │ │ ┌─────────────────┐ ┌─────────────────────┐ │ │ │ Data Connectors│ │ Analytics Rules │ │ │ │ (CEF / Syslog │──▶│ (KQL — Retail │ │ │ │ / REST API) │ │ TTPs mapped to │ │ │ └─────────────────┘ │ MITRE ATT&CK) │ │ │ └──────────┬──────────┘ │ │ │ Alert │ │ ┌──────────▼──────────┐ │ │ │ Incident Engine │ │ │ │ (Fusion + ML UEBA) │ │ │ └──────────┬──────────┘ │ └───────────────────────────────────┼────────────┘ │ Trigger ┌───────────────────────────────────▼────────────┐ │ AZURE LOGIC APPS (SOAR) │ │ │ │ ┌──────────────┐ ┌──────────┐ ┌──────────┐ │ │ │ Triage & │ │ Enrich │ │Containment│ │ │ │ Classify │─▶│ (Threat │─▶│(Block IP /│ │ │ │ Playbook │ │ Intel) │ │Disable AD)│ │ │ └──────────────┘ └──────────┘ └──────────┘ │ │ │ │ ┌──────────────┐ ┌──────────────────────────┐│ │ │ Notify SOC │ │ Create Ticket (JIRA / ││ │ │ (Teams/PD) │ │ ServiceNow) ││ │ └──────────────┘ └──────────────────────────┘│ └───────────────────────────────────┬────────────┘ │ Status / Metrics ┌───────────────────────────────────▼────────────┐ │ RETAILSHIELD DASHBOARD (React) │ │ │ │ Live Incident Feed │ TTP Heatmap │ KPIs │ │ Analyst Workbench │ Alert Drill-Down │ └─────────────────────────────────────────────────┘ ``` ## MITRE ATT&CK 映射 本项目中的检测规则映射到以下 MITRE ATT&CK (企业) 技术,并根据零售业威胁态势进行了优先级排序。 | 策略 | 技术 ID | 技术名称 | 检测规则 | 剧本 | |---|---|---|---|---| | 初始访问 | T1566.001 | 鱼叉式网络钓鱼附件 | `phishing-email-attachment.kql` | `phishing-triage.json` | | 初始访问 | T1190 | 利用面向公众的应用程序 | `web-exploit-attempt.kql` | `web-block-ip.json` | | 执行 | T1059.001 | PowerShell | `suspicious-powershell.kql` | `isolate-endpoint.json` | | 持久化 | T1078 | 有效账户 (凭证滥用) | `brute-force-login.kql` | `disable-account.json` | | 持久化 | T1136 | 创建账户 | `new-admin-account.kql` | `notify-soc.json` | | 权限提升 | T1068 | 为权限提升而利用漏洞 | `priv-esc-attempt.kql` | `isolate-endpoint.json` | | 防御规避 | T1562.001 | 禁用或修改工具 | `av-disabled.kql` | `notify-soc.json` | | 凭证访问 | T1110 | 暴力破解 | `brute-force-login.kql` | `disable-account.json` | | 发现 | T1046 | 网络服务扫描 | `internal-port-scan.kql` | `notify-soc.json` | | 横向移动 | T1021.001 | 远程桌面协议 | `rdp-lateral-movement.kql` | `isolate-endpoint.json` | | 收集 | T1005 | 来自本地系统的数据 | `bulk-file-access.kql` | `data-exfil-contain.json` | | 数据窃取 | T1041 | 通过 C2 通道窃取数据 | `c2-beacon.kql` | `block-c2-ip.json` | | 数据窃取 | T1048 | 通过替代协议窃取数据 | `dns-exfil.kql` | `data-exfil-contain.json` | | 影响 | T1486 | 为影响而加密数据 (勒索软件) | `ransomware-indicator.kql` | `ransomware-response.json` | | 影响 | T1485 | 数据销毁 | `mass-delete-activity.kql` | `isolate-endpoint.json` | ## 功能 | 功能 | 描述 | 状态 | |---|---|---| | **零售优化的 KQL 规则** | 15+ 条检测规则预先映射到 MITRE ATT&CK,针对 POS、ERP 和 IAM 日志模式校准 | 计划中 | | **自动化分诊剧本** | Logic App 工作流,可在无分析师干预的情况下丰富、分类和分配事件 | 计划中 | | **遏制自动化** | 一键式与自动触发:阻止 IP、禁用 AD 账户、通过 Defender 隔离主机 | 计划中 | | **威胁情报丰富** | 自动查询 Microsoft TI、VirusTotal 和 AbuseIPDB 以获取 IOC 信息 | 计划中 | | **SOAR 通知层** | 即时向 Microsoft Teams 频道和 PagerDuty 发送警报,包含完整事件上下文 | 计划中 | | **实时 SOC 仪表板** | 使用 Sentinel API 的 React + TypeScript 前端;事件源、TTP 热图、分析师 KPI | 计划中 | | **JIRA / ServiceNow 集成** | 自动创建工单,包含优先级、负责人及关联证据 | 计划中 | | **单元与集成测试** | KQL 规则验证、剧本模式检查和前端组件测试 | 计划中 | | **CI/CD 流水线** | GitHub Actions:合并到主分支时进行 lint 检查、测试和部署 Sentinel 工件 | 计划中 | | **完善的文档** | 架构决策记录、运行手册和入门指南 | 计划中 | ## 文件夹结构 ``` RetailShield/ ├── .github/ │ └── workflows/ │ └── ci.yml # GitHub Actions CI pipeline (lint, test, deploy) │ ├── detection-rules/ │ ├── brute-force-login.kql # T1110 — Brute Force credential attacks │ ├── ransomware-indicator.kql # T1486 — Ransomware staging indicators │ ├── bulk-file-access.kql # T1005 — Unusual bulk data access │ ├── c2-beacon.kql # T1041 — C2 beaconing over HTTP/S │ ├── dns-exfil.kql # T1048 — DNS-based data exfiltration │ ├── suspicious-powershell.kql # T1059.001 — Obfuscated PowerShell │ ├── rdp-lateral-movement.kql # T1021.001 — RDP lateral movement │ └── README.md │ ├── logic-apps/ │ ├── triage-classify/ │ │ └── workflow.json # Auto-triage and severity classification │ ├── threat-intel-enrich/ │ │ └── workflow.json # IOC enrichment (VT, AbuseIPDB, MSFT TI) │ ├── containment/ │ │ └── workflow.json # Block IP / Disable AD / Isolate host │ └── README.md │ ├── playbooks/ │ ├── phishing-triage.md # Analyst runbook — phishing incidents │ ├── ransomware-response.md # Analyst runbook — ransomware response │ ├── data-exfil-contain.md # Analyst runbook — data exfiltration │ ├── insider-threat.md # Analyst runbook — insider threat │ └── README.md │ ├── frontend/ │ ├── public/ │ ├── src/ │ │ ├── components/ │ │ ├── pages/ │ │ ├── hooks/ │ │ └── api/ │ ├── package.json │ └── README.md │ ├── sentinel/ │ ├── workbooks/ │ │ └── retailshield-workbook.json # Sentinel Workbook ARM template │ ├── data-connectors/ │ │ └── connectors.json │ ├── watchlists/ │ │ └── retail-ioc-watchlist.csv │ └── README.md │ ├── docs/ │ ├── architecture.md # Full architecture decision record │ ├── threat-model.md # Retail threat model and assumptions │ ├── onboarding.md # New analyst / developer onboarding │ ├── mitre-mapping.md # Full MITRE ATT&CK coverage matrix │ └── README.md │ ├── tests/ │ ├── detection-rules/ │ │ └── test_kql_rules.py # KQL rule syntax and logic validation │ ├── playbooks/ │ │ └── test_playbook_schema.py # Logic App JSON schema tests │ ├── frontend/ │ │ └── dashboard.test.tsx # React component unit tests │ └── README.md │ └── README.md # This file ``` ## 快速开始 ### 前置条件 | 要求 | 版本 | |---|---| | Azure 订阅 | 有效的,具有 Sentinel 工作区 | | Python | 3.11+ | | Node.js | 18+ | | Azure CLI | 最新版本 | | Git | 2.40+ | ### 1. 克隆仓库 ``` git clone https://github.com/tft444/retailshield.git cd retailshield git checkout dev ``` ### 2. 部署检测规则到 Sentinel ``` # Install dependencies pip install -r requirements.txt # Authenticate with Azure az login az account set --subscription "" # Deploy all KQL analytics rules python scripts/deploy_rules.py \ --workspace-name "" \ --resource-group "" ``` ### 3. 部署 Logic App 剧本 ``` # Deploy all SOAR playbooks via ARM template az deployment group create \ --resource-group "" \ --template-file logic-apps/triage-classify/workflow.json \ --parameters workspaceName="" ``` ### 4. 本地运行 SOC 仪表板 ``` cd frontend npm install npm run dev # Dashboard available at http://localhost:5173 ``` ### 5. 运行测试 ``` # Python tests (KQL validation + playbook schema) pytest tests/ -v # Frontend tests cd frontend && npm test ``` ## 作者 **Tamim** 安全工程师 — [ShieldTech Ltd](https://shieldtech.co.uk), 伦敦 ## 许可证 [MIT](LICENSE) © 2025 Tamim — ShieldTech Ltd
标签:自定义脚本