Azure Entra MFA TOTP Brute Force Attempts

Identifies brute force attempts against Azure Entra multi-factor authentication (MFA) Time-based One-Time Password (TOTP) verification codes. This rule detects high frequency failed TOTP code attempts for a single user in a short time-span. Adversaries with valid credentials, when attempting to login to Azure portal or other Azure services, may be prompted to provide a TOTP code as part of the MFA process. If successful, adversaries can bypass MFA and gain unauthorized access to Azure resources.

Elastic rule (View on GitHub)

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

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.

Review the Source IP Address: - Check the source.ip or azure.signinlogs.caller_ip_address field. - Determine if the IP address is associated with the user’s typical login locations. - Look for unusual geographic patterns or anomalous IP addresses (e.g., proxies, VPNs, or locations outside the user’s normal activity).

Analyze User Activity: - Identify the user from the azure.signinlogs.properties.sign_in_identifier field. - Determine if the user is currently active from another device or session. Session hijacking could explain parallel activity with failed attempts. - Review past logs for the user to determine whether MFA failures or other anomalies are consistent or new.

Inspect the Authentication Method: - Evaluate the azure.signinlogs.properties.mfa_detail.auth_method field: OATH verification code. - Confirm if the user typically uses TOTP codes or another MFA method (e.g., push notifications). - Verify if there are any recent changes to the user’s MFA settings that may explain multiple failed attempts.

Evaluate the User Agent: - Check the user_agent.original field. - Identify if the user agent matches a typical browser or a potentially malicious script (e.g., Python-based). - Look for deviations in operating system or browser versions from the user’s normal activity.

Analyze Conditional Access Policies: - Review the azure.signinlogs.properties.applied_conditional_access_policies for enforced grant controls. - Verify if MFA failures are tied to legitimate security policies (display_name: Require multifactor authentication for admins).

Correlate with Other Events: - Search for other authentication attempts involving the same azure.signinlogs.caller_ip_address, user_principal_name, or azure.signinlogs.properties.app_id. - Look for suspicious activity patterns, such as password resets, privilege escalation, or account lockouts.

  • Unintentional User Behavior:

    • Verify if the failed attempts could result from the user’s unfamiliarity with TOTP codes or issues with device synchronization.
    • Check if the user recently switched MFA methods or devices, which could explain multiple failures.
    • Determine if this is whitebox testing or a developer testing MFA integration.
  • Administrative Actions:

    • Determine if the activity is related to legitimate administrative testing or configuration changes in the MFA system.
  • Immediate Actions:

    • If proven malicious, lock the affected account temporarily to prevent further unauthorized attempts.
    • Notify the user of suspicious activity and validate their access to the account.
    • Reset passwords and MFA settings for the affected user to prevent unauthorized access while communicating with the user.
  • Strengthen Authentication Policies:

    • Ensure conditional access policies are configured to monitor and restrict anomalous login behavior.
    • Consider a different MFA method or additional security controls to prevent future bypass attempts.
  • Monitor and Audit:

    • Implement additional monitoring to track high-frequency authentication failures across the environment.
    • Audit historical logs for similar patterns involving other accounts to identify broader threats.
  • Educate and Train Users:

    • Provide guidance on the secure use of MFA and the importance of recognizing and reporting suspicious activity.

References

Related rules

to-top