BL3IP/sigma-detection-rules

GitHub: BL3IP/sigma-detection-rules

为 SigmaHQ 规则集贡献了一条检测 Microsoft Dev Tunnels 滥用行为的 process_creation 级 Sigma 检测规则,填补了协议隧道检测在主机进程层面的覆盖空白。

Stars: 0 | Forks: 0

# 02 — Sigma 检测规则(适配 SigmaHQ,已暂存 PR) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/BL3IP/sigma-detection-rules/actions/workflows/ci.yml) 按照 SigmaHQ 的贡献标准编写了一个全新的 **Sigma** 检测规则,并对其进行了验证。 同时使用了 `sigma check` **和 SigmaHQ 自带的 `tests/test_rules.py` 测试套件**进行验证,确认它填补了真实的覆盖空白,并且暂存了准备提交 PR 的 fork 分支和补丁。 ## 目标 寻找一种真实且检测不足的对手技术,并制作出可以合并到 [SigmaHQ/sigma](https://github.com/SigmaHQ/sigma) 中的生产级 Sigma 规则——这是行业标准的开源检测规则集。 ## 规则 — Dev Tunnel 托管或创建执行 **技术:** 对手滥用 **Microsoft Dev Tunnels** (`devtunnel.exe`),通过受信任的 `*.devtunnels.ms` 基础设施将本地端口暴露到互联网,用于 C2、反弹 shell 和持久远程访问(MITRE **T1572 – Protocol Tunneling**)。 **我发现的空白**(记录在 [`proof/duplicate_check.txt`](./proof/duplicate_check.txt) 中): SigmaHQ 已经在 `dns_query` 和 `network_connection` 中检测到了 Dev Tunnels,但**没有**在 `process_creation` 中进行检测——也就是说,在主机上*设置* tunnel 的 `devtunnel.exe` CLI 没有被捕获。此规则填补了这一空白,并通过 `related:` 字段与现有规则进行了交叉链接。 规则文件:[`rule/proc_creation_win_devtunnel_host_execution.yml`](./rule/proc_creation_win_devtunnel_host_execution.yml) ## 精确的设置命令 ``` cd C:\Users\banlv\cyber\02-sigma-rule git clone --depth 1 https://github.com/SigmaHQ/sigma.git work\sigma & "C:\Users\banlv\AppData\Local\Programs\Python\Python312\python.exe" -m venv .venv .\.venv\Scripts\python.exe -m pip install sigma-cli pysigma-backend-splunk pysigma-validators-sigmahq pytest .\.venv\Scripts\sigma.exe plugin install sysmon # 验证 (pySigma core + SigmaHQ validators) .\.venv\Scripts\sigma.exe check rule\ # 转换为 SIEM query .\.venv\Scripts\sigma.exe convert -t splunk -p sysmon rule\proc_creation_win_devtunnel_host_execution.yml # 运行 SigmaHQ 的权威 rule test-suite (在将 rule 复制到 cloned repo 之后) cd work\sigma; python -m pytest tests\test_rules.py -q ``` ## 运行有效性证明 - **`sigma check` → `Found 0 errors, 0 condition errors and 0 issues`**([证明](./proof/sigma_check.txt)) - **SigmaHQ `tests/test_rules.py` → `11 passed`**([证明](./proof/repo_test_result.txt))——通过了所有的 SigmaHQ 约定检查(字段顺序、UUID、标题长度、状态、ATT&CK 标签、`related` 完整性等)。 - **Splunk 转换**([证明](./proof/splunk_conversion.txt)): EventID=1 Image="*\\devtunnel.exe" CommandLine IN ("* host*", "* create*", "* port forward*") - **准备提交 PR 的 commit** 位于 `detection/devtunnel-host-execution` 分支,已导出为补丁: [`proof/0001-rules-windows-add-Dev-Tunnel-...patch`](./proof)。 ## 截图 参见 [`./screenshots/`](./screenshots)。补充:`sigma check` 的无报错结果和 `11 passed` 的 pytest 输出。**进阶目标:**向上游提交 PR 后,截取已合并 commit 的截图。 ## 我的自定义扩展 - 一个真正**新颖的规则**(process_creation Dev Tunnel 检测),它是通过分析 3,100 多个现有 SigmaHQ 规则中的真实覆盖空白来选择的,而不是简单地复制。 - 基于 **SigmaHQ 的实际 CI 测试套件**进行了验证,而不仅仅是常规的代码检查。 - 规范的 SigmaHQ 良好习惯:带连字符的 ATT&CK 标签(`attack.command-and-control`),指向现有两个 Dev Tunnel 规则的 `related:` 交叉链接,块标量描述,符合约定的文件名。 ## 简历要点 - 编写了一个生产级 **Sigma** 检测规则,用于防范 **Microsoft Dev Tunnel C2 滥用(MITRE T1572)**,填补了 SigmaHQ 规则集中 `process_creation` 的真实覆盖空白。 - 使用 `sigma check` 和 **SigmaHQ 自带的测试套件(11 项通过)**验证了该规则,并通过 pySigma 将其编译为 Splunk SPL —— 实现了从编写到 SIEM 部署的“检测即代码”。 - 实现了端到端的开源贡献工作流:查重分析、规范、`related` 交叉链接,以及准备提交 PR 的 fork 分支和补丁。 ## 进阶想法 - 向上游 SigmaHQ 提交 PR,并根据维护者的审查进行迭代(需要 GitHub 身份验证)。 - 为其他 Dev Tunnel 子命令以及通过 `dotnet`/`winget` 启动的变体添加同级规则。 - 将该规则接入“检测即代码” CI pipeline(项目 07)中,以实现自动化测试和部署。 status: ✅ 完成并已测试 ``` ✅ PROJECT COMPLETE & FULLY TESTED in its isolated folder. All works. Ready for portfolio. ```
标签:AMSI绕过, Reconnaissance, Sigma规则, 威胁检测, 安全, 安全规则引擎, 目标导入, 超时处理, 逆向工具