Skip to content

Commit e3a7ee9

Browse files
[Rule Tuning] Microsoft Entra ID Suspicious Session Reuse to Graph Access (#4954)
* adjusted query * add keep; lint * Update rules/integrations/azure/initial_access_entra_graph_single_session_from_multiple_addresses.toml Co-authored-by: Jonhnathan <[email protected]> --------- Co-authored-by: Jonhnathan <[email protected]>
1 parent 8f441a7 commit e3a7ee9

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

rules/integrations/azure/initial_access_entra_graph_single_session_from_multiple_addresses.toml

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
creation_date = "2025/05/08"
33
integration = ["azure"]
44
maturity = "production"
5-
updated_date = "2025/07/16"
5+
updated_date = "2025/07/31"
6+
67

78
[rule]
89
author = ["Elastic"]
910
description = """
1011
Identifies potential session hijacking or token replay in Microsoft Entra ID. This rule detects cases where a user signs
11-
in and subsequently accesses Microsoft Graph from a different IP address using the same session ID within a short time
12-
window. This may indicate the use of a stolen refresh/access token or session cookie to impersonate the user and
13-
interact with Microsoft services.
12+
in and subsequently accesses Microsoft Graph from a different IP address using the same session ID. This may indicate a
13+
successful OAuth phishing attack, session hijacking, or token replay attack, where an adversary has stolen a session
14+
cookie or refresh/access token and is impersonating the user from an alternate host or location.
1415
"""
1516
false_positives = [
1617
"""
@@ -20,40 +21,39 @@ false_positives = [
2021
are involved.
2122
""",
2223
]
23-
from = "now-1h"
24+
from = "now-31m"
25+
interval = "30m"
2426
language = "esql"
2527
license = "Elastic License v2"
26-
name = "Microsoft Entra ID Session Reuse with Suspicious Graph Access"
28+
name = "Microsoft Entra ID Suspicious Session Reuse to Graph Access"
2729
note = """## Triage and analysis
2830
29-
### Investigating Microsoft Entra ID Session Reuse with Suspicious Graph Access
31+
### Investigating Microsoft Entra ID Suspicious Session Reuse to Graph Access
3032
31-
This rule identifies when Microsoft Graph is accessed from a different IP than the one used for the original sign-in,
32-
but using the same session ID within 5 minutes. This may suggest an adversary has stolen a session cookie or refresh/access
33-
token and is impersonating the user from an alternate host or location.
33+
Identifies potential session hijacking or token replay in Microsoft Entra ID. This rule detects cases where a user signs in and subsequently accesses Microsoft Graph from a different IP address using the same session ID. This may indicate a successful OAuth phishing attack, session hijacking, or token replay attack, where an adversary has stolen a session cookie or refresh/access token and is impersonating the user from an alternate host or location.
3434
3535
This rule uses ESQL aggregations and thus has dynamically generated fields. Correlation of the values in the alert document may need to be
3636
performed to the original sign-in and Graph events for further context.
3737
3838
### Investigation Steps
3939
40-
- Review the `user_id`, `session_id`, and `source_ip_list`. Confirm whether both IPs belong to the same user and geography.
41-
- Check for inconsistencies in `client_id_list` (e.g., unknown apps) or user agents across correlated events.
42-
- Investigate recent phishing reports or device infections for the `user_id`.
43-
- Pivot to Entra ID `auditlogs` to see if a device was registered or privileges were modified.
44-
- Review `graph_time` to determine what action was taken after the sign-in.
45-
- Use the `session_id` to correlate with other logs in the same time window to identify any additional suspicious activity.
40+
- This rule relies on an aggregation-based ESQL query, therefore the alert document will contain dynamically generated fields.
41+
- To pivot into the original events, it is recommended to use the values captured to filter in timeline or discovery for the original sign-in and Graph events.
42+
- Review the session ID and user ID to identify the user account involved in the suspicious activity.
43+
- Check the source addresses involved in the sign-in and Graph access to determine if they are known or expected locations for the user.
44+
- The sign-in source addresses should be two, one for the initial phishing sign-in and the other when exchanging the auth code for a token by the adversary.
45+
- The Graph API source address should identify the IP address used by the adversary to access Microsoft Graph.
46+
- Review the user agent strings for the sign-in and Graph access events to identify any anomalies or indicators of compromise.
47+
- Check the timestamp difference between the sign-in and Graph access events to determine if they occurred within a reasonable time frame that would suggest successful phishing to token issuance and then Graph access.
48+
- Identify the original sign-in event to investigation if conditional access policies were applied, such as requiring multi-factor authentication or blocking access from risky locations. In phishing scenarios, these policies likely were applied as the victim user would have been prompted to authenticate.
4649
4750
### False Positive Analysis
48-
- This pattern may occur if the user is switching between networks (e.g., corporate to mobile) or using a VPN.
49-
- Developers or power users leveraging multiple environments may also trigger this detection if session persistence spans IP ranges.
50-
- However, this behavior is rare and warrants investigation when rapid IP switching and Graph access are involved.
51-
- If the user is a developer or automation engineer, validate if this behavior was for testing purposes.
52-
- If the user is a system administrator, validate if this behavior was for administrative purposes.
51+
- This pattern may occur during legitimate device switching or roaming between networks (e.g., corporate to mobile).
52+
- Developers or power users leveraging multiple environments may also trigger this detection if session persistence spans IP ranges. Still, this behavior is rare and warrants investigation when rapid IP switching and Graph access are involved.
5353
5454
### Response Recommendations
5555
56-
- If confirmed malicious, revoke all refresh/access tokens for the `user_id`.
56+
- If confirmed malicious, revoke all refresh/access tokens for the user principal.
5757
- Block the source IP(s) involved in the Graph access.
5858
- Notify the user and reset credentials.
5959
- Review session control policies and conditional access enforcement.
@@ -65,14 +65,16 @@ references = [
6565
"https://github.com/dirkjanm/ROADtools",
6666
"https://attack.mitre.org/techniques/T1078/004/",
6767
]
68-
risk_score = 73
68+
risk_score = 47
6969
rule_id = "0d3d2254-2b4a-11f0-a019-f661ea17fbcc"
7070
setup = """#### Required Microsoft Entra ID Sign-In and Graph Activity Logs
7171
This rule requires the Microsoft Entra ID Sign-In Logs and Microsoft Graph Activity Logs integration to be enabled and configured to collect audit and activity logs via Azure Event Hub.
7272
"""
73-
severity = "high"
73+
severity = "medium"
7474
tags = [
7575
"Domain: Cloud",
76+
"Domain: Identity",
77+
"Domain: API",
7678
"Data Source: Azure",
7779
"Data Source: Microsoft Entra ID",
7880
"Data Source: Microsoft Entra ID Sign-In Logs",
@@ -88,7 +90,7 @@ timestamp_override = "event.ingested"
8890
type = "esql"
8991

9092
query = '''
91-
from logs-azure.*
93+
from logs-azure.signinlogs-*, logs-azure.graphactivitylogs-* metadata _id, _version, _index
9294
| where
9395
(event.dataset == "azure.signinlogs"
9496
and source.`as`.organization.name != "MICROSOFT-CORP-MSN-as-BLOCK"

0 commit comments

Comments
 (0)