raulsineiro/sigma-detection-rules
GitHub: raulsineiro/sigma-detection-rules
一套采用 Sigma 格式编写的安全检测规则集合,涵盖四种 MITRE ATT&CK 技术并提供完整的检测工程流程示例。
Stars: 0 | Forks: 0
# Sigma 检测规则
采用 [Sigma](https://github.com/SigmaHQ/sigma) 格式编写的检测规则集合,涵盖了 4 种常见的 MITRE ATT&CK 技术,适用于 Linux 和 Windows 环境。每条规则都包含了其依据、用于验证的示例日志,以及转换为实际 Elasticsearch/Kibana 查询语句的结果。
本仓库旨在展示完整的 **detection engineering** 生命周期:从识别攻击技术到在真实的 SIEM 中部署规则,而不仅仅是理论上的练习。
## 为什么选择 Sigma?
Sigma 是一种与 SIEM 无关的检测规则格式:只需编写一次,即可转换为 Splunk、Elastic、QRadar、Microsoft Sentinel 等的查询语言。它是业界共享和版本化检测逻辑事实上的标准(被 SOC 团队、CERT 以及 SigmaHQ 等项目广泛使用)。
## 仓库结构
```
sigma-detection-rules/
├── rules/ # Reglas Sigma (.yml)
│ ├── linux_ssh_bruteforce.yml
│ ├── linux_cron_persistence.yml
│ ├── windows_registry_run_key_persistence.yml
│ └── windows_powershell_encoded_command.yml
├── sample-logs/ # Logs de ejemplo para validar cada regla
├── converted-elastic/ # Reglas ya convertidas a Lucene (Elastic/Kibana)
└── README.md
```
## 包含的规则
| 规则 | MITRE ATT&CK 技术 | 平台 | 严重程度 |
|---|---|---|---|
| SSH 暴力破解 | [T1110](https://attack.mitre.org/techniques/T1110/) - Brute Force | Linux | Medium / High(带关联) |
| 通过 cron 持久化 | [T1053.003](https://attack.mitre.org/techniques/T1053/003/) - Scheduled Task/Job: Cron | Linux | Medium |
| 通过 Registry Run Key 持久化 | [T1547.001](https://attack.mitre.org/techniques/T1547/001/) - Boot or Logon Autostart Execution | Windows | Medium |
| 执行编码命令的 PowerShell | [T1059.001](https://attack.mitre.org/techniques/T1059/001/) / [T1027](https://attack.mitre.org/techniques/T1027/) | Windows | High |
## 如何测试规则
1. 安装 `sigma-cli` 和 Elasticsearch backend:
pip install sigma-cli pysigma-backend-elasticsearch
2. 将规则转换为 Elastic 查询语句 (Lucene):
sigma convert -t lucene -p ecs_windows rules/windows_powershell_encoded_command.yml
对于使用通用字段的 Linux 规则,转换时不使用 pipeline:
sigma convert -t lucene --without-pipeline rules/linux_cron_persistence.yml
3. `converted-elastic/` 文件夹中已包含每次转换的结果,可直接将其复制粘贴到 Kibana → Security → Rules → Custom query 中。
4. `sample-logs/` 中的日志旨在触发每条规则:它们包含恶意事件和合法事件(避开了误报),以便验证规则是否能正确区分这两者。
## 关于 SSH 暴力破解规则的说明
该规则使用了 Sigma 的 **correlation** 格式(在 Sigma v2 中引入):一条基础规则检测单个事件(登录失败),当同一个 `source.ip` 在 5 分钟内发生 5 次或以上事件时,第二条规则会提高严重程度。这种模式避免了因简单的用户错误而触发告警,仅在出现真实的自动化攻击模式时才会触发。
关联部分无法转换为静态的 Lucene 查询语句(需要状态和时间窗口),因此在实际部署中,它将使用基础查询作为过滤器,通过 Kibana Security 原生的 **Threshold Rule** 来实现。
## 后续步骤(路线图)
- [ ] 添加通过 DNS tunneling 进行数据外泄的规则
- [ ] 添加 CI pipeline(GitHub Actions),使用 `sigma check` 对每个 PR 进行语法验证
- [ ] 同时导出为 Splunk (SPL) 格式,以比较多个 SIEM 的覆盖率
## 作者
Raúl Sineiro Domínguez — 网络安全硕士,Campus Internacional de Ciberseguridad
[github.com/raulsineiro](https://github.com/raulsineiro)
标签:AMSI绕过, OpenCanary, Reconnaissance, Sigma规则, 威胁检测, 安全, 目标导入, 超时处理, 越狱测试, 逆向工具