Skip to content

Commit 2987349

Browse files
Merge branch 'main' into new-hunt-aws-iam-unusual-access-key-usage
2 parents c216b33 + 0a74007 commit 2987349

File tree

1 file changed

+158
-0
lines changed

1 file changed

+158
-0
lines changed
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
[metadata]
2+
creation_date = "2024/12/11"
3+
integration = ["azure"]
4+
maturity = "production"
5+
min_stack_comments = "ES|QL not available until 8.13.0 in technical preview."
6+
min_stack_version = "8.13.0"
7+
updated_date = "2024/12/11"
8+
9+
[rule]
10+
author = ["Elastic"]
11+
description = """
12+
Identifies brute force attempts against Azure Entra multi-factor authentication (MFA) Time-based One-Time Password
13+
(TOTP) verification codes. This rule detects high frequency failed TOTP code attempts for a single user in a short
14+
time-span. Adversaries with valid credentials, when attempting to login to Azure portal or other Azure services, may be
15+
prompted to provide a TOTP code as part of the MFA process. If successful, adversaries can bypass MFA and gain
16+
unauthorized access to Azure resources.
17+
"""
18+
false_positives = [
19+
"""
20+
Based on the high-frequency threshold, it would be unlikely for a legitimate user to exceed the threshold for failed
21+
TOTP code attempts in a short time-span.
22+
""",
23+
]
24+
from = "now-9m"
25+
language = "esql"
26+
license = "Elastic License v2"
27+
name = "Azure Entra MFA TOTP Brute Force Attempts"
28+
note = """## Triage and Analysis
29+
30+
### Investigating Azure Entra MFA TOTP Brute Force Attempts
31+
32+
This rule detects high-frequency failed TOTP code attempts for a single user in a short time span. Such behavior could indicate an adversary attempting to bypass multi-factor authentication (MFA) protections using valid credentials. Understanding the context of the user's typical behavior and identifying anomalies in the log data are critical to determining the nature of the activity.
33+
34+
#### Possible Investigation Steps:
35+
36+
**Review the Source IP Address**:
37+
- Check the `source.ip` or `azure.signinlogs.caller_ip_address` field.
38+
- Determine if the IP address is associated with the user’s typical login locations.
39+
- Look for unusual geographic patterns or anomalous IP addresses (e.g., proxies, VPNs, or locations outside the user’s normal activity).
40+
41+
**Analyze User Activity**:
42+
- Identify the user from the `azure.signinlogs.properties.sign_in_identifier` field.
43+
- Determine if the user is currently active from another device or session. Session hijacking could explain parallel activity with failed attempts.
44+
- Review past logs for the user to determine whether MFA failures or other anomalies are consistent or new.
45+
46+
**Inspect the Authentication Method**:
47+
- Evaluate the `azure.signinlogs.properties.mfa_detail.auth_method` field: `OATH verification code`.
48+
- Confirm if the user typically uses TOTP codes or another MFA method (e.g., push notifications).
49+
- Verify if there are any recent changes to the user’s MFA settings that may explain multiple failed attempts.
50+
51+
**Evaluate the User Agent**:
52+
- Check the `user_agent.original` field.
53+
- Identify if the user agent matches a typical browser or a potentially malicious script (e.g., Python-based).
54+
- Look for deviations in operating system or browser versions from the user’s normal activity.
55+
56+
**Analyze Conditional Access Policies**:
57+
- Review the `azure.signinlogs.properties.applied_conditional_access_policies` for enforced grant controls.
58+
- Verify if MFA failures are tied to legitimate security policies (`display_name: Require multifactor authentication for admins`).
59+
60+
**Correlate with Other Events**:
61+
- Search for other authentication attempts involving the same `azure.signinlogs.caller_ip_address`, `user_principal_name`, or `azure.signinlogs.properties.app_id`.
62+
- Look for suspicious activity patterns, such as password resets, privilege escalation, or account lockouts.
63+
64+
65+
#### False Positive Analysis:
66+
67+
- **Unintentional User Behavior**:
68+
- Verify if the failed attempts could result from the user’s unfamiliarity with TOTP codes or issues with device synchronization.
69+
- Check if the user recently switched MFA methods or devices, which could explain multiple failures.
70+
- Determine if this is whitebox testing or a developer testing MFA integration.
71+
72+
- **Administrative Actions**:
73+
- Determine if the activity is related to legitimate administrative testing or configuration changes in the MFA system.
74+
75+
#### Response and Remediation:
76+
77+
- **Immediate Actions**:
78+
- If proven malicious, lock the affected account temporarily to prevent further unauthorized attempts.
79+
- Notify the user of suspicious activity and validate their access to the account.
80+
- Reset passwords and MFA settings for the affected user to prevent unauthorized access while communicating with the user.
81+
82+
- **Strengthen Authentication Policies**:
83+
- Ensure conditional access policies are configured to monitor and restrict anomalous login behavior.
84+
- Consider a different MFA method or additional security controls to prevent future bypass attempts.
85+
86+
- **Monitor and Audit**:
87+
- Implement additional monitoring to track high-frequency authentication failures across the environment.
88+
- Audit historical logs for similar patterns involving other accounts to identify broader threats.
89+
90+
- **Educate and Train Users**:
91+
- Provide guidance on the secure use of MFA and the importance of recognizing and reporting suspicious activity.
92+
"""
93+
references = [
94+
"https://www.oasis.security/resources/blog/oasis-security-research-team-discovers-microsoft-azure-mfa-bypass",
95+
"https://learn.microsoft.com/en-us/entra/identity/",
96+
"https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-sign-ins",
97+
]
98+
risk_score = 47
99+
rule_id = "3fac01b2-b811-11ef-b25b-f661ea17fbce"
100+
setup = """#### Required Azure Entra Sign-In Logs
101+
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.
102+
"""
103+
severity = "medium"
104+
tags = [
105+
"Domain: Cloud",
106+
"Domain: SaaS",
107+
"Data Source: Azure",
108+
"Data Source: Entra ID",
109+
"Data Source: Entra ID Sign-in",
110+
"Use Case: Identity and Access Audit",
111+
"Use Case: Threat Detection",
112+
"Tactic: Credential Access",
113+
]
114+
timestamp_override = "event.ingested"
115+
type = "esql"
116+
117+
query = '''
118+
from logs-azure.signinlogs* metadata _id, _version, _index
119+
| where
120+
// filter for Entra Sign-In Logs
121+
event.dataset == "azure.signinlogs"
122+
and azure.signinlogs.operation_name == "Sign-in activity"
123+
124+
// filter for MFA attempts with OATH conditional access attempts or TOTP
125+
and azure.signinlogs.properties.authentication_requirement == "multiFactorAuthentication"
126+
and azure.signinlogs.properties.mfa_detail.auth_method == "OATH verification code"
127+
128+
// filter on failures only from brute-force attempts
129+
and azure.signinlogs.properties.conditional_access_status == "failure"
130+
and azure.signinlogs.result_description == "Authentication failed during strong authentication request."
131+
| keep azure.signinlogs.properties.sign_in_identifier
132+
| stats
133+
// aggregate by the sign-in account or principal
134+
failed_totp_code_attempts = count(*) by azure.signinlogs.properties.sign_in_identifier
135+
| where
136+
// filter on high frequency for a single user
137+
failed_totp_code_attempts > 30
138+
'''
139+
140+
141+
[[rule.threat]]
142+
framework = "MITRE ATT&CK"
143+
[[rule.threat.technique]]
144+
id = "T1110"
145+
name = "Brute Force"
146+
reference = "https://attack.mitre.org/techniques/T1110/"
147+
[[rule.threat.technique.subtechnique]]
148+
id = "T1110.001"
149+
name = "Password Guessing"
150+
reference = "https://attack.mitre.org/techniques/T1110/001/"
151+
152+
153+
154+
[rule.threat.tactic]
155+
id = "TA0006"
156+
name = "Credential Access"
157+
reference = "https://attack.mitre.org/tactics/TA0006/"
158+

0 commit comments

Comments
 (0)