Azure AD Authentication Failed During MFA Challenge

Original Source: [splunk source]
Name:Azure AD Authentication Failed During MFA Challenge
id:e62c9c2e-bf51-4719-906c-3074618fcc1c
version:6
date:2024-10-31
author:Mauricio Velazco, Gowthamaraj Rajendran, Splunk, 0xC0FFEEEE
status:production
type:TTP
Description:The following analytic identifies failed authentication attempts against an Azure AD tenant during the Multi-Factor Authentication (MFA) challenge, specifically flagged by error code 500121. It leverages Azure AD SignInLogs to detect these events. This activity is significant as it may indicate an adversary attempting to authenticate using compromised credentials on an account with MFA enabled. If confirmed malicious, this could suggest an ongoing effort to bypass MFA protections, potentially leading to unauthorized access and further compromise of the affected account.
Data_source:
  • -Azure Active Directory
search:`azure_monitor_aad` category=SignInLogs properties.status.errorCode=500121
| rename properties.* as *, authenticationDetails{}.* as *
| eval time=strptime(authenticationStepDateTime, "%Y-%m-%dT%H:%M:%S")
| eval auth_detail=mvzip(strftime(time, "%Y-%m-%dT%H:%M:%S"),authenticationStepResultDetail," - "), auth_msg=mvappend('status.additionalDetails', authenticationStepResultDetail)
| eval auth_method=mvmap(authenticationMethod, if(isnull(mvfind('mfaDetail.authMethod', authenticationMethod)), authenticationMethod, null()))
| stats min(_time) as firstTime, max(_time) as lastTime, values(user) as user, values(src_ip) as src_ip, values(mfaDetail.authMethod) as mfa_method, values(auth_method) as auth_method, values(auth_detail) as auth_detail, values(auth_msg) as auth_msg, values(appDisplayName) as appDisplayName, values(user_agent) as user_agent by tenantId originalRequestId
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| search NOT auth_msg="MFA successfully completed"
| sort 0 - firstTime
| `azure_ad_authentication_failed_during_mfa_challenge_filter`


how_to_implement:You must install the latest version of Splunk Add-on for Microsoft Cloud Services from Splunkbase (https://splunkbase.splunk.com/app/3110/#/details). You must be ingesting Azure Active Directory events into your Splunk environment through an EventHub. This analytic was written to be used with the azure:monitor:aad sourcetype leveraging the SignInLogs log category.
known_false_positives:False positives have been minimized by removing attempts that result in 'MFA successfully completed messages', which were found to be generated when a user opts to use a different MFA method than the default. Further reductions in notable events can be achieved through filtering 'MFA denied; duplicate authentication attempt' messages within the auth_msg field, as they could arguably be considered as false positives.
References:
  -https://attack.mitre.org/techniques/T1621/
  -https://attack.mitre.org/techniques/T1078/004/
  -https://docs.microsoft.com/en-us/azure/active-directory/authentication/concept-mfa-howitworks
  -https://learn.microsoft.com/en-us/entra/identity/monitoring-health/concept-sign-in-log-activity-details
drilldown_searches:
name:'View the detection results for - "$user$"'
search:'%original_detection_search% | search user = "$user$"'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
name:'View risk events for the last 7 days for - "$user$"'
search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$user$") starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
tags:
  analytic_story:
    - 'Azure Active Directory Account Takeover'
  asset_type:Azure Active Directory
  confidence:90
  impact:60
  message:User $user$ failed to pass MFA challenge
  mitre_attack_id:
    - 'T1586'
    - 'T1586.003'
    - 'T1078'
    - 'T1078.004'
    - 'T1621'
  observable:
    name:'user'
    type:'User'
    - role:
      - 'Victim'
    name:'src_ip'
    type:'IP Address'
    - role:
      - 'Attacker'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  required_fields:
    - '_time'
    - 'category'
    - 'properties.status.errorCode'
    - 'user'
    - 'src_ip'
    - 'properties.status.additionalDetails'
    - 'properties.appDisplayName'
    - 'properties.userAgent'
  risk_score:54
  security_domain:identity

tests:
name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1621/azuread/azure-audit.log
  source: Azure AD
  sourcetype: azure:monitor:aad
  update_timestamp: True
manual_test:None