National Cyber Warfare Foundation (NCWF)login

KQL-threat-hunting-queries for defensive hunting in Microsoft Sentinel and Defender XDR


0 user ratings
2026-11-03 13:35:06
milo
Red Team (CNA)
"KQL-threat-hunting-queries

A curated repository of ready-made KQL detection and hunting queries that helps analysts and threat hunters harness Kusto Query Language across Microsoft Sentinel and Microsoft Defender XDR in authorized environments.








Toolcyb3rmik3/KQL-threat-hunting-queries — a community repository of KQL queries and learning resources for threat hunting and detection in Microsoft Sentinel and Microsoft Defender XDR
CategoryDefensive detection content / query library (blue team)
Primary UseAccelerating hypothesis-driven threat hunting and detection engineering with pre-built KQL queries against DeviceNetworkEvents and related advanced hunting schema tables
Safe UseIntended for authorized defenders operating their own Microsoft Sentinel and Microsoft Defender XDR tenants, security labs, and detection engineering research; the README explicitly warns users to test queries before production use
Telemetry NotePurely defensive: queries execute inside the defender's own SIEM/XDR and generate no attacker-side artifacts; heavy ad hoc hunting may inflate query workload costs in Log Analytics

Most tooling we cover here leans offensive, but cyb3rmik3/KQL-threat-hunting-queries sits firmly on the blue side of the house, and that is exactly why it deserves attention. The repository, sitting at a healthy 802 stars and released under the MIT license, is an effort by the author known as cyb3rmik3 to provide ready-made detection and hunting queries, plus a substantial layer of training material, for analysts working in Microsoft Sentinel and Microsoft Defender XDR. It is not an executable tool at all — it is curated Kusto Query Language content that you drop into your own tenant's advanced hunting or Log Analytics interface, which makes it one of the safest categories of security tooling to evaluate in a production-adjacent environment.


The README opens with a note dated January 27th announcing a heavy rebuild after almost a year of contributions, intended to better contextualize queries against the current community landscape. That matters operationally: a query library is only as good as its mapping to current telemetry schemas, and a maintainer actively restructuring the corpus signals that stale queries are being pruned rather than accumulating. For a detection engineer importing community queries into analytics rules, that maintenance posture is a genuine selection criterion, and it is worth checking the main branch directly for the reorganized structure.


Structurally, the README is organized into four pillars: KQL Training, KQL Basics, Threat Hunting Basics, and KQL Community. The training section is unusually thorough for a query repo. It points at Microsoft's SC-200 Security Operations Analyst certification path, including the dedicated modules Utilize KQL for Azure Sentinel and Configure Azure Sentinel environment, alongside the Microsoft Defender XDR advanced hunting expert training delivered through the Tracking the Adversary and L33TSP3AK webcast series. This positions the repo not just as a copy-paste source but as an onboarding path for junior SOC staff.


The training references continue into third-party ecosystems that senior KQL practitioners will recognize. Mehmet Ergene (cyb3rmonk) and his blu raven academy courses, including a free Introduction to KQL for Security Analysis and the paid hands-on threat hunting and detection engineering track, get explicit billing. So do Rod Trent's MustLearnKQL series, the gamified KC7 Cyber and Kusto Detective Agency challenges, and Invictus Incident Response's Incident Response in the Microsoft Cloud training, which covers KQL querypacks and cloud-attack use cases. The author is effectively curating a syllabus, which tells you the intended audience is analysts leveling up, not experts looking for a snippet dump.


The KQL Basics section demonstrates the language mechanics with concrete, non-weaponized examples against the DeviceNetworkEvents table. The where operator is shown filtering on LocalIP, and the README usefully contrasts contains (substring matching) against has (word-level matching with better performance) — a distinction that materially affects query cost at scale. The ago(1d) time-offset pattern and project column selection are demonstrated in a composed pipeline that filters by Timestamp and DeviceName, then projects Timestamp, ActionType, RemoteIP, RemotePort, and RemoteUrl. These snippets are purely illustrative of syntax, not attack recipes.


The threat hunting section is where the analytical framing lives. The README stresses that hunting should be a continual process beginning with a Hypothesis — planning what to hunt for requires understanding your data, your tools, and your team's expertise before execution. It explicitly notes that the cycle does not terminate at query execution: responding to anomalies and performing follow-on activities remain part of the lifecycle even when no active threat is found. A link to MITRE's TTP-based hunting paper (prs-19-3892-ttp-based-hunting.pdf) reinforces the two-component approach of characterizing malicious activity and executing hunts as ongoing, continuously updated activities.


The community section is a strong signal of provenance. The repo is indexed by KQL Search (kqlsearch.com), Ugur Koc's aggregator of GitHub query repositories for Microsoft Sentinel and Microsoft Defender XDR, which places it alongside other named contributors like Ashwin Patil's blue-teaming-with-kql and seccnet's Microsoft-365-Defender-Hunting-Queries. Additional bookmarks include the KQL Cafe, the Kusto Insights Newsletter, KQL Query Blog, KustoKing, and ml58158's Demystifying-KQL. For an operator, this means the queries here can be cross-referenced against a wider corpus when a hunt hypothesis needs variants or tuning.


Operationally, the value proposition is speed to detection. Writing effective KQL from scratch requires fluency in schema tables like DeviceNetworkEvents and idioms like has versus contains, and community libraries collapse that ramp time. The realistic workflow is to review a query's logic, adapt time windows and environment-specific filters to your tenant, validate results against known-benign activity in a test workspace, and only then promote it into a scheduled analytics rule in Sentinel or a custom detection in Defender XDR. The repo's own disclaimer says as much: queries are informational, users are solely responsible for usage, and thorough testing before production is advised.


The defensive telemetry angle deserves a note too. Because these queries run entirely inside the defender's own Log Analytics and advanced hunting planes, they generate no artifacts on endpoints and no network noise — there is nothing for an adversary to observe from the query itself. The only observable side effect is internal: heavy interactive hunting can consume query quota and drive workspace costs, so teams running wide-sweep DeviceNetworkEvents scans across long ago() windows should expect resource implications.


Caveats are modest but real. The README as presented is heavier on training and fundamentals than on a deep catalog of specific hunting queries, so treat the rebuilt main branch as the source of truth for current query content. Attribution leans on the author's Twitter presence (@cyb3rmik3) and a Ko-fi link rather than an organizational maintainer, typical for community query repos. And as with any shared detection content, queries encode someone else's environment assumptions — device naming, log retention, and licensing tier all shape whether a query returns signal or silence in your tenant.


Taken as a whole, this is a well-maintained, education-first resource that earns its stars by combining a query corpus with a genuine learning path, from SC-200 fundamentals through cyb3rmonk's hands-on detection engineering to gamified practice at the Kusto Detective Agency. For blue teams standardizing on the Microsoft security stack, it is a solid bookmark: defensively oriented, MIT licensed, actively rebuilt, and explicitly framed for analysts and threat hunters operating environments they are authorized to defend.



Official project repository for cyb3rmik3/KQL-threat-hunting-queries.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/kql-threat-hunting-queries-for.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.