Repository navigation
[New Rule] Entra ID End-User Consent to Application with High-Risk Delegated Scopes - #6944
Merged
terrancedejesus merged 10 commits intoOct 8, 2026
Merged
Conversation
…legated Scopes Builds on #6729 (Eduard Arbona): broadens scope coverage beyond mailbox, adds first-party/in-tenant/external app owner classification, handles per-resource consent events, and keeps the query fully row-level.
Updated creation date, risk score, and severity level. Modified alert suppression strategy and added new tags.
terrancedejesus
marked this pull request as ready for review
October 2, 2026 18:33
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Alert suppression can hide distinct consent grants, and required rule metadata should be corrected.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Adds an ES|QL rule detecting risky end-user OAuth consent grants in Microsoft Entra ID.
Changes:
- Detects high-risk delegated scopes and suspicious scope combinations.
- Classifies application ownership and service-principal provisioning.
- Adds investigation, false-positive, and remediation guidance.
| File | Description |
|---|---|
rules/integrations/azure/initial_access_entra_id_end_user_consent_high_risk_scopes.toml |
Defines the new consent detection rule and investigation guidance. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
terrancedejesus
requested review from
Samirbous,
bryans3c,
django-88 and
w0rk3r
October 2, 2026 21:10
bryans3c
reviewed
Oct 5, 2026
…ent_high_risk_scopes.toml Co-authored-by: Bryan Porras <bryan.porras@elastic.co>
…ent_high_risk_scopes.toml Co-authored-by: Bryan Porras <bryan.porras@elastic.co>
bryans3c
approved these changes
Oct 6, 2026
Samirbous
approved these changes
Oct 6, 2026
…ent_high_risk_scopes.toml Co-authored-by: Samirbous <64742097+Samirbous@users.noreply.github.com>
terrancedejesus
enabled auto-merge
October 8, 2026 14:18
terrancedejesus
deleted the
new-rule/entra-id-end-user-consent-high-risk-scopes
branch
October 8, 2026 14:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Separate PR building on the community contribution in #6729 by @earbona23, who is credited as a co-author on the rule. Same premise (non-admin consent to an app requesting high-risk delegated scopes), broadened from mailbox-only to the scope families adversaries actually request, with first-party false-positive handling. This PR supersedes #6729.
Logic changes
Mail.*/MailboxSettings.ReadWriteto high-risk families: mail, mailbox settings/items/folders, contacts, files, SharePoint (GraphSites.*plus SPOAllSites.*/MyFiles.*), OneNote, Teams chat, and Exchange EWS (EWS.AccessAsUser.All,full_access_as_user). Low-risk variants (Mail.ReadBasic,Chat.ReadBasic,Files.*.Selected) are excluded.offline_access.Esql.app_owner_type:microsoft/tenant/external) fromAppOwnerOrganizationIdplus well-known first-party public-client AppIds.user_impersonationandDirectory.AccessAsUser.Allare ignored for Microsoft apps (Azure CLI / PowerShell / Portal / VS Code consent noise).Esql.sp_provisioned_by_consentflags first-time-seen apps (service principal created by the consent).offline_access. Theoffline_accessgate now applies only to Graph families;sharepoint_spoandexchange_ewsalert on their own.STATS/MV_EXPAND); keeps_id/_version/_indexand original field names.MV_CONTAINSrequiresmin_stack_version = "9.3.0".Related Research
Below are some references used to determine appropriate scopes to flag for this rule.
Mail.*,Contacts.*,MailboxSettings.*,People.*,Files.*,Notes.*appear in ~99% of observed consent phishing.Validation
validate-ruleandtests/test_all_rules.pypass.mail files teams_chat), PnP PowerShell (sharepoint_spo), an EWSfull_access_as_usergrant (exchange_ews); Graph CLI correctly suppressed.