T1586.001 Google Chronicle · YARA-L

Detect Social Media Accounts in Google Chronicle

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/

YARA-L Detection Query

Google Chronicle (YARA-L)
yaral
rule social_media_account_compromise_t1586_001 {
  meta:
    author = "Detection Engineering"
    description = "Detects T1586.001: successful social identity provider OAuth authentication followed within 4 hours by a high-privilege scope consent grant from the same user. Models the post-compromise OAuth phishing chain used by Leviathan/APT40 and Sandworm: compromise social account, use it to phish OAuth consent, gain persistent delegated access to corporate resources."
    mitre_attack_tactic = "Resource Development"
    mitre_attack_technique = "T1586.001"
    severity = "HIGH"
    confidence = "MEDIUM"
    created = "2024-01-01"
    platforms = "Azure AD, Microsoft 365"
    references = "https://attack.mitre.org/techniques/T1586/001/"

  events:
    // Stage 1: Successful social identity provider sign-in with risk indicator
    $signin.metadata.event_type = "USER_LOGIN"
    $signin.metadata.vendor_name = "Microsoft"
    $signin.security_result.severity != "INFORMATIONAL"
    (
      re.regex($signin.network.application_protocol_version, `(?i)(google|facebook|linkedin|twitter|github|slack|yahoo)`) or
      re.regex($signin.target.application.name, `(?i)(google|facebook|linkedin|twitter|github|slack|yahoo)`) or
      re.regex($signin.extensions.auth.auth_details, `(?i)identityprovider.*(google|facebook|linkedin|twitter|github|slack|yahoo)`)
    )
    (
      $signin.principal.ip_geo_artifact.location.country_or_region = "CN" or
      $signin.principal.ip_geo_artifact.location.country_or_region = "RU" or
      $signin.principal.ip_geo_artifact.location.country_or_region = "IR" or
      $signin.principal.ip_geo_artifact.location.country_or_region = "KP" or
      $signin.principal.ip_geo_artifact.location.country_or_region = "BY" or
      $signin.security_result.risk_score > 50 or
      re.regex($signin.security_result.threat_name, `(?i)(anonymizedIP|impossibleTravel|maliciousIP|leakedCredentials|unfamiliarFeatures)`)
    )
    $signin.principal.user.email_addresses[0] = $user_email

    // Stage 2: High-privilege OAuth consent grant within 4 hours of sign-in
    $consent.metadata.event_type = "USER_RESOURCE_ACCESS"
    $consent.metadata.vendor_name = "Microsoft"
    (
      $consent.metadata.product_event_type = "Consent to application" or
      $consent.metadata.product_event_type = "Add OAuth2PermissionGrant" or
      $consent.metadata.product_event_type = "Add service principal" or
      $consent.metadata.product_event_type = "Add delegation entry"
    )
    (
      re.regex($consent.target.resource.attribute.labels.value, `(?i)(Mail\.ReadWrite|Files\.ReadWrite\.All|Directory\.ReadWrite|RoleManagement\.ReadWrite\.All|User\.Read\.All|EWS\.AccessAsUser\.All|MailboxSettings\.ReadWrite)`) or
      $consent.target.resource.attribute.labels["consent_type"] = "AllPrincipals"
    )
    $consent.principal.user.email_addresses[0] = $user_email

    // Temporal: consent follows sign-in within 4-hour window
    $signin.metadata.event_timestamp.seconds <= $consent.metadata.event_timestamp.seconds
    $consent.metadata.event_timestamp.seconds <= $signin.metadata.event_timestamp.seconds + 14400

  condition:
    $signin and $consent
}
high severity medium confidence

Chronicle YARA-L 2.0 rule correlating the two-stage T1586.001 attack pattern across UDM events: a social identity provider sign-in with elevated risk signals (high-risk geolocation, anomalous risk event types, elevated risk score) followed within 4 hours by a high-privilege OAuth scope consent grant from the same user email. Sequence correlation eliminates the high false positive rate of either signal in isolation.

Data Sources

Google Chronicle UDM — Microsoft Azure AD authentication events (USER_LOGIN)Google Chronicle UDM — Microsoft 365 Unified Audit events (USER_RESOURCE_ACCESS)

Required Tables

UDM event types: USER_LOGIN, USER_RESOURCE_ACCESS

False Positives & Tuning

  • Employees using LinkedIn Learning or Google Workspace SSO for corporate access who subsequently approve Teams or SharePoint integrations, particularly when traveling internationally for legitimate business
  • IT administrators federating new identity providers as part of an approved SSO migration project — the new IdP configuration test may generate both social sign-in events and broad consent grants
  • New employee onboarding in organizations using social identity for initial account bootstrap, where the IT helpdesk performs admin consent on behalf of new users for approved productivity suites
Download portable Sigma rule (.yml)

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.

  1. 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.

  2. 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.

  3. 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.

  4. 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.

Unlock Pro Content

Get the full detection package for T1586.001 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections