alpha0490/aws-cloudtrail-attack-detections

GitHub: alpha0490/aws-cloudtrail-attack-detections

基于 Sigma 格式的 AWS CloudTrail 威胁检测规则库,将 MITRE ATT&CK 云矩阵映射到 CloudTrail 事件,并附带事件响应备忘单、多 SIEM 预置查询与覆盖率矩阵。

Stars: 1 | Forks: 0

# AWS CloudTrail × MITRE ATT&CK 检测 使用 **Sigma** 编写的 **AWS CloudTrail** 检测规则 —— 一次编写,可在任何 SIEM 上运行 —— 此外还提供了一份 事件响应人员的 **备忘单**,将 [MITRE ATT&CK](https://attack.mitre.org/) Cloud / IaaS (AWS) 矩阵映射到 CloudTrail 中的可疑活动。 [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/288dc059d2092449.svg)](https://github.com/alpha0490/aws-cloudtrail-attack-detections/actions/workflows/sigma-validate.yml) ![Stratus 覆盖率](https://img.shields.io/badge/Stratus%20coverage-25%2F25%20tested-brightgreen) [![许可证:Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) ![Sigma](https://img.shields.io/badge/format-Sigma-green.svg) ![CloudTrail](https://img.shields.io/badge/log%20source-AWS%20CloudTrail-orange.svg) ## 快速开始 - **事件响应人员** —— “`eventName=X` 是什么意思,我该检查哪些字段?” → [备忘单](cheatsheet/README.md)。 - **检测工程师** —— 从 [`dist/`](dist/) 中获取可直接粘贴到你的 SIEM 的查询(CrowdStrike LogScale、KQL、Splunk、Elastic),或者自己[转换 Sigma 规则](#converting-rules-to-your-siem)。 - **一目了然的覆盖率** —— [记分卡](docs/coverage-scorecard.md)和 [ATT&CK Navigator 层](docs/attack-navigator-layer.json)。 - **查看针对真实攻击的检测** —— [威胁映射](docs/threat-mapping.md)(Capital One、Scattered Spider 等)。 - **使用 AI 构建检测** —— 让你的助手参考 [`detections.json`](detections.json) + [`docs/using-with-ai.md`](docs/using-with-ai.md)。 ## 这是什么 - **110+ 条 Sigma 规则** (`logsource: { product: aws, service: cloudtrail }`) 横跨 **11 种 ATT&CK 战术**:Initial Access、Execution、Persistence、Privilege Escalation、Defense Evasion、 Credential Access、Discovery、Lateral Movement、Collection、Exfiltration、Impact。 - 一份供事件响应人员使用的 **Markdown 备忘单** ([`cheatsheet/README.md`](cheatsheet/README.md)):按战术分类的表格,说明*事件的含义*以及*需要检查哪些字段*。 - 一个**覆盖矩阵** ([`docs/mitre-matrix.md`](docs/mitre-matrix.md)),显示已覆盖的 技术和已知缺口(标记为 TODO),一个 [ATT&CK Navigator 热力图](docs/attack-navigator-layer.json), 以及一张映射到 Stratus 的[覆盖率记分卡](docs/coverage-scorecard.md)。 - 针对 CrowdStrike LogScale、KQL、Splunk 和 Elastic 的**预置查询** ([`dist/`](dist/)) —— 无需 sigma-cli。 - 一份**基于威胁情报的映射** ([`docs/threat-mapping.md`](docs/threat-mapping.md)),将真实的 AWS 入侵事件(Capital One、Scattered Spider、Code Spaces、SCARLETEEL 等)与捕获每个阶段的规则联系起来。 - 一个**机器可读目录** ([`detections.json`](detections.json)),供工具和 AI 助手使用。 检测依赖于 CloudTrail 的 `eventName` / `eventSource` 以及相关的 `requestParameters.*` / `responseElements.*` / `userIdentity.*` 字段。 ## 适用对象 | 受众 | 从这里开始 | |---|---| | **事件响应人员** —— “我看到 `eventName=X`,这糟糕吗?” | [`cheatsheet/README.md`](cheatsheet/README.md) | | **检测工程师** —— “给我一些可以部署/转换的规则” | [`rules/`](rules/) + [转换为你的 SIEM](#converting-rules-to-your-siem) | | **任何审查覆盖率的人** | [`docs/mitre-matrix.md`](docs/mitre-matrix.md) | ## 仓库布局 ``` . ├── cheatsheet/README.md # IR cheatsheet, tables by ATT&CK tactic ├── rules/ # Sigma rules, one folder per tactic │ ├── initial-access/ execution/ persistence/ privilege-escalation/ │ ├── defense-evasion/ credential-access/ discovery/ lateral-movement/ │ └── collection/ exfiltration/ impact/ ├── dist/ # pre-built queries: CrowdStrike LogScale, KQL, Splunk, Elastic ES|QL ├── detections.json # machine-readable catalog of every rule (for tooling / AI) ├── docs/ │ ├── mitre-matrix.md # ATT&CK Cloud (IaaS) coverage matrix + TODO gaps │ ├── coverage-scorecard.md # Stratus-mapped tested-coverage scorecard (+ badge) │ ├── attack-navigator-layer.json # ATT&CK Navigator heatmap (colored by tier) │ ├── threat-mapping.md # real AWS attacks (Capital One, Scattered Spider…) → these rules │ ├── validation-with-stratus.md # validate detections against Stratus Red Team attacks │ ├── enrichment-and-baselining.md # IP allow/threat lists + 90d behavioral baseline (Sumo) │ ├── sumologic-quickstart.md # beginner's guide: build these as Sumo alerts, step by step │ └── using-with-ai.md # point an AI assistant at the repo to generate tuned detections ├── lookups/ # IP allowlist + CrowdStrike threatlist (CSV) for the enrichment layer ├── tests/ # logic tests: true-positive / benign CloudTrail events per rule ├── scripts/ # generators: build_docs / build_dist / build_navigator / build_scorecard / build_catalog ├── .github/workflows/ # CI: sigma check + logic tests + docs/navigator/scorecard/catalog in-sync ├── CHANGELOG.md CONTRIBUTING.md └── LICENSE # Apache-2.0 ``` ## 为什么是 Sigma? [Sigma](https://github.com/SigmaHQ/sigma) 是一种通用的、基于 YAML 的检测格式,它 **人类和机器均可读取**,并且**能编译为大多数 SIEM**(Sumo Logic、Splunk、 Elastic、Microsoft Sentinel 等),通过 [`sigma-cli`](https://github.com/SigmaHQ/sigma-cli) / [pySigma](https://github.com/SigmaHQ/pySigma) 实现。一次编写检测规则;随处部署。它 也是人类或 AI 生成新的自定义检测规则的便利、结构化基础。 ## 前期工作与本项目差异 在这个领域已经有一些非常出色且成熟的项目 —— 你应该了解它们,我们站在巨人的肩膀上,而不是假装要取代它们: | 项目 | 是什么 | 此处的关系 | |---|---|---| | [SigmaHQ `rules/cloud/aws/cloudtrail`](https://github.com/SigmaHQ/sigma) | 规范的、经过社区审查的 Sigma 规则集,包括 AWS CloudTrail | 相同的格式。如果规则有重叠,请将 SigmaHQ 视为上游;本仓库旨在成为一个**按战术组织、面向 IR** 的配套项目,而不是竞争对手。鼓励向上游贡献高质量的规则。 | | [Elastic detection-rules](https://github.com/elastic/detection-rules) | Elastic 的生产级规则 + 优秀的测试模型 | 本仓库**测试框架**的灵感来源;基线文档为 Elastic 用户指出的正是 Elastic 原生的 `new_terms` 规则类型。 | | [Splunk Security Content (ESCU)](https://github.com/splunk/security_content) | Splunk 针对 AWS 等的分析故事 | Splunk 特有的;本仓库保持厂商中立,并编译*到* Splunk。 | | [Stratus Red Team](https://stratus-red-team.cloud/) (Datadog) | Cloud **攻击模拟** | 补充检测 —— 引爆某种技术,确认规则是否触发。参见 [`docs/validation-with-stratus.md`](docs/validation-with-stratus.md)。 | | [panther-analysis](https://github.com/panther-labs/panther-analysis), [Falco](https://falco.org/) | 基于 Python 的云规则 / runtime 检测 | 不同的引擎/范围(runtime、Python)。在此不在范围之内。 | **本仓库新增了上述项目未捆绑在一起的内容:** 1. 一份**战术优先的 IR 备忘单**,将 CloudTrail 事件 → 含义 → 要检查的字段进行映射(响应工作流,而不仅仅是规则)。 2. 明确的**部署级别**划分(`alert` 与 `hunt`),因此它不是一堵毫无区分的规则墙。 3. 一个有文档记录的 **Sumo Logic enrichment + 90 天基线**层(IP 白名单/威胁列表、首次出现的新颖性、角色扮演标准化),用于包装无状态规则。 4. **诚实面对 AWS 的尖锐边缘**(例如 `PassRole` 不是 CloudTrail 事件;数据事件的注意事项),而不是默默尽力而为。 5. 一种旨在**提供给 AI** 以生成特定环境检测的结构。 如果你只想部署一样东西,请部署 SigmaHQ 审查过的规则;将本项目用于 IR 工作流、 分层/enrichment 模型,以及作为学习 + AI 辅助的基础。 ## 将规则转换为你的 SIEM **想要无需设置即可复制粘贴的查询?** [`dist/`](dist/) 为每种规则提供了预转换好的 **CrowdStrike LogScale**、**Microsoft KQL (Sentinel)**、**Splunk** 和 **Elastic ES|QL** 版本。获取适合你 SIEM 的文件,并根据你的摄取 schema 调整字段名(参见 [`dist/README.md`](dist/README.md))。 要自行转换,请安装工具链和适用于你平台的后端: ``` pip install sigma-cli sigma plugin list # discover available backends/pipelines sigma plugin install splunk # e.g. Splunk; also: elasticsearch, etc. sigma list targets # show installed backends ``` 转换规则(或整个文件夹): ``` # Splunk SPL sigma convert -t splunk rules/persistence/iam-create-access-key.yml # Elasticsearch (Lucene / ES|QL,取决于 backend) sigma convert -t elasticsearch rules/defense-evasion/ # 无 field-mapping pipeline 的原始查询(按原样使用 CloudTrail 字段名) sigma convert -t splunk --without-pipeline rules/impact/kms-schedule-key-deletion.yml ``` **关于 pipeline:** 大多数后端都需要一个 *processing pipeline*,将 Sigma 字段映射到 你的索引 schema。由于这些规则已经使用了原生的 CloudTrail 字段名 (`eventName`、`userIdentity.arn`、`requestParameters.*` 等),当你的 CloudTrail 数据使用这些字段名存储时,`--without-pipeline` 会生成可用的 查询;否则,请提供一个 映射到你的 schema 的 pipeline(`-p `)。参见 [pySigma pipelines 文档](https://sigmahq-pysigma.readthedocs.io/en/latest/Processing_Pipelines.html)。 ### Sumo Logic Sumo Logic 使用此处使用的标准字段名来摄取 CloudTrail,因此字段映射 可以直接转换。如果你安装了 Sumo 后端,请使用 Sumo 后端进行转换 (`sigma plugin list`),或者使用 `--without-pipeline` 进行转换,并将生成的谓词粘贴到 范围限定为你的 CloudTrail 源类别的 Sumo 搜索中(例如 `_sourceCategory=*cloudtrail*`)。 **不熟悉 Sumo Logic?** [Sumo Logic 快速入门](docs/sumologic-quickstart.md) 指导初学者 在大约 10 分钟内从零开始建立一个可用的告警(翻译 Sigma 规则 → Monitor),然后在此基础上叠加 查找和基线。 ## Enrichment 与行为基线(Sumo Logic) 基础的 Sigma 是无状态的 —— 它无法进行实时的 IP 查找,也无法将事件与数周的历史记录进行比较。 对于希望在这些规则之上实现 **IP 白名单/威胁列表**和 **“90 天内首次出现”行为基线** 的团队,[`docs/enrichment-and-baselining.md`](docs/enrichment-and-baselining.md) 介绍了一个 Sumo Logic 决策层,它包装了每一条规则匹配: - 在 `sourceIPAddress` 上命中 **CrowdStrike 威胁列表** → 始终告警(严重)。 - 过去 90 天内**新出现**的 `(主体 × IP / 操作 / 国家 / 地区 / user-agent)` → 告警(高), *即使来自白名单 IP*。 - **白名单** IP 且行为完全熟悉 → 抑制(受信任,接受风险)。 参考列表位于 [`lookups/`](lookups/) 中。无需更改规则 —— 该层会读取原始的 CloudTrail 字段。 ## 验证规则 分为两层,因为它们捕获的内容不同 —— schema 并不等同于逻辑: ``` pip install sigma-cli pyyaml sigma check rules/ # 1. SCHEMA: every rule well-formed (tags, UUIDs, conditions) python3 tests/run_tests.py # 2. LOGIC: each rule fires on a real attack event, not on a benign one ``` 所有规则都通过了 `sigma check`,**0 个错误和 0 个问题**,并且逻辑测试断言每个覆盖的规则都会匹配真阳性 CloudTrail 事件并忽略良性事件(参见 [`tests/`](tests/))。CI 会在每次推送/PR 时运行这两者 —— 参见 [`.github/workflows/sigma-validate.yml`](.github/workflows/sigma-validate.yml)。 有关针对**真实模拟攻击**的端到端验证,请参见 [使用 Stratus Red Team 进行验证](docs/validation-with-stratus.md) —— 引爆一种技术,确认 规则是否在其产生的 CloudTrail 事件上触发。 ## 重要的 CloudTrail 注意事项 - **数据事件默认是关闭的。** 针对对象/项目级活动(S3 `GetObject`、 `DeleteObject`、KMS `Decrypt`、Lambda `Invoke`)的规则只有在启用了相关的 **CloudTrail 数据事件**时才会触发。此类规则已作标注。 - **某些“事件”并不是 CloudTrail 事件。** 例如,`iam:PassRole` 是嵌入在其他调用(例如 `RunInstances`)中的授权 检查,而不是独立的 `eventName`;并且 GuardDuty 发现结果(如 `SharedSnapshotCopyInitiated`)不是 CloudTrail 事件。在 参考资料存在歧义或错误的地方,规则会明确指出,而不是盲目猜测。 - **阈值/关联逻辑**(暴力破解、密码喷洒、枚举突发)使用 Sigma [关联规则](https://sigmahq.io/docs/meta/correlations.html) 来表示。基础 Sigma 无法表达的字段间 比较(例如“为*不同*用户创建的 access key”)在规则描述中已作标记,以便你在后端实现。 ## 许可证 根据 **[Apache License 2.0](LICENSE)** 获得许可 —— 通过 OSI 批准,被广泛理解,并且它 在一个宽松的许可证下涵盖了文档、规则和脚本。你可以使用、修改和 重新分发(包括商业用途),但需注明出处。 ## 致谢 - [MITRE ATT&CK](https://attack.mitre.org/) —— 本项目映射所对应的 Cloud / IaaS 矩阵。 - [SigmaHQ](https://github.com/SigmaHQ) —— Sigma 格式和工具。 - [Stratus Red Team](https://stratus-red-team.cloud/) 和更广泛的云安全社区 记录了 AWS 攻击技术。
标签:AMSI绕过, AWS, DPI, Reconnaissance, Sigma规则, 威胁检测, 安全运营, 扫描框架, 目标导入