
DefenderAndSentinelQueries is a curated collection of KQL-based hunting queries, Sentinel analytics rules, Logic Apps, and external data sources that help defenders detect privilege escalation and persistence in Azure and Entra ID environments.
| Tool | f-bader/DefenderAndSentinelQueries — KQL hunting queries, Sentinel analytics rules, Logic Apps and external data sources for Microsoft Defender and Sentinel |
| Category | Detection engineering / cloud threat hunting content repository |
| Primary Use | Deploying ready-to-use .yaml analytics rules and hunting queries in Microsoft Sentinel to detect high-privilege role assignments, dangerous API consents, and Azure persistence techniques |
| Safe Use | Purely defensive: import these detections into your own authorized Sentinel tenants for monitoring, hunting, and purple-team validation of detection coverage |
| Telemetry Note | As a detection library the tool produces no offensive telemetry itself; it surfaces adversary activity already present in AzureActivity, EntraID (Azure AD) audit logs, and Microsoft Graph sign-in and consent logs |
Most detection repositories on GitHub are loose collections of KQL snippets copied from blog posts, but f-bader/DefenderAndSentinelQueries takes a more disciplined approach: every artifact is a ready-to-import .yaml file conforming to the Microsoft Sentinel analytics rule and hunting query formats. The repository, written primarily in Bicep and tagged with topics like kql, kusto, sentinel, analytic-rules, detections, and threat-hunting, grew out of the author's work on Azure Attack Paths — a systematic mapping of how an adversary with a foothold in an Azure subscription or Entra ID tenant can escalate to global control. That origin matters, because the detections are not generic noise filters; they are targeted at the specific manipulation points that those attack paths expose.
The hunting query set is deliberately small and focused, which is a signal of curation rather than quantity. Four queries cover the choke points of Azure privilege escalation: AzureVMRunCommandorCustomScriptExecution.yaml watches for VM Run Command or Custom Script Extension execution — the classic in-tenant lateral movement and credential dumping primitive — while ChangesToAzureLighthouseDelegation.yaml tracks modifications to Azure Lighthouse delegations, a frequently overlooked mechanism where a service provider gains management access across subscriptions. The remaining pair, GrantHighPrivilegeAzureADRoleToIdentity.yaml and GrantHighPrivilegeMicrosoftGraphPermissions.yaml, monitor the two most consequential changes in an identity-centric cloud: elevated directory role assignments and consented Microsoft Graph application permissions.
The analytics rules section mirrors and expands that hunting coverage with seven scheduled detections. Notable entries include DangerousAPIPermissionConsented.yaml, which fires on OAuth consent grants that hand applications powerful Graph scopes, and the paired SecretAddedToHighPrivilegedApplication.yaml and OwnerAddedToHighPrivilegedApplication.yaml — both of which address the app-registration takeover path where an attacker who controls a credential or ownership of a privileged service principal effectively owns the tenant. PasswordResetOnHighPrivilegedUser.yaml closes a subtle persistence vector: administrative password resets performed by other identities, which legitimate change processes rarely produce unexpectedly.
From an architecture standpoint, the value here is standardization. Each file follows the Sentinel STIX-style .yaml schema with query logic, tactics mapping, and metadata, meaning deployment is a straight import through the Sentinel portal or via az sentinel alert-rule create in a pipeline — no rewriting required. For teams running detection-as-code, the repository slots cleanly into a git-managed workflow where rules are versioned, reviewed, and pushed with infrastructure tooling rather than hand-edited in the portal, and the presence of hacktoberfest in the topics suggests the author accepts community contributions under that model.
The external data sources table is the most operationally pragmatic part of the README. The author republishes datasets that Kusto's externaldata operator cannot ingest directly: Apple's iCloud Private Relay egress ranges from https://mask-api.icloud.com/egress-ip-ranges.csv and Google One VPN ranges from https://www.gstatic.com/g1vpn/geofeed, both augmented with an IPv4/IPv6 discriminator column because the original files lack it. This directly addresses a real blue-team pain point — anonymous-IP analytics rules flooding queues with false positives from legitimate consumer privacy VPNs and relay services. A third source converts Microsoft's allocated filter altitudes documentation from markdown to CSV, useful for validating file system filter driver registrations during forensic triage.
The Logic Apps directory extends the repository beyond pure detection into automated response. Two variants of SyncDfCAlertsWithSentinelIncidents — one using a system-managed identity (SMI), one a user-managed identity (UMI) — synchronize Microsoft Defender for Cloud alerts into Sentinel incidents, solving the common dual-console fragmentation in Azure-native SOCs. AutoCloseAppleiCloudPrivateRelayIncidents.arm.json operationalizes the anonymous-IP false positive problem end to end: it pairs with the relay egress range data to automatically close incidents generated by Apple's privacy infrastructure. The Template.arm.json file provides a minimal, correct scaffold for any Sentinel incident playbook, which is a welcome baseline given how many moving parts a Logic App connector requires.
What the README reveals about the author's philosophy is a preference for detection at the point of identity and privilege mutation rather than at the point of exploitation. Nearly every rule triggers on a control-plane change — a role grant, a consent, a secret addition, a delegation — rather than on runtime indicators. This is durable tradecraft: control-plane audit events are logged by default in AzureActivity and Entra ID audit tables, are hard for an attacker to suppress without already holding privilege, and map cleanly to MITRE ATT&CK privilege escalation and persistence tactics. For authorized assessors, this collection doubles as a coverage checklist: if your simulated attack path crosses one of these choke points, you know exactly what the defense should see.
There are practical caveats worth flagging before mass-importing. The rules reference high-privilege entities — high privileged users, high privileged applications — which implies the queries embed some definition of that set, and each tenant will need to tune those definitions to its own role taxonomy to avoid both false positives and silent gaps. The repo does not declare a license, which technically leaves reuse terms unspecified, something corporate consumption policies will notice. With 151 stars it is a moderately recognized community resource rather than a vendor product, so expect iteration driven by the author's blog posts rather than an SLA.
Within a defensive workflow, the strongest use of DefenderAndSentinelQueries is as a foundation for Azure attack path monitoring: deploy the analytics rules, wire the iCloud Private Relay suppression Logic App to cut anonymous-IP noise, and use the hunting queries as the interactive follow-up when an alert fires. Teams running purple-team exercises in authorized lab tenants can additionally validate each rule by walking the corresponding attack path from the author's Cloud Brothers blog series and confirming the detection triggers. That closed loop — documented attack technique, matching detection, automated triage — is exactly the structure a mature cloud detection program should aim for, and this repository hands you a working starting point for the Azure and Entra ID half of it.
f-bader/DefenderAndSentinelQueries.Educational analysis for authorized security professionals. Use only in controlled, authorized environments.
Related coverage
0 comentários:
Post a Comment
Note: Only a member of this blog may post a comment.