|
| 1 | +[[prebuilt-rule-8-16-14-microsoft-entra-id-sharepoint-access-for-user-principal-via-auth-broker]] |
| 2 | +=== Microsoft Entra ID SharePoint Access for User Principal via Auth Broker |
| 3 | + |
| 4 | +This rule detects non-interactive authentication activity against SharePoint Online (`Office 365 SharePoint Online`) by a user principal via the `Microsoft Authentication Broker` application. The session leverages a refresh token or Primary Refresh Token (PRT) without interactive sign-in, often used in OAuth phishing or token replay scenarios. |
| 5 | + |
| 6 | +*Rule type*: new_terms |
| 7 | + |
| 8 | +*Rule indices*: |
| 9 | + |
| 10 | +* logs-azure.signinlogs-* |
| 11 | + |
| 12 | +*Severity*: high |
| 13 | + |
| 14 | +*Risk score*: 73 |
| 15 | + |
| 16 | +*Runs every*: 5m |
| 17 | + |
| 18 | +*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>) |
| 19 | + |
| 20 | +*Maximum alerts per execution*: 100 |
| 21 | + |
| 22 | +*References*: |
| 23 | + |
| 24 | +* https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/ |
| 25 | +* https://github.com/dirkjanm/ROADtools |
| 26 | +* https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/ |
| 27 | + |
| 28 | +*Tags*: |
| 29 | + |
| 30 | +* Domain: Cloud |
| 31 | +* Use Case: Identity and Access Audit |
| 32 | +* Tactic: Collection |
| 33 | +* Data Source: Azure |
| 34 | +* Data Source: Microsoft Entra ID |
| 35 | +* Data Source: Microsoft Entra ID Sign-in Logs |
| 36 | +* Resources: Investigation Guide |
| 37 | + |
| 38 | +*Version*: 2 |
| 39 | + |
| 40 | +*Rule authors*: |
| 41 | + |
| 42 | +* Elastic |
| 43 | + |
| 44 | +*Rule license*: Elastic License v2 |
| 45 | + |
| 46 | + |
| 47 | +==== Investigation guide |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +*Triage and analysis* |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +*Investigating Microsoft Entra ID SharePoint Access for User Principal via Auth Broker* |
| 56 | + |
| 57 | + |
| 58 | +This rule identifies non-interactive sign-ins to SharePoint Online via the Microsoft Authentication Broker application using a refresh token or Primary Refresh Token (PRT). This type of activity may indicate token replay attacks, OAuth abuse, or automated access from previously consented apps or stolen sessions. |
| 59 | + |
| 60 | +This is a https://www.elastic.co/guide/en/security/current/rules-ui-create.html#create-new-terms-rule[New Terms rule] that detects the first occurrence of a user principal name accessing SharePoint Online via the Microsoft Authentication Broker application in the last 14 days. |
| 61 | + |
| 62 | + |
| 63 | +*Possible Investigation Steps:* |
| 64 | + |
| 65 | + |
| 66 | +- `azure.signinlogs.properties.user_principal_name`: Identify the user involved. Investigate whether this user typically accesses SharePoint or if this is an anomaly. |
| 67 | +- `azure.signinlogs.properties.app_display_name`: Verify the application used (e.g., Authentication Broker). Determine if the app is expected for SharePoint access in your environment. |
| 68 | +- `azure.signinlogs.properties.resource_display_name`: Review the resource being accessed. SharePoint activity should be aligned with job roles or historical usage. |
| 69 | +- `azure.signinlogs.properties.incoming_token_type`: Indicates the token type used. Look for `refreshToken` or `primaryRefreshToken`, which may point to token replay or silent access. |
| 70 | +- `azure.signinlogs.properties.is_interactive`: If false, indicates the sign-in was non-interactive. Correlate with recent sign-ins to understand if a prior session may have been reused. |
| 71 | +- `user_agent.original`: Analyze the user agent string for automation indicators (e.g., scripts, unusual clients). Compare with what’s typical for the user or device. |
| 72 | +- `source.ip`: Check the originating IP address. Investigate if the IP is associated with data centers, VPNs, anonymizers, or is geographically unusual for the user. |
| 73 | +- `source.geo.*`: Evaluate sign-in location details. Determine if the sign-in location aligns with expected travel or usage behavior. |
| 74 | +- `azure.signinlogs.properties.applied_conditional_access_policies`: Review whether Conditional Access policies were triggered or bypassed. Investigate if required controls (like MFA) were applied. |
| 75 | +- `azure.signinlogs.properties.authentication_processing_details`: Review any details about the authentication, such as token type or scopes. This may indicate delegated access or automation patterns. |
| 76 | + |
| 77 | + |
| 78 | +*False Positive Analysis* |
| 79 | + |
| 80 | + |
| 81 | +- Certain MDM or mobile app scenarios may use refresh tokens legitimately via brokered apps. |
| 82 | +- Automated processes using authorized, scripted clients could trigger this activity, especially in developer or operations environments. |
| 83 | +- If Conditional Access policies are configured in “report-only” mode or exempted for trusted apps, activity may appear unusual but be authorized. |
| 84 | + |
| 85 | + |
| 86 | +*Response and Remediation* |
| 87 | + |
| 88 | + |
| 89 | +- If activity appears unauthorized: |
| 90 | + - Investigate and revoke active sessions or refresh tokens. |
| 91 | + - Notify the user and validate expected activity. |
| 92 | + - Review and audit app consent permissions and remove unused or high-risk delegated access. |
| 93 | +- Harden Conditional Access policies to limit non-interactive access to sensitive resources. |
| 94 | +- Monitor for repeated use of the same user agent, IP, or token type across other users to identify broader campaigns. |
| 95 | +- Consider alerting on unusual patterns in sign-in frequency, geography, and application usage for SharePoint and other key services. |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +==== Setup |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | +*Required Microsoft Entra ID Sign-In Logs* |
| 104 | + |
| 105 | +To use this rule, ensure that Microsoft Entra ID Sign-In Logs are being collected and streamed into the Elastic Stack via the Azure integration. |
| 106 | + |
| 107 | + |
| 108 | +==== Rule query |
| 109 | + |
| 110 | + |
| 111 | +[source, js] |
| 112 | +---------------------------------- |
| 113 | +event.dataset: "azure.signinlogs" |
| 114 | + and azure.signinlogs.properties.app_id: "29d9ed98-a469-4536-ade2-f981bc1d605e" |
| 115 | + and azure.signinlogs.properties.resource_id: "00000003-0000-0ff1-ce00-000000000000" |
| 116 | + and azure.signinlogs.identity: * |
| 117 | + and azure.signinlogs.properties.user_principal_name: * |
| 118 | + and azure.signinlogs.properties.incoming_token_type: ("refreshToken" or "primaryRefreshToken") |
| 119 | + and azure.signinlogs.properties.is_interactive: false |
| 120 | +
|
| 121 | +---------------------------------- |
| 122 | + |
| 123 | +*Framework*: MITRE ATT&CK^TM^ |
| 124 | + |
| 125 | +* Tactic: |
| 126 | +** Name: Collection |
| 127 | +** ID: TA0009 |
| 128 | +** Reference URL: https://attack.mitre.org/tactics/TA0009/ |
| 129 | +* Technique: |
| 130 | +** Name: Data from Information Repositories |
| 131 | +** ID: T1213 |
| 132 | +** Reference URL: https://attack.mitre.org/techniques/T1213/ |
| 133 | +* Sub-technique: |
| 134 | +** Name: Sharepoint |
| 135 | +** ID: T1213.002 |
| 136 | +** Reference URL: https://attack.mitre.org/techniques/T1213/002/ |
0 commit comments