Skip to content

Commit 58d03d4

Browse files
[New Rule] Adding Coverage for Microsoft Entra ID SharePoint Access for User Principal via Auth Broker (#4695)
* new rule 'Microsoft Entra ID SharePoint Access for User Principal via Auth Broker' * updated severity * added new terms note
1 parent e4856d3 commit 58d03d4

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
[metadata]
2+
creation_date = "2025/05/01"
3+
integration = ["azure"]
4+
maturity = "production"
5+
updated_date = "2025/05/01"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
This rule detects non-interactive authentication activity against SharePoint Online (`Office 365 SharePoint Online`) by
11+
a user principal via the `Microsoft Authentication Broker` application. The session leverages a refresh token or Primary
12+
Refresh Token (PRT) without interactive sign-in, often used in OAuth phishing or token replay scenarios.
13+
"""
14+
false_positives = [
15+
"""
16+
Legitimate non-interactive access to SharePoint Online via the Microsoft Authentication Broker may occur in
17+
enterprise environments, especially with MDM solutions or automated scripts. However, this should be explicitly
18+
allowed and monitored.
19+
""",
20+
"""
21+
Some enterprise MDM or brokered flows may use refresh tokens legitimately (especially with hybrid/Azure AD joined
22+
devices). Automated scripts for legitimate tasks (e.g., reporting, backups) might use `python-requests`, though this
23+
should be explicitly allowed.
24+
""",
25+
"""
26+
If the user is a developer or automation engineer, validate if this behavior was for testing purposes.
27+
""",
28+
]
29+
from = "now-9m"
30+
index = ["logs-azure.signinlogs-*"]
31+
language = "kuery"
32+
license = "Elastic License v2"
33+
name = "Microsoft Entra ID SharePoint Access for User Principal via Auth Broker"
34+
note = """## Triage and analysis
35+
36+
### Investigating Microsoft Entra ID SharePoint Access for User Principal via Auth Broker
37+
38+
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.
39+
40+
This is a [New Terms rule](https://www.elastic.co/guide/en/security/current/new-terms-rules.html) that detects the first occurrence of a user principal name accessing SharePoint Online via the Microsoft Authentication Broker application in the last 14 days.
41+
42+
### Possible Investigation Steps:
43+
44+
- `azure.signinlogs.properties.user_principal_name`: Identify the user involved. Investigate whether this user typically accesses SharePoint or if this is an anomaly.
45+
- `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.
46+
- `azure.signinlogs.properties.resource_display_name`: Review the resource being accessed. SharePoint activity should be aligned with job roles or historical usage.
47+
- `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.
48+
- `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.
49+
- `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.
50+
- `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.
51+
- `source.geo.*`: Evaluate sign-in location details. Determine if the sign-in location aligns with expected travel or usage behavior.
52+
- `azure.signinlogs.properties.applied_conditional_access_policies`: Review whether Conditional Access policies were triggered or bypassed. Investigate if required controls (like MFA) were applied.
53+
- `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.
54+
55+
### False Positive Analysis
56+
57+
- Certain MDM or mobile app scenarios may use refresh tokens legitimately via brokered apps.
58+
- Automated processes using authorized, scripted clients could trigger this activity, especially in developer or operations environments.
59+
- If Conditional Access policies are configured in “report-only” mode or exempted for trusted apps, activity may appear unusual but be authorized.
60+
61+
### Response and Remediation
62+
63+
- If activity appears unauthorized:
64+
- Investigate and revoke active sessions or refresh tokens.
65+
- Notify the user and validate expected activity.
66+
- Review and audit app consent permissions and remove unused or high-risk delegated access.
67+
- Harden Conditional Access policies to limit non-interactive access to sensitive resources.
68+
- Monitor for repeated use of the same user agent, IP, or token type across other users to identify broader campaigns.
69+
- Consider alerting on unusual patterns in sign-in frequency, geography, and application usage for SharePoint and other key services.
70+
71+
"""
72+
references = [
73+
"https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/",
74+
"https://github.com/dirkjanm/ROADtools",
75+
"https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/",
76+
]
77+
risk_score = 73
78+
rule_id = "a3cc60d8-2701-11f0-accf-f661ea17fbcd"
79+
setup = """#### Required Microsoft Entra ID Sign-In Logs
80+
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.
81+
"""
82+
severity = "high"
83+
tags = [
84+
"Domain: Cloud",
85+
"Use Case: Identity and Access Audit",
86+
"Tactic: Collection",
87+
"Data Source: Azure",
88+
"Data Source: Microsoft Entra ID",
89+
"Data Source: Microsoft Entra ID Sign-in Logs",
90+
"Resources: Investigation Guide",
91+
]
92+
timestamp_override = "event.ingested"
93+
type = "new_terms"
94+
95+
query = '''
96+
event.dataset: "azure.signinlogs"
97+
and azure.signinlogs.properties.app_id: "29d9ed98-a469-4536-ade2-f981bc1d605e"
98+
and azure.signinlogs.properties.resource_id: "00000003-0000-0ff1-ce00-000000000000"
99+
and azure.signinlogs.identity: *
100+
and azure.signinlogs.properties.user_principal_name: *
101+
and azure.signinlogs.properties.incoming_token_type: ("refreshToken" or "primaryRefreshToken")
102+
and azure.signinlogs.properties.is_interactive: false
103+
'''
104+
105+
106+
[[rule.threat]]
107+
framework = "MITRE ATT&CK"
108+
[[rule.threat.technique]]
109+
id = "T1213"
110+
name = "Data from Information Repositories"
111+
reference = "https://attack.mitre.org/techniques/T1213/"
112+
[[rule.threat.technique.subtechnique]]
113+
id = "T1213.002"
114+
name = "Sharepoint"
115+
reference = "https://attack.mitre.org/techniques/T1213/002/"
116+
117+
118+
119+
[rule.threat.tactic]
120+
id = "TA0009"
121+
name = "Collection"
122+
reference = "https://attack.mitre.org/tactics/TA0009/"
123+
124+
[rule.new_terms]
125+
field = "new_terms_fields"
126+
value = ["azure.signinlogs.properties.user_principal_name"]
127+
[[rule.new_terms.history_window_start]]
128+
field = "history_window_start"
129+
value = "now-14d"
130+
131+

0 commit comments

Comments
 (0)