nano-rs/rules

GitHub: nano-rs/rules

为安全检测平台 nano 提供的开箱即用社区检测规则库,以 nPL 格式覆盖 MITRE ATT&CK 各阶段的威胁场景。

Stars: 1 | Forks: 0

# nano 检测规则 [nano](https://nano.rs) 的官方检测规则库。这些规则以原生的 nPL (nano Pipe Language) 格式编写,可直接同步到您的 nano 部署中。 ## 用法 在 nano 中添加此代码库: 1. 导航至 **Settings → Rule Repositories** 2. 点击 **Add Repository** 3. 输入: - **URL**:`https://github.com/nano-rs/rules` - **Branch**:`main` - **Format**:nano (nPL) 4. 点击 **Sync** 以获取规则 5. 根据需要浏览并导入规则 ## 仓库结构 ``` ├── credential_access/ # Credential theft, brute force, dumping ├── initial_access/ # Phishing, exploitation, valid accounts ├── lateral_movement/ # Remote services, pass-the-hash ├── execution/ # Script execution, command-line abuse ├── defense_evasion/ # Obfuscation, indicator removal ├── exfiltration/ # Data theft, staging, transfer ├── persistence/ # Scheduled tasks, registry, services ├── discovery/ # Network/system enumeration ├── command_control/ # C2 communications, beaconing ├── demo/ # Curated demo rules (UDM schema) └── demo-ocsf/ # The same demo rules, ported to the OCSF schema ``` ### 演示规则集 `demo/` 和 `demo-ocsf/` 包含相同的一组精选检测,但分为两种 schema 风格。请导入与您部署环境的 schema 配置相匹配的规则集: - **`demo/`** — 适用于默认的 UDM schema(如 `process_name`、 `command_line`、`src_host`、`src_ip`、`event_type` 等字段)。 - **`demo-ocsf/`** — 适用于运行 OCSF schema 配置的部署环境 (`NANO_SCHEMA_PROFILE=ocsf`)。查询使用 OCSF 提升字段 (`process.name`、`process.cmd_line`、`src_endpoint.ip`、`class_uid`,等等)。 ## 规则格式 规则使用带有 nPL 查询的 YAML frontmatter: ``` --- title: rule_name description: What this rule detects author: author-name severity: critical|high|medium|low|informational mode: staging mitre_tactics: TA0006 mitre_techniques: T1110.001 tags: - tag1 - tag2 --- source_type="logs" | where condition="value" | stats count() by field | where count > threshold ``` ## 高级功能 这些规则展示了 nano 的高级检测能力: ### 序列检测 检测有序的事件链(例如:登录失败 → 登录成功): ``` | sequence by user maxspan=5m [status="failure"] [status="success"] ``` ### 频率过滤 仅对罕见/新的 artifacts 发出警报: ``` | prevalence enrich=true window=30d | where hash_prevalence < 5 AND hash_first_seen > now() - INTERVAL 24 HOUR ``` ### 基于风险的评分 根据上下文进行动态风险计算: ``` | risk score=if(external_ip, 80, 40) entity=user factor="Login source" ``` ## 贡献 1. Fork 此代码库 2. 按照上述格式创建规则 3. 在提交前先在 staging 模式下进行测试 4. 提交 pull request ## 许可证 Detection Rule License (DRL) - 参见 [许可证](LICENSE) 规则可自由用于检测目的。重新分发时必须注明出处。
标签:AMSI绕过, DNS 反向解析, IP 地址批量处理, PE 加载器, YAML, 威胁检测, 安全库, 安全运营, 扫描框架