Detect Email Addresses in Splunk
Adversaries may gather email addresses that can be used during targeting. Even if internal instances exist, organizations may have public-facing email infrastructure and addresses for employees. Adversaries may gather email addresses from publicly accessible sources such as social media, company websites, and leaked credential databases. Additionally, adversaries may actively enumerate valid email addresses by probing authentication services — for example, querying the Microsoft GetCredentialType API endpoint or Exchange Autodiscover to determine whether a given address is a valid account in Office 365 or on-premises Exchange environments. Gathered email addresses enable spearphishing campaigns, credential brute force attacks, business email compromise, and social engineering operations.
MITRE ATT&CK
- Tactic
- Reconnaissance
- Technique
- T1589 Gather Victim Identity Information
- Sub-technique
- T1589.002 Email Addresses
- Canonical reference
- https://attack.mitre.org/techniques/T1589/002/
SPL Detection Query
index=azure_ad OR index=o365 sourcetype="ms:aad:signin"
(ResultType=50034 OR ResultType=50053 OR ResultType=50055 OR ResultType=50056)
| eval username=coalesce(UserPrincipalName, UserId)
| eval hour_bin=strftime(_time, "%Y-%m-%d %H:00")
| stats
dc(username) as UniqueUsernames,
count as AttemptCount,
values(username) as UsernameSample,
values(AppDisplayName) as AppList,
earliest(_time) as FirstSeen,
latest(_time) as LastSeen
by ClientIP, ClientAppUsed, UserAgent, hour_bin
| where UniqueUsernames >= 10
| eval DurationMinutes=round((LastSeen - FirstSeen) / 60, 1)
| eval DurationMinutes=if(DurationMinutes < 1, 1, DurationMinutes)
| eval EnumerationRatePerMin=round(UniqueUsernames / DurationMinutes, 2)
| eval Verdict=case(
UniqueUsernames >= 50, "High Confidence Enumeration",
UniqueUsernames >= 20, "Moderate Enumeration",
1=1, "Low-Level Enumeration"
)
| eval FirstSeen=strftime(FirstSeen, "%Y-%m-%d %H:%M:%S")
| eval LastSeen=strftime(LastSeen, "%Y-%m-%d %H:%M:%S")
| table hour_bin, ClientIP, ClientAppUsed, UserAgent, UniqueUsernames, AttemptCount, EnumerationRatePerMin, DurationMinutes, Verdict, UsernameSample, AppList, FirstSeen, LastSeen
| sort - UniqueUsernames Detects email address enumeration against Azure AD / Office 365 using the Splunk Add-on for Microsoft Cloud Services (sourcetype ms:aad:signin). Aggregates sign-in failures with error code 50034 (UserAccountNotFound) and related non-credential error codes by source IP and hour, identifying IPs that probe 10 or more unique usernames. Computes an EnumerationRatePerMin velocity metric and assigns a verdict tier for analyst prioritization. Adjust the UniqueUsernames threshold based on baseline authentication failure volume in your environment.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Misconfigured identity federation systems generating bulk 50034 errors during SSO failures across a large user population
- Penetration testing or red team engagements targeting the Office 365 tenant with authorized enumeration tools
- Automated provisioning workflows checking account existence before bulk user creation, particularly during HR system imports
- Password reset portal integrations that validate email addresses against Azure AD at scale
- Monitoring or SIEM integrations that test connectivity using synthetic user accounts that do not exist in the tenant
Other platforms for T1589.002
Testing Methodology
Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Azure AD Email Enumeration via GetCredentialType API (PowerShell)
Expected signal: Sysmon Event ID 1: PowerShell.exe process with CommandLine containing 'GetCredentialType' and 'login.microsoftonline.com'. Sysmon Event ID 3: Outbound network connections from powershell.exe to login.microsoftonline.com (TCP 443). Proxy/web filter logs: HTTP POST to login.microsoftonline.com/common/GetCredentialType with PowerShell User-Agent. DeviceNetworkEvents in MDE: InitiatingProcessFileName=powershell.exe, RemoteUrl containing GetCredentialType.
- Test 2Azure AD Email Enumeration via AADInternals Module
Expected signal: Sysmon Event ID 1: powershell.exe with CommandLine containing 'AADInternals' and 'UserEnumerationAsOutsider'. Sysmon Event ID 3: Network connections to login.microsoftonline.com and related Microsoft AAD endpoints. PowerShell ScriptBlock Log Event ID 4104 capturing the full module invocation. Windows Security Event ID 4688: Process creation for powershell.exe with command line auditing enabled. Proxy logs: HTTP requests with AADInternals User-Agent string to Microsoft authentication endpoints.
- Test 3Email Enumeration via Sign-in Attempt with Non-Existent Accounts (Generates SigninLogs 50034)
Expected signal: Azure AD SigninLogs: 10 entries with ResultType=50034 (UserAccountNotFound) for each probed address, all from the same source IP. These entries are visible in the Azure Portal under Azure AD > Sign-in logs and in Microsoft Sentinel's SigninLogs table within 5-15 minutes. Field ClientAppUsed will show 'Other clients'.
- Test 4OSINT Email Harvesting Simulation via Python Requests (LinkedIn/Web Scraping Pattern)
Expected signal: Sysmon Event ID 1: python3.exe process creation with CommandLine containing 'theHarvester' User-Agent string. Sysmon Event ID 3: Network connections from python3.exe to target hosts over TCP 443/80. DeviceNetworkEvents in MDE: InitiatingProcessFileName=python3.exe, RemoteUrl matching target sites. Proxy logs: HTTP GET requests with theHarvester User-Agent string — this User-Agent string is well-known and often blocked/alerted by web proxies.
- Test 5Exchange Autodiscover Email Validation Probe (curl)
Expected signal: Sysmon Event ID 1: curl.exe process creation with CommandLine containing 'autodiscover' and target email addresses. Sysmon Event ID 3: Outbound network connections from curl.exe to autodiscover.targetdomain.com over TCP 443. Exchange IIS Access Logs (W3SVC): POST requests to /autodiscover/autodiscover.xml with 401 response codes, source IP, and User-Agent 'curl/*'. Windows Security Event ID 4625 (Logon Failure): if Basic Authentication is attempted against Exchange.
References (9)
- https://attack.mitre.org/techniques/T1589/002/
- https://o365blog.com/post/just-looking/
- https://github.com/gremwell/o365enum
- https://grimhacker.com/2017/07/24/office365-activesync-username-enumeration/
- https://www.hackers-arise.com/email-scraping-and-maltego
- https://www.cnet.com/news/massive-breach-leaks-773-million-emails-21-million-passwords/
- https://learn.microsoft.com/en-us/azure/active-directory/reports-monitoring/concept-sign-ins
- https://github.com/dafthack/MSOLSpray
- https://github.com/0xZDH/o365spray
Unlock Pro Content
Get the full detection package for T1589.002 including response playbook, investigation guide, and atomic red team tests.