Skip to content

Commit f480e98

Browse files
authored
[New] Concurrent Azure SignIns with Suspicious Properties (#4670)
1 parent 6e3b38c commit f480e98

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
[metadata]
2+
creation_date = "2025/04/28"
3+
integration = ["azure"]
4+
maturity = "production"
5+
updated_date = "2025/04/28"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
Identifies concurrent azure signin events for the same user and from multiple sources, and where one of the authentication
11+
event has some suspicious properties often associated to DeviceCode and OAuth phishing. Adversaries may steal Refresh
12+
Tokens (RTs) via phishing to bypass multi-factor authentication (MFA) and gain unauthorized access to Azure resources.
13+
"""
14+
false_positives = [
15+
"""
16+
Users authenticating from multiple devices and using the deviceCode protocol or the Visual Studio Code client.
17+
""",
18+
]
19+
from = "now-60m"
20+
language = "esql"
21+
license = "Elastic License v2"
22+
name = "Microsoft Entra ID Concurrent Sign-Ins with Suspicious Properties"
23+
note = """## Triage and analysis
24+
25+
### Investigating Microsoft Entra ID Concurrent Sign-Ins with Suspicious Properties
26+
27+
### Possible investigation steps
28+
29+
- Review the sign-in logs to assess the context and reputation of the source.ip address.
30+
- Investigate the user account associated with the successful sign-in to determine if the activity aligns with expected behavior or if it appears suspicious.
31+
- Check for any recent changes or anomalies in the user's account settings or permissions that could indicate compromise.
32+
- Review the history of sign-ins for the user to identify any patterns or unusual access times that could suggest unauthorized access.
33+
- Assess the device from which the sign-in was attempted to ensure it is a recognized and authorized device for the user.
34+
35+
### Response and remediation
36+
37+
- Immediately revoke the compromised Primary Refresh Tokens (PRTs) to prevent further unauthorized access. This can be done through the Azure portal by navigating to the user's account and invalidating all active sessions.
38+
- Enforce a password reset for the affected user accounts to ensure that any credentials potentially compromised during the attack are no longer valid.
39+
- Implement additional Conditional Access policies that require device compliance checks and restrict access to trusted locations or devices only, to mitigate the risk of future PRT abuse.
40+
- Conduct a thorough review of the affected accounts' recent activity logs to identify any unauthorized actions or data access that may have occurred during the compromise.
41+
- Escalate the incident to the security operations team for further investigation and to determine if there are any broader implications or additional compromised accounts.
42+
- Enhance monitoring by configuring alerts for unusual sign-in patterns or device code authentication attempts from unexpected locations or devices, to improve early detection of similar threats.
43+
- Coordinate with the incident response team to perform a post-incident analysis and update the incident response plan with lessons learned from this event."""
44+
references = [
45+
"https://learn.microsoft.com/en-us/entra/identity/",
46+
"https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-sign-ins",
47+
"https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/reference-azure-monitor-sign-ins-log-schema",
48+
"https://www.volexity.com/blog/2025/04/22/phishing-for-codes-russian-threat-actors-target-microsoft-365-oauth-workflows/"
49+
]
50+
risk_score = 73
51+
rule_id = "e3bd85e9-7aff-46eb-b60e-20dfc9020d98"
52+
setup = """#### Required Azure Entra Sign-In Logs
53+
This rule requires the Azure logs integration be enabled and configured to collect all logs, including sign-in logs from Entra. In Entra, sign-in logs must be enabled and streaming to the Event Hub used for the Azure logs integration.
54+
"""
55+
severity = "high"
56+
tags = [
57+
"Domain: Cloud",
58+
"Domain: SaaS",
59+
"Data Source: Azure",
60+
"Data Source: Entra ID",
61+
"Data Source: Entra ID Sign-in",
62+
"Use Case: Identity and Access Audit",
63+
"Use Case: Threat Detection",
64+
"Tactic: Credential Access",
65+
"Resources: Investigation Guide",
66+
]
67+
timestamp_override = "event.ingested"
68+
type = "esql"
69+
70+
query = '''
71+
FROM logs-azure.signinlogs* metadata _id, _version, _index
72+
// the rule is scheduled to run every hour and looks for events occured during last 1 hour.
73+
| where @timestamp > NOW() - 1 hours
74+
| where event.dataset == "azure.signinlogs" and source.ip is not null and azure.signinlogs.identity is not null and to_lower(event.outcome) == "success"
75+
| keep @timestamp, azure.signinlogs.identity, source.ip, azure.signinlogs.properties.authentication_requirement, azure.signinlogs.properties.app_id, azure.signinlogs.properties.resource_display_name, azure.signinlogs.properties.authentication_protocol, azure.signinlogs.properties.app_display_name
76+
// devicecode authentication no MFA
77+
| eval device_code = case(azure.signinlogs.properties.authentication_protocol == "deviceCode" and azure.signinlogs.properties.authentication_requirement != "multiFactorAuthentication", azure.signinlogs.identity, null),
78+
// potential Visual Studio Code OAuth code phish - sign-in events with client set to Visual Studio Code
79+
visual_studio = case(azure.signinlogs.properties.app_id == "aebc6443-996d-45c2-90f0-388ff96faa56" and azure.signinlogs.properties.resource_display_name == "Microsoft Graph", azure.signinlogs.identity, null),
80+
// Other sign-in events
81+
other = case(azure.signinlogs.properties.authentication_protocol != "deviceCode" and azure.signinlogs.properties.app_id != "aebc6443-996d-45c2-90f0-388ff96faa56", azure.signinlogs.identity, null)
82+
| stats total = COUNT(*), device_code_count = COUNT_DISTINCT(device_code), vsc = count_distinct(visual_studio), other_count = COUNT_DISTINCT(other), src_ip = COUNT_DISTINCT(source.ip), ips = values(source.ip), clients = values(azure.signinlogs.properties.app_display_name), resources = VALUES(azure.signinlogs.properties.resource_display_name), auth_requirement = VALUES(azure.signinlogs.properties.authentication_requirement) by azure.signinlogs.identity
83+
// 2 unique source.ip for same account - which may indicate the presence 2 sign-ins one by the adversary and the other by the victim
84+
| where src_ip >= 2 and (device_code_count > 0 or vsc >0)
85+
'''
86+
87+
88+
[[rule.threat]]
89+
framework = "MITRE ATT&CK"
90+
[[rule.threat.technique]]
91+
id = "T1528"
92+
name = "Steal Application Access Token"
93+
reference = "https://attack.mitre.org/techniques/T1528/"
94+
95+
96+
[rule.threat.tactic]
97+
id = "TA0006"
98+
name = "Credential Access"
99+
reference = "https://attack.mitre.org/tactics/TA0006/"
100+

0 commit comments

Comments
 (0)