T1078.004

Cloud Accounts

Valid cloud accounts may be leveraged by adversaries to achieve Initial Access, Persistence, Privilege Escalation, or Defense Evasion in cloud environments. Adversaries may obtain cloud credentials through phishing, brute force, credential theft from endpoints, or by compromising on-premises identity infrastructure federated with cloud services. Once in possession of valid credentials, adversaries can authenticate to cloud management planes (Azure, AWS, GCP), SaaS applications (Microsoft 365, Google Workspace), or identity providers (Entra ID, Okta) and operate as legitimate users. Techniques include abusing service principals, managed identities, OAuth tokens, and API keys to maintain persistence and move laterally across cloud resources.

Microsoft Sentinel / Defender
kusto
// T1078.004 - Cloud Accounts: Detect suspicious cloud account usage patterns
// Covers: impossible travel, new country logins, legacy auth, service principal abuse, and suspicious MFA patterns
let LookbackPeriod = 24h;
let SuspiciousCountries = dynamic(["KP", "IR", "RU", "CN", "BY"]);
let LegacyAuthClients = dynamic([
  "IMAP", "POP3", "SMTP", "BasicAuth", "ExchangeActiveSync",
  "AutoDiscover", "Exchange Web Services", "Office Protocol",
  "Authenticated SMTP", "Outlook Anywhere"
]);
// Section 1: Suspicious sign-ins from unusual locations or legacy auth
let SuspiciousSignins = SigninLogs
| where TimeGenerated > ago(LookbackPeriod)
| where ResultType == 0  // Successful sign-in
| extend Country = tostring(LocationDetails.countryOrRegion)
| extend City = tostring(LocationDetails.city)
| extend ClientApp = tostring(ClientAppUsed)
| extend IsLegacyAuth = ClientApp has_any (LegacyAuthClients)
| extend IsSuspiciousCountry = Country in (SuspiciousCountries)
| extend IsHighRisk = RiskLevelDuringSignIn in ("high", "medium")
| extend IsMFANotPerformed = AuthenticationRequirement == "singleFactorAuthentication" and ConditionalAccessStatus != "notApplied"
| where IsLegacyAuth or IsSuspiciousCountry or IsHighRisk or IsMFANotPerformed
| project TimeGenerated, UserPrincipalName, UserId, AppDisplayName, IPAddress,
          Country, City, ClientApp, IsLegacyAuth, IsSuspiciousCountry,
          IsHighRisk, IsMFANotPerformed, RiskLevelDuringSignIn,
          ConditionalAccessStatus, UserAgent, CorrelationId;
// Section 2: Service Principal sign-ins outside expected patterns
let SPSignins = AADServicePrincipalSignInLogs
| where TimeGenerated > ago(LookbackPeriod)
| where ResultType == 0
| summarize SigninCount = count(), UniqueIPs = dcount(IPAddress), IPList = make_set(IPAddress, 10)
    by ServicePrincipalName, ServicePrincipalId, AppId, bin(TimeGenerated, 1h)
| where UniqueIPs > 3  // Service principals should use consistent IPs
| extend AlertReason = "Service principal authenticating from multiple IPs"
| project TimeGenerated, ServicePrincipalName, ServicePrincipalId, AppId,
          SigninCount, UniqueIPs, IPList, AlertReason;
// Output suspicious user sign-ins
SuspiciousSignins
| sort by TimeGenerated desc
high severity high confidence

Data Sources

Logon Session: Logon Session Creation User Account: User Account Authentication Application Log: Application Log Content Microsoft Entra ID Sign-In Logs Azure AD Identity Protection

Required Tables

SigninLogs AADServicePrincipalSignInLogs

False Positives

  • Legitimate business travelers or remote workers authenticating from foreign countries or new locations for the first time
  • Legacy applications or shared mailbox access that legitimately use basic authentication protocols not yet migrated to modern auth
  • Service principals deployed across multi-region infrastructure may authenticate from multiple IP addresses legitimately
  • Helpdesk or break-glass accounts accessed from admin workstations in unusual locations during incident response
  • VPN or proxy usage causing sign-ins to appear from unexpected geographic locations

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections