Playbooks

T1525

Cloud Account Compromise Response Playbook

A structured playbook for responding to cloud account compromises across AWS, Azure, and GCP — covering stolen API keys, compromised IAM roles, cloud console takeovers, and cloud-to-cloud lateral movement.

View on Graph

What This Playbook Covers

  • This playbook covers the detection and response for cloud account compromises across AWS, Azure, and GCP. Each cloud provider has different identity systems, audit capabilities, and containment mechanisms
  • Cloud account compromise is distinct from SaaS account takeover. This playbook focuses on the cloud infrastructure provider accounts (AWS IAM users, Azure AD service principals, GCP service accounts), not the SaaS applications running on top
  • MITRE ATT&CK maps cloud account compromise under T1525 (Implant Cloud Image), T1556 (Modify Authentication Process), and T1078 (Valid Accounts) for cloud accounts

Cloud-Specific Attack Vectors

VectorHow It WorksMost Affected Provider
Stolen API keysHardcoded/leaked cloud API keys (AWS access keys, Azure service principal secrets)All — AWS most common due to broad IAM key usage
Compromised IAM user/roleCredential theft + MFA bypass for cloud consoleAll
Cloud shell accessAttacker uses stolen console access to launch cloud shells (AWS SSM, Azure Cloud Shell, GCP Cloud Shell)All
Cross-account role chainingAttacker uses compromised account to assume roles into other accountsAWS Organizations, Azure Lighthouse
Metadata service abuseSSRF to cloud metadata service (169.254.169.254) to retrieve temporary credentialsAWS (IMDS), GCP (metadata), Azure (IMDS)
Cloud-to-cloud lateral movementCompromised cloud account used to access other connected cloud servicesAny with OAuth or service-to-service integration

Phase 0: Detect the Cloud Compromise (0-15 minutes)

Detection Indicators by Cloud Provider

AWS — CloudTrail:

Look for these signals in CloudTrail events:
• IAM credentials retrieved from unusual IPs (GetFederationToken, AssumeRole)
• ConsoleLogin from unexpected locations or without MFA
• RunInstances from an IAM user who has never launched instances
• CreateAccessKey for an IAM user who already has keys
• CreateUser, AttachUserPolicy from unusual sources
• S3 Bucket policy changes (PutBucketPolicy) from anomalous principals

Azure — Activity Log:

Look for these signals in Azure Activity Log:
• Login from unusual IP with a new device
• Privileged Role Activation outside business hours (PIM activation)
• Service Principal credential creation from unexpected users
• Subscription policy modification from non-admin accounts
• Resource creation in a region the account has never used
• Key Vault access from unusual source IPs

GCP — Audit Logs:

Look for these signals in GCP Admin Activity audit logs:
• IAM policy changes on service accounts (SetIamPolicy)
• Service account key creation (CreateServiceAccountKey)
• Compute instances created with custom service accounts
• Cloud Storage bucket IAM policy modification
• VPC network creation or firewall rule changes

Key SPL Query — AWS Cloud Console Anomalous Login

index=aws eventName="ConsoleLogin"
| search additionalEventData.MFAUsed != "Yes"
| stats count by userIdentity.arn, sourceIPAddress, _time
| eval is_new_ip = if(match(sourceIPAddress, known_user_ips), 0, 1)
| where is_new_ip = 1
| eval alert = "HIGH — console login without MFA from new IP " . sourceIPAddress . " for user " . userIdentity.arn
| table _time, userIdentity.arn, sourceIPAddress, alert
| sort - _time

Phase 1: Immediate Containment (15-30 minutes)

Critical Actions — Do These First

For all cloud providers:

  • Identify the compromised credential type — IAM user key, service principal secret, console password, or federated role assumption
  • Rotate/deactivate the credential — rotate the specific compromised key or secret. Do not disable the entire account if only a key is compromised
  • Revoke active sessions — invalidate all active console sessions (AWS — RevokeSessions, Azure — Revoke-AzureADUserAllRefreshToken)
  • Scope the blast radius — determine what IAM policies/permissions are attached to the compromised credential
  • Block the source IP — add the attacker’s IP to a deny list at the cloud perimeter or in network ACLs

Provider-Specific Containment

AWS:

# Deactivate the compromised access key
aws iam update-access-key --access-key-id AKIAEXAMPLE --status Inactive

# If the user is compromised, create a policy that denies all actions
aws iam put-user-policy --user-name compromised-user --policy-name deny-all --policy-document '{"Version":"2012-10-17","Statement":[{"Effect":"Deny","Action":"*","Resource":"*"}]}'

# Revoke all active sessions
aws iam delete-service-specific-credential --user-name compromised-user

Azure:

# Revoke all refresh tokens
Revoke-AzureADUserAllRefreshToken -ObjectId <user-object-id>

# Revoke service principal credentials
Remove-AzureADServicePrincipalPasswordCredential -ObjectId <sp-object-id> -KeyId <key-id>

# Disable the user
Set-AzureADUser -ObjectId <user-object-id> -AccountEnabled $false

GCP:

# Disable the service account key
gcloud iam service-accounts keys disable <key-id> --iam-account=<sa>@<project>.iam.gserviceaccount.com

# Disable the user (requires Cloud Identity or Workspace)
gcloud alpha cloud-identity users update --user=<email> --suspended=true

What NOT to Do

ActionWhy It’s Dangerous
Disable the entire AWS accountThe organization may need the account for other legitimate workloads. Scope containment to the compromised principal.
Delete IAM usersDeletion destroys audit trail. Deactivate, investigate, then determine disposition.
Assume only one credential is compromisedThe attacker may have created new credentials during their access window. Check for CreateAccessKey, CreateServicePrincipal, CreateServiceAccountKey events.
Ignore cross-account accessThe attacker may have assumed roles into other accounts. Check CloudTrail for AssumeRole events.

Phase 2: Evidence Preservation (30-90 minutes)

Evidence by Cloud Provider

Evidence TypeAWSAzureGCP
Authentication logsCloudTrail Management EventsAzure AD Sign-in LogsGCP Admin Activity Audit Logs
Resource access logsCloudTrail Data EventsAzure Activity LogGCP Data Access Audit Logs
All activity timelineCloudTrail LookupEventsAzure Activity Log exportGCP Logging export to BigQuery
IAM policy snapshotsIAM policy versions for affected principalsAzure AD role assignmentsIAM policy bindings
Resource inventory at compromise timeAWS Config snapshotsAzure Resource GraphGCP Asset Inventory
Network flow logsVPC Flow LogsNSG Flow LogsVPC Flow Logs

Phase 3: Investigation (1-4 hours)

Questions to Answer

QuestionEvidence SourceHow to Determine
How was the initial compromise achieved?CloudTrail/Sign-in logs — credential stuffing, IMDS abuse, leaked API key, phishingFollow the first anomalous authentication event for the compromised principal
What resources were accessed?Data event logs, resource access logsList every API call and resource access during the compromise window
What data was exfiltrated?S3 access logs, Azure storage logs, GCP Cloud Storage logsCheck for large data transfers, GetObject/BLOB calls, bucket downloads
Were new credentials created?IAM audit — CreateAccessKey, CreateServicePrincipal, CreateServiceAccountKeyList all new credentials created during the compromise window
Was lateral movement performed?AssumeRole events, cross-account access logsCheck for role assumption into other accounts
Were resources modified or deleted?Resource modification logsCheck for EC2/TerminateInstances, DeleteBucket, resource deletion events
Is the attacker still active?Active sessions, recent CloudTrail eventsCheck for continued API calls from the attacker’s IP

Phase 4: Recovery and Hardening

Recovery Actions

ActionDetailTimeline
Rotate all credentials for the compromised accountAccess keys, console passwords, service principal secretsImmediate
Review and restrict IAM policiesRemove excessive permissions. Apply least privilege.1-4 hours
Audit resource modificationsIdentify and revert any attacker-made resource changes4-8 hours
Restore compromised resourcesRebuild compromised EC2 instances, lambda functions, or containers from known-good state4-24 hours
Review cross-account trust relationshipsVerify that only authorized roles can assume roles across accounts2-4 hours
Enable mandatory MFARequire MFA for all console access and critical API operationsOngoing

Long-Term Hardening

ControlWhat It PreventsImplementation
SCP (Service Control Policies)Cross-account action limitsAWS Organizations SCPs to restrict risky actions across all accounts
Azure PolicyResource configuration driftAzure Policy to enforce MFA, audit logging, and encryption
GCP Organization PoliciesOrganization-wide security baselinesGCP Organization Policy constraints for resource location, service usage
Cloud Security Posture Management (CSPM)Configuration drift detectionAWS Security Hub, Azure Defender, GCP Security Command Center
IAM Access AnalyzerUnintended resource exposureAWS IAM Access Analyzer, Azure AD Permissions Management, GCP Policy Analyzer
Short-term credentialsStolen long-lived API keysUse IAM roles with STS (AWS), managed identities (Azure), service account keyless auth (GCP)
Cloud workload protectionInstance/container compromiseAWS GuardDuty, Azure Defender for Cloud, GCP Security Command Center

Sources