aristoncandido/Detections

GitHub: aristoncandido/Detections

以真实威胁情报为驱动、经 Atomic Red Team 验证的跨平台检测规则库,将 Sigma 规则转换适配至 Splunk、Elastic 和 Wazuh。

Stars: 1 | Forks: 0

# 🛡️ 检测规则 ### 威胁驱动的检测工程——逐一击破,映射至 MITRE ATT&CK

## 这是什么 这个仓库是我的检测工程实践库。这里的每一条规则都源于一个**真实的威胁** —— 可以是一份 DFIR 报告、一份 CISA 公告,或者是观察到的某个 TTP —— 并最终转化为一套**经过验证且可移植的检测方案**,我可以直接将其部署到 Splunk、Elastic 或 Wazuh 中。 核心理念很简单: 从未经过测试的规则不能算作检测——那只是一厢情愿。这里所有的规则在正式发布前,都会使用 Atomic Red Team 进行模拟演练。 ## 每项检测的构建方式 每一条规则都遵循相同的五阶段生命周期: ``` 1. INTELLIGENCE → Mine a real threat (DFIR Report, MITRE, CISA, vendor intel) 2. RESEARCH → Extract the TTP, apply the Pyramid of Pain (detect behavior, not hashes) 3. DEVELOPMENT → Author once in Sigma → convert to SPL / KQL / Wazuh XML 4. VALIDATION → Emulate with Atomic Red Team, confirm the rule fires 5. OPERATION → Deploy, hunt retroactively, tune false positives ``` **痛苦金字塔(Pyramid of Pain)** 是所有规则的指导原则:我会在行为/TTP 层级进行检测,而不是依赖哈希值或 IP。哈希值几秒钟就会变,而攻击者要想改变行为模式却需要付出高昂的代价。 ## 仓库结构 ``` detection-rules/ ├── README.md ├── 002-the-gentlemen-ransomware/ # case study: EtherRAT + TukTuk → The Gentlemen │ ├── 1-intelligence.md # source: DFIR Report flash alert │ ├── 2-research.md # TTPs, kill chain, Pyramid of Pain │ ├── rules/ │ │ ├── msi-spawns-node.yml # Sigma (source of truth) │ │ ├── msi-spawns-node.spl # Splunk SPL │ │ ├── registry-run-key.yml │ │ ├── registry-run-key.spl │ │ ├── lsass-comsvcs-dump.yml │ │ ├── lsass-comsvcs-dump.spl │ │ ├── lsass-comsvcs-dump.xml # Wazuh local_rules.xml │ │ ├── rmm-install.yml │ │ └── rmm-install.spl │ ├── 4-validation.md # Atomic Red Team tests + screenshots │ └── 5-hunting.spl # retroactive hunting queries └── _template/ # ADS-format template for new detections ``` ## 案例 001 — The Gentlemen 勒索软件 这是一个由 [The DFIR Report](https://thedfirreport.com/) 记录的真实入侵链条,始于一个**伪造的 Sysinternals MSI**,最终导致了全盘域级别的勒索软件攻击。我将这个攻击杀伤链划分为多个阶段,并为每个阶段编写了对应的检测规则——因为在链条中越早捕捉到威胁,就能阻断越多的攻击步骤。 | # | 阶段 | 检测内容 | MITRE ATT&CK | 严重程度 | |---|---|---|---|---| | 1 | 初始访问 | `node.exe` 由 `msiexec.exe` 启动 | [T1218.007](https://attack.mitre.org/techniques/T1218/007/) · [T1059.007](https://attack.mitre.org/techniques/T1059/007/) | 高 | | 3 | 持久化 | 通过命令行写入注册表 Run 键 | [T1547.001](https://attack.mitre.org/techniques/T1547/001/) | 高 | | 4 | 凭据访问 | 通过 `rundll32` + `comsvcs.dll` 转储 LSASS | [T1003.001](https://attack.mitre.org/techniques/T1003/001/) | 严重 | | 5 | 横向移动 | 未经授权安装 RMM 服务 (GoTo Resolve, AnyDesk…) | [T1219](https://attack.mitre.org/techniques/T1219/) | 高 | ## 示例 — 编写一次,到处运行 每一项检测都以 **Sigma** 格式编写,作为唯一的单一事实来源,随后再转换适配至各个平台。 **Sigma:** ``` title: LSASS Memory Dump via comsvcs.dll MiniDump id: 8f2d1a40-de02-0002 status: experimental description: Detects credential dumping from LSASS abusing rundll32 + comsvcs.dll references: - https://attack.mitre.org/techniques/T1003/001/ author: Ariston Cândido logsource: category: process_creation product: windows detection: selection_img: Image|endswith: '\rundll32.exe' selection_cmd: CommandLine|contains: 'comsvcs' CommandLine|contains: - 'MiniDump' - '#24' condition: selection_img and selection_cmd level: critical tags: - attack.t1003.001 - attack.credential_access ``` **Splunk (SPL):** ``` index=* (Image="*\\rundll32.exe" CommandLine="*comsvcs*" (CommandLine="*MiniDump*" OR CommandLine="*#24*")) | table _time, host, user, Image, CommandLine ``` **Wazuh (`local_rules.xml`):** ``` 91802 rundll32\.exe$ comsvcs Credential Dumping: LSASS dump via comsvcs.dll - T1003.001 T1003.001 ``` ## 验证 检测规则在被信任之前都会经过模拟验证。以 LSASS 规则为例: ``` # Atomic Red Team — 模拟 T1003.001(comsvcs.dll dump) Invoke-AtomicTest T1003.001 -ShowDetailsBrief Invoke-AtomicTest T1003.001 -TestNumbers 4 Invoke-AtomicTest T1003.001 -TestNumbers 4 -Cleanup ``` 接着确认规则是否触发: ``` index=* Image="*\\rundll32.exe" CommandLine="*comsvcs*" earliest=-15m ``` ✅ 触发 → 发布上线 · ❌ 未触发 → 修改规则,绝不本末倒置。 ## 框架与参考 - 🎯 [MITRE ATT&CK](https://attack.mitre.org/) — 每条规则都映射到具体的技术 - 🛡️ [Sigma HQ](https://github.com/SigmaHQ/sigma) — 检测格式与转换 - ⚛️ [Atomic Red Team](https://github.com/redcanaryco/atomic-red-team) — 验证 - 📚 [The DFIR Report](https://thedfirreport.com/) — 主要威胁情报来源 - 🧭 检测逻辑以 [Palantir ADS](https://github.com/palantir/alerting-detection-strategy-framework) 格式记录 ## 路线图 - [ ] 每周发布一项基于最新威胁报告的新检测 - [ ] 在 CI 中实现 Sigma → SPL/KQL/Wazuh 的自动化转换(检测即代码) - [ ] 在仓库中发布 ATT&CK Navigator 覆盖层 - [ ] 使用 DeTT&CT 进行覆盖差距分析
**作者:Ariston Cândido** · 网络安全工程师 · 检测工程 纵深防御。以攻促防。检测则是连接两者的闭环。
标签:Sigma规则, Wazuh, 威胁情报, 安全运营, 开发者工具, 扫描框架, 目标导入