Detect Social Media Accounts in Splunk
Adversaries may compromise existing social media accounts to conduct operations against target organizations. Rather than creating new personas, adversaries compromise legitimate accounts to leverage existing trust relationships and follower networks. Compromised accounts are used to deliver spearphishing messages via social platforms (T1566.003), conduct OAuth-based initial access attacks, or establish connections with target employees as a precursor to further social engineering. Threat groups including Sandworm Team (credential capture webpages) and Leviathan/APT40 (social engineering campaigns) have leveraged compromised social media accounts in operations. Detection focuses on observable effects when compromised accounts interact with the organization: anomalous OAuth authentication events using social identity providers, suspicious OAuth consent grants that may follow social media phishing, and Microsoft Defender for Cloud Apps anomalies on monitored corporate social accounts.
MITRE ATT&CK
- Tactic
- Resource Development
- Technique
- T1586 Compromise Accounts
- Sub-technique
- T1586.001 Social Media Accounts
- Canonical reference
- https://attack.mitre.org/techniques/T1586/001/
SPL Detection Query
index=o365 sourcetype="ms:o365:management"
(Operation="Consent to application" OR Operation="Add OAuth2PermissionGrant"
OR Operation="Add service principal" OR Operation="Add delegation entry"
OR Operation="Add app role assignment to service principal")
| rex field=_raw "\"Scope\":\"(?<GrantedScopes>[^\"]+)\""
| rex field=_raw "\"ApplicationName\":\"(?<AppName>[^\"]+)\""
| rex field=_raw "\"ConsentType\":\"(?<ConsentType>[^\"]+)\""
| rex field=_raw "\"ApplicationId\":\"(?<ApplicationId>[^\"]+)\""
| eval UserId=coalesce(UserId, ObjectId, "unknown")
| eval HighPrivScopes=if(
match(GrantedScopes, "(Mail\.ReadWrite|Mail\.Read(?!\.Basic)|Contacts\.ReadWrite|Files\.ReadWrite\.All|Directory\.ReadWrite|RoleManagement\.ReadWrite|offline_access|User\.Read\.All|MailboxSettings\.ReadWrite|EWS\.AccessAsUser\.All)"),
1, 0)
| eval AdminConsent=if(ConsentType="AllPrincipals", 1, 0)
| eval RiskScore=0
| eval RiskScore=RiskScore + if(HighPrivScopes=1, 2, 0)
| eval RiskScore=RiskScore + if(AdminConsent=1, 3, 0)
| eval RiskScore=RiskScore + if(AdminConsent=1 AND HighPrivScopes=1, 2, 0)
| where RiskScore > 0
| table _time, UserId, Operation, AppName, ApplicationId, ConsentType, GrantedScopes, HighPrivScopes, AdminConsent, RiskScore, ClientIP
| sort - RiskScore - _time Detects suspicious OAuth consent grants in Microsoft 365 that may follow social media spearphishing delivered via a compromised account. Adversaries using compromised social media accounts commonly deliver OAuth phishing links (often disguised as content shared by a trusted contact) that trick victims into granting application permissions. Monitors the O365 Unified Audit Log for consent grant operations, flags high-privilege scope grants (Mail.Read/Write, Contacts, Files, Directory, offline_access), and scores risk based on consent type (AllPrincipals admin consent is highest risk). An employee clicking a phishing link from a compromised LinkedIn or Twitter account and approving OAuth permissions would generate exactly these audit events.
Data Sources
Required Sourcetypes
False Positives & Tuning
- IT administrators legitimately granting tenant-wide OAuth permissions to approved enterprise applications during onboarding or integration projects
- Developers registering new applications and granting initial permissions to sandbox, development, or staging tenants
- End users consenting to legitimate productivity and SaaS applications that are integrated with Microsoft 365 through sanctioned vendor onboarding processes
- Automated provisioning systems (Entra ID Governance, lifecycle workflows) that use service principal OAuth grants for cross-tenant resource access
Other platforms for T1586.001
Testing Methodology
Validate this detection against 4 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 1Simulate OAuth Consent Grant Following Social Media Phishing Link
Expected signal: Azure AD AuditLogs: OperationName='Add application' showing new app registration with AppName matching df00tech-oauth-test-*. If test user navigates to URL and consents: SigninLogs entry for test user with AppDisplayName matching test app, followed by AuditLogs OperationName='Consent to application' with Scope='Mail.Read Contacts.Read offline_access'. Microsoft Defender for Cloud Apps will generate an OAuth app governance alert if MCAS is configured with tenant OAuth monitoring.
- Test 2Test Anomalous Social Identity Provider Sign-in Detection
Expected signal: Azure AD SigninLogs: entry with IdentityProvider='github' (or Microsoft external identity), UserAgent containing 'Googlebot', DeviceDetail.browser='Other' or unknown classification, DeviceDetail.isCompliant='false' (non-MDM device). Azure AD risk engine may flag as 'unfamiliarFeatures' risk detection, incrementing RiskLevelAggregated. The sign-in will result in a redirect (not a full authentication) but is still captured in logs.
- Test 3Credential Stuffing Simulation Against Social Identity Federated Account
Expected signal: Azure AD SigninLogs: 5 entries with ResultType=50126 (AADSTS50126: Invalid username or password) or 50053 (AADSTS50053: account locked) for TEST_USER within a 20-second window. IPAddress and UserAgent fields match curl defaults. Azure AD Identity Protection may generate 'Password spray' or 'Leaked credentials' risk detection. This simulates the upstream account compromise that precedes T1586.001 use against a victim organization.
- Test 4Corporate Social Media Account Exposure Enumeration (Authorized OSINT)
Expected signal: DNS queries to linkedin.com, github.com from the network running this script — visible in proxy and DNS logs. No authentication events generated against the target organization's Azure AD. GitHub API calls logged in GitHub audit log if an org membership query is made.
References (10)
- https://attack.mitre.org/techniques/T1586/001/
- https://arstechnica.com/tech-policy/2011/02/anonymous-speaks-the-inside-story-of-the-hbgary-hack/
- https://www.securityweek.com/iranian-hackers-targeted-us-officials-elaborate-social-media-attack-operation
- http://media.blackhat.com/bh-us-10/whitepapers/Ryan/BlackHat-USA-2010-Ryan-Getting-In-Bed-With-Robin-Sage-v1.0.pdf
- https://www.cisa.gov/sites/default/files/publications/AA21-200A.pdf
- https://learn.microsoft.com/en-us/azure/active-directory/reports-monitoring/reference-azure-monitor-sign-ins-log-schema
- https://learn.microsoft.com/en-us/defender-cloud-apps/tutorial-suspicious-activity
- https://learn.microsoft.com/en-us/azure/active-directory/identity-protection/overview-identity-protection
- https://learn.microsoft.com/en-us/microsoft-365/compliance/audit-log-activities
- https://learn.microsoft.com/en-us/azure/active-directory/manage-apps/configure-admin-consent-workflow
Unlock Pro Content
Get the full detection package for T1586.001 including response playbook, investigation guide, and atomic red team tests.