FCortezSecurity/azure-attack-lab

GitHub: FCortezSecurity/azure-attack-lab

一个 Azure AD 攻击模拟实验室,通过复现完整云攻击链来检测和评估 Sentinel 的安全监控能力与盲区。

Stars: 0 | Forks: 0

# Azure 对抗模拟与检测 Pipeline ![Azure](https://img.shields.io/badge/Azure-Cloud-blue) ![Python](https://img.shields.io/badge/Python-3.x-green) ![MITRE ATT&CK](https://img.shields.io/badge/MITRE-ATT%26CK-red) ![Sentinel](https://img.shields.io/badge/Microsoft-Sentinel-blue) ## 事件摘要 **事件 ID:** INC-2026-0522-001 **分类:** 机密 **严重性:** 严重 **状态:** 模拟 — 已控制 一次源自单一 IP 的协调凭证攻击针对某 Azure 租户发起,从密码喷洒发展到 OAuth token 窃取、Service Principal 滥用、数据渗出以及持久化后门部署——所有这些均被 Microsoft Sentinel 检测到并由 Claude AI 进行了分析。 ## 攻击架构 ## [攻击者] │ ├── 1. 密码喷洒 → Entra ID (victim-user) │ ├── 2. 设备代码钓鱼 → OAuth Token 窃取 │ ├── 3. Service Principal 滥用 → 订阅枚举 │ ├── 4. 数据渗出 │ ├── 公开 Blob 存储 (员工 PII) │ └── Key Vault 机密转储 (DatabasePassword) │ └── 5. 持久化 → Automation Runbook 后门 ## MITRE ATT&CK TTPs | 技术 ID | 名称 | 阶段 | |---|---|---| | T1110.003 | Password Spraying (密码喷洒) | 初始访问 | | T1528 | 窃取应用程序访问 Token | 凭证访问 | | T1087.004 | 云账户枚举 | 发现 | | T1530 | 来自云存储的数据 | 渗出 | | T1552.001 | 文件中的凭证 (Key Vault) | 凭证访问 | | T1078.004 | 有效的云账户 | 持久化 | | T1098 | 账户操纵 (Runbook) | 持久化 | ## 构建的易受攻击基础设施 | 资源 | 类型 | 配置错误 | |---|---|---| | vulnstorage2026 | 存储账户 | 启用了公开 Blob 访问 | | vulnkeyvault2026 | Key Vault | 普通用户具有机密读取权限 | | vuln-automation | Automation 账户 | Runbook 持久化机制 | | svc-account | 用户 | 订阅范围的 Contributor | | victim-user | 用户 | 弱密码,无 MFA | ## 检测结果 ### Sentinel 捕获的内容 - ✅ 登录失败尝试 (Error 50126) — 检测到密码喷洒 - ✅ 密码喷洒后的成功认证 - ✅ Key Vault SecretList 和 SecretGet 操作 - ✅ 机密访问前的认证失败 ### 发现的检测盲区 - ❌ 默认情况下未对设备代码钓鱼流程发出警报 - ❌ 如果没有 Defender for Storage,则不会标记公开的 Blob 访问 - ❌ Automation Runbook 的创建未与攻击链相关联 ## 技术栈 | 层级 | 工具 | |---|---| | 云平台 | Microsoft Azure (免费层) | | 身份验证 | Microsoft Entra ID | | SIEM | Microsoft Sentinel | | 日志分析 | KQL 查询 | | 攻击工具 | Python, MSAL, Azure CLI | | AI 丰富化 | Claude API (claude-opus-4-5) | | 操作系统 | Arch Linux + BlackArch | ## 关键文件 | 文件 | 描述 | |---|---| | `password_spray.py` | 针对 Entra ID 的密码喷洒 | | `device_code.py` | 通过设备代码流程窃取 OAuth token | | `sp_abuse.py` | Service Principal 枚举 | | `exfiltrate.py` | 存储和 Key Vault 渗出 | | `persistence.py` | Automation Runbook 后门 | | `azure_threat_pipeline.py` | Claude AI 丰富化 pipeline | | `incident_report.html` | AI 生成的事件报告 | | `incident_report.pdf` | 事件报告的 PDF 版本 | ## 截图 | 截图 | 描述 | |---|---| | `screenshots/01_password_spray.png` | 密码喷洒 — 3 次失败后成功 | | `screenshots/02_token_capture.png` | 设备代码 OAuth token 已捕获 | | `screenshots/03_sp_enumeration.png` | 所有订阅资源暴露 | | `screenshots/04_exfiltration.png` | PII 和凭证已转储 | | `screenshots/05_persistence.png` | 后门 Runbook 已部署 | | `screenshots/06_sentinel_signins.png` | KQL 检测 — 登录异常 | | `screenshots/07_sentinel_keyvault.png` | KQL 检测 — 机密访问 | | `screenshots/08_sentinel_connectors.png` | 9 个数据连接器处于活动状态 | | `screenshots/09_resource_group.png` | vuln-rg 中的所有实验室资源 | | `screenshots/10_incident_report.png` | Claude 生成的事件报告 | ## 如何复现 1. 创建一个免费的 Azure 账户 2. Clone 此仓库 3. 按照每个脚本中分阶段的设置进行操作 4. 设置 `ANTHROPIC_API_KEY` 环境变量 5. 按顺序运行脚本:spray → device_code → sp_abuse → exfiltrate → persistence → pipeline ## 作者 **Fernando Cortez** — [@cpt-ferna02](https://github.com/cpt-ferna02)xdg-open ~/azure-attack-lab/incident_report.htmlxdg-open ~/azure-attack-lab/incident_report.htmlxdg-open ~/azure-attack-lab/incident_report.htmlxdg-open ~/azure-attack-lab/incident_report.html│
标签:Azure, PB级数据处理, PFX证书, 安全助手, 安全运维, 攻击检测, 红队模拟, 网络安全, 逆向工具, 隐私保护