O365 Multi-Source Failed Authentications Spike

Original Source: [splunk source]
Name:O365 Multi-Source Failed Authentications Spike
id:ea4e2c41-dbfb-4f5f-a7b6-9ac1b7f104aa
version:7
date:2025-02-10
author:Mauricio Velazco, Splunk
status:production
type:Hunting
Description:The following analytic identifies a spike in failed authentication attempts within an Office 365 environment, indicative of a potential distributed password spraying attack. It leverages UserLoginFailed events from O365 Management Activity logs, focusing on ErrorNumber 50126. This detection is significant as it highlights attempts to bypass security controls using multiple IP addresses and user agents. If confirmed malicious, this activity could lead to unauthorized access, data breaches, privilege escalation, and lateral movement within the organization. Early detection is crucial to prevent account takeovers and mitigate subsequent threats.
Data_source:
  • -O365 UserLoginFailed
search:`o365_management_activity` Workload=AzureActiveDirectory Operation=UserLoginFailed ErrorNumber=50126
| bucket span=5m _time
| eval uniqueIPUserCombo = src_ip . "-" . user
| fillnull
| stats earliest(_time) as firstTime max(_time) as lastTime dc(uniqueIPUserCombo) as uniqueIpUserCombinations, dc(user) as uniqueUsers, dc(src_ip) as uniqueIPs, values(user) as user, values(src_ip) as ips, values(user_agent) as user_agents values(signature) as signature values(src) as src values(dest) as dest by _time vendor_account vendor_product
| where uniqueIpUserCombinations > 20 AND uniqueUsers > 20 AND uniqueIPs > 20
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `o365_multi_source_failed_authentications_spike_filter`


how_to_implement:You must install the Splunk Microsoft Office 365 Add-on and ingest Office 365 management activity events. The thresholds set within the analytic (such as unique IPs, unique users, etc.) are initial guidelines and should be customized based on the organization's user behavior and risk profile. Security teams are encouraged to adjust these thresholds to optimize the balance between detecting genuine threats and minimizing false positives, ensuring the detection is tailored to their specific environment.
known_false_positives:This detection may yield false positives in scenarios where legitimate bulk sign-in activities occur, such as during company-wide system updates or when users are accessing resources from varying locations in a short time frame, such as in the case of VPNs or cloud services that rotate IP addresses. Filter as needed.
References:
  -https://attack.mitre.org/techniques/T1110/003/
  -https://docs.microsoft.com/en-us/security/compass/incident-response-playbook-password-spray
  -https://www.cisa.gov/uscert/ncas/alerts/aa21-008a
  -https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes
drilldown_searches:
  :
tags:
  analytic_story:
    - 'Office 365 Account Takeover'
    - 'NOBELIUM Group'
  asset_type:O365 Tenant
  atomic_guid:
  mitre_attack_id:
    - 'T1110.003'
    - 'T1110.004'
    - 'T1586.003'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  security_domain:identity

tests:
name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1110.003/o365_distributed_spray/o365_distributed_spray.log
  source: o365
  sourcetype: o365:management:activity
manual_test:None