Bert-JanP/Hunting-Queries-Detection-Rules
GitHub: Bert-JanP/Hunting-Queries-Detection-Rules
一个收集了大量 KQL 查询的规则库,为微软安全产品提供开箱即用的威胁检测、狩猎和事件响应查询能力。
Stars: 1641 | Forks: 317
# KQL Sentinel 与 Defender 查询
[](https://twitter.com/intent/tweet?text=KQL%20Detection%20Rules!%20MDE%20and%20Sentinel!&url=https://github.com/Bert-JanP/Hunting-Queries-Detection-Rules)
```
██ ██ ██████ ██
██ ██ ██ ██ ██
█████ ██ ██ ██
██ ██ ██ ▄▄ ██ ██
██ ██ ██████ ███████
▀▀
█ ██████ ██████ ██ ███ ██ ████████ ██ ██ ██ ███████ ██ ██████ ██████ ███ ███ ███████ ██
█ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██
█ ██████ ██████ ██ ██ ██ ██ ██ ██ █ ██ █████ ██ ██ ██ ██ ██ ████ ██ █████
█ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
█ ██ ██ ██ ██ ██ ████ ██ ███ ███ ███████ ███████ ██████ ██████ ██ ██ ███████
```
# 适用于 Defender For Endpoint & Microsoft Sentinel 的 KQL
本仓库旨在分享任何人都可以使用且易于理解的 KQL 查询。这些查询旨在通过 Microsoft Security 产品的日志提高检测覆盖率。并非所有可疑活动都会默认生成警报,但许多活动可以通过日志进行检测。这些查询包括检测规则 (Detection Rules)、搜寻查询 (Hunting Queries) 和可视化 (Visualisations)。任何人都可以免费使用这些查询。如有任何问题,欢迎在 Twitter [@BertJanCyber](https://twitter.com/BertJanCyber) 上联系我。
**将此资料作为您自己的展示是非法且被禁止的。在分享或使用内容时,请注明引用 Twitter [@BertJanCyber]( ) 或 Github [@Bert-JanP](https://github.com/Bert-JanP),我们将不胜感激。**
## KQL 博客
更详细的 KQL 信息可以在我的博客页面找到:https://kqlquery.com。一些与 KQL 相关的博客:
- [安全运维的 KQL 函数](https://kqlquery.com/posts/kql-for-security-operations/)
- [网络运维的 KQL 函数](https://kqlquery.com/posts/kql-for-network-operations/)
- [事件响应第 1 部分:Microsoft Security 事件的 IR(KQL 版本)](https://kqlquery.com/posts/kql-incident-response/)
- [事件响应第 2 部分:其他日志怎么样?](https://kqlquery.com/posts/kql-incident-response-everything-else/)
- [从威胁报告到 (KQL) 搜寻查询](https://kqlquery.com/posts/from-threat-report-to-hunting-query/)
- [利用 CISA 已知被利用漏洞目录确定漏洞优先级](https://kqlquery.com/posts/prioritize-vulnerabilities-cisa/)
- [KQL 安全来源 - 2024 更新](https://kqlquery.com/posts/kql-sources-2024-update/)
- [检测后渗透行为](https://kqlquery.com/posts/detecting-post-exploitation-behaviour/)
- [调查 Microsoft Graph 活动日志](https://kqlquery.com/posts/graphactivitylogs/)
- [审计 Defender XDR 活动](https://kqlquery.com/posts/audit-defender-xdr/)
- [Sentinel 摘要规则的使用案例](https://kqlquery.com/posts/sentinel-summary-rules/)
- [释放 DeviceTvmInfoGathering 的力量](https://kqlquery.com/posts/devicetvminfogathering/)
关于 Sentinel 自动化,请参阅仓库 [Sentinel-Automation](https://github.com/Bert-JanP/Sentinel-Automation)。
# KQL 分类
本仓库中的查询分为不同的类别。MITRE ATT&CK 类别包含映射到 MITRE 框架战术的查询列表。产品部分包含特定于 Microsoft 安全产品的查询。流程部分包含几个可用于常见网络流程的查询,以使安全分析师的工作更轻松。此外,还有一个专门用于 Zero Day(零日)检测的类别。最后,有一个信息部分,通过示例解释 KQL 的使用。
## MITRE ATT&CK
- [MITRE ATT&CK 映射](./MITRE%20ATT%26CK/Mapping.md)
## 产品
- [Defender For Endpoint 检测规则](./Defender%20For%20Endpoint)
- [Defender For Identity 检测规则](./Defender%20For%20Identity)
- [Defender For Cloud Apps 检测规则](./Defender%20For%20Cloud%20Apps)
- [Defender For Office 365](./Office%20365)
- [Defender XDR](./Defender%20XDR)
- [Azure Active Directory](./Azure%20Active%20Directory)
- [Microsoft Sentinel](./Sentinel)
- [MISP](./MISP)
- [Windows 安全事件](./Windows%20Security%20Events)
- [Graph API](./Graph%20API/)
- [Windows 安全事件](./SecurityEvents/)
## 安全流程
- [数字取证与事件响应](./DFIR)
- [威胁搜寻](./Threat%20Hunting)
- [完整威胁搜寻案例](./Threat%20Hunting%20Cases)
- [漏洞管理](./Vulnerability%20Management)
## 信息
- [KQL 实用函数](./Functions/)
- [KQL 正则表达式示例列表](./KQL%20Regex/RegexExamples.md)
- [Azure Resource Graph](./Azure%20Resource%20Graph/)
### 检测模板
*[检测模板](./DetectionTemplate.md)* 可用于标准化您自己仓库中的检测。这有助于其他人轻松解析仓库内容以收集查询和元数据。以下仓库已按此方式标准化:
- https://github.com/alexverboon/Hunting-Queries-Detection-Rules - 作者 Alex Verboon
- https://github.com/KustoKing/Hunting-Queries-Detection-Rules - 作者 Gianni Castaldi
- https://github.com/SlimKQL/Hunting-Queries-Detection-Rules - 作者 Steven Lim
- https://github.com/SecurityAura/DE-TH-Aura - 作者 SecurityAura
如果您的仓库尚未列出,欢迎创建 Pull Request (PR) 或通过消息联系以添加。
# 在 Defender For Endpoint & Sentinel 的哪里使用 KQL?
## Defender XDR
* 打开 [security.microsoft.com](https://www.security.microsoft.com)
* Hunting(搜寻)
* Advanced Hunting(高级搜寻)
## Sentinel
* 打开 [portal.azure.com](https://www.portal.azure.com)
* 搜索 Sentinel
* 打开 Sentinel
* Logs(日志)
# KQL Defender For Endpoint 对比 Sentinel
KQL 查询既可用于 Defender For Endpoint 也可用于 Azure Sentinel。语法几乎相同。主要区别在于指示时间的字段。必须根据使用的产品进行调整。在 Sentinel 中,使用 'TimeGenerated' 字段。在 DFE 中则是 'Timestamp'。以下查询展示了在 DFE 和 Azure Sentinel 中最近 7 天的 10 个 DeviceEvents。
Defender For Endpoint 快速入门
```
DeviceEvents
| where Timestamp > ago(7d)
| take 10
```
Azure Sentinel 快速入门
```
DeviceEvents
| where TimeGenerated > ago(7d)
| take 10
```
# KQL 来源
## 文档
| 链接 | 描述 |
| ------ | ----------- |
| [KQL 快速参考指南](https://docs.microsoft.com/en-us/azure/data-explorer/kql-quick-reference) | KQL 快速参考指南 |
| [KQL 教程](https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/tutorial?pivots=azuredataexplorer) | KQL 教程 |
| [KQL 速查表 PDF](https://github.com/marcusbakker/KQL/blob/master/kql_cheat_sheet.pdf) | KQL 速查表 |
## 仓库
社区仓库可在 [此处](./Community%20Repositories.md) 获取
## 其他
| 链接 | 描述 |
| ------ | ----------- |
| [kqlsearch.com](https://www.kqlsearch.com/) | KQL 搜索引擎 |
| [Kusto Insights 通讯](https://kustoinsights.substack.com/) | Kusto Insights 通讯 |
| [KQL 权威指南](https://www.amazon.com/Definitive-Guide-KQL-Operations-Defending/dp/0138293384) | 使用 Kusto Query Language 进行运维、防御和威胁搜寻 |
| [Kusto 查询内部原理](https://identityandsecuritydotcom.files.wordpress.com/2020/05/kql_internals_sentinel.pdf) | 使用 Azure Sentinel 搜寻 TTP |
| [Microsoft Sentinel 分析规则](https://analyticsrules.exchange/) | Microsoft Sentinel 分析规则 |
| [KQL 内部原理](https://identityandsecuritydotcom.files.wordpress.com/2020/05/kql_internals_sentinel.pdf) | Kusto 查询内部原理:使用 Azure Sentinel 搜寻 TTP |
| [高级搜寻专家培训](https://learn.microsoft.com/en-us/defender-xdr/advanced-hunting-expert-training) | 高级搜寻专家培训 |
标签:AMSI绕过, Azure Sentinel, EDR, KQL, Kusto 查询语言, Microsoft 365 Defender, Microsoft Defender for Endpoint, PE 加载器, 域环境安全, 威胁检测, 安全运营, 扫描框架, 检测规则, 网络安全, 网络安全审计, 网络资产发现, 脆弱性评估, 自定义检测, 速率限制, 隐私保护, 高级搜寻