When an identity in your cloud grants itself more power, every minute spent debating ownership lets the attacker add another role, key or trust relationship that survives your first clean-up. Cloud privilege escalation rarely needs an exploit: a user or workload with permission to attach a policy, edit a trust policy, create a key for a service account or assign a role can lift itself to administrator using ordinary control plane calls. This playbook is a ready-to-adopt response procedure for AWS, Microsoft Azure and Entra ID, and Google Cloud (platforms are listed alphabetically), covering triage, containment, persistence hunting, rollback and recovery. It is for incident responders, cloud platform teams and identity engineers, and it sits under your wider plan in the Cloud Incident Response Guide. Replace the bracketed placeholders with your own values.
How to use this template
- Adopt sections 1 to 10 as written, then fill the [Organisation] placeholders, contact rotas and log locations in a tabletop before you need them.
- Pair it with a credential playbook. If the escalation started from a leaked key, run the Leaked Credential Response Playbook in parallel; this playbook owns the IAM changes made after the credential was used.
- Pre-stage the access. Responders need a break-glass role in every account, subscription and project that can read logs and change IAM, and that is excluded from the guardrails you will apply in containment.
- Test it twice a year against a sandbox account using the scenarios in section 9, and record the time to each milestone in section 8.
1. Purpose
This playbook defines how [Organisation] detects, contains, investigates and recovers from unauthorised privilege escalation in its cloud environments, so that the attacker loses all elevated access, every persistence mechanism is found and removed, and legitimate IAM configuration is restored from a known good baseline.
2. Scope
- In scope: AWS accounts in [AWS Organization ID], Azure subscriptions and management groups under tenant [Tenant ID], Microsoft Entra ID directory roles and application permissions, and Google Cloud projects and folders under [Organisation node].
- Identities: human users, federated sessions, IAM roles, Entra service principals and managed identities, Google service accounts, and AI agents or automation acting with any of these.
- Out of scope: host-level escalation inside virtual machines or containers (use the Linux Privilege Escalation Techniques Guide and Kubernetes Cluster Compromise Playbook), except where it yields cloud credentials.
3. Escalation paths this playbook covers
Use the table to recognise what happened and which ATT&CK technique to record in the case. All technique IDs are from ATT&CK Enterprise v20.
| Path | Typical control plane signal | ATT&CK |
|---|---|---|
| Attach or write an admin policy on own user, group or role | AWS AttachUserPolicy, AttachRolePolicy, PutRolePolicy, AddUserToGroup; new default version via CreatePolicyVersion or SetDefaultPolicyVersion | T1098.003 Additional Cloud Roles |
| Create a new role and pass it to compute | AWS CreateRole then CreateFunction or RunInstances using that role (iam:PassRole is checked inside these calls, not logged as its own event) | T1098.003, T1136.003 Cloud Account |
| Edit who can assume a privileged role | AWS UpdateAssumeRolePolicy; Entra federation or domain changes | T1484.002 Trust Modification |
| Add credentials to an existing privileged identity | AWS CreateAccessKey, CreateLoginProfile, UpdateLoginProfile; Entra "Add service principal credentials"; Google CreateServiceAccountKey | T1098.001 Additional Cloud Credentials |
| Assign a directory or resource role | Entra "Add member to role" or "Add eligible member to role"; Azure Microsoft.Authorization/roleAssignments/write; Google SetIamPolicy | T1098.003 |
| Grant an application permission or consent | Entra "Add app role assignment to service principal", "Consent to application", "Add owner to application" | T1098.003, T1528 Steal Application Access Token |
| Abuse impersonation or just-in-time elevation | Google GenerateAccessToken on a service account; Entra PIM activation; Azure elevate access to User Access Administrator at root scope | T1548.005 Temporary Elevated Cloud Access |
| Remove the guardrail first | AWS DeleteRolePermissionsBoundary or DeleteUserPermissionsBoundary; detaching an SCP; deleting a Google deny policy | T1098.003 |
The attacker's starting identity is usually a valid cloud account (T1078.004 Cloud Accounts). For how to find these paths before an attacker does, see How to Find IAM Privilege Escalation Paths in AWS.
4. Roles and responsibilities
| Role | Owner | Responsibilities in this playbook |
|---|---|---|
| Incident commander | [Name / rota] | Declares severity, approves containment that affects production, owns the decision log |
| Cloud IAM lead | [Name / rota] | Executes revocation, guardrails and rollback; holds break-glass access |
| Cloud forensics analyst | [Name / rota] | Preserves logs, builds the timeline, hunts persistence |
| Service owner | [Per affected workload] | Confirms which roles and keys are legitimate, accepts outage risk |
| Legal and privacy | [Name] | Assesses notification duties if data access is confirmed |
For a printable version of these roles, use the Incident Response Role Cards Template.
5. Triage (first 30 minutes)
- Confirm the change is unauthorised. Match the IAM event to a change ticket, pipeline run or PIM request. No match within 15 minutes means treat it as hostile.
- Identify the actor identity and its source. Record the principal ARN, object ID or service account email, session or token issue time, source IP, user agent and, for AWS, the access key ID.
- List what was granted. Every policy, role, key, credential, trust edit and consent issued by that actor in the window. The escalated identity is now a second compromised identity.
- Size the blast radius. What the escalated identity can reach now: accounts, subscriptions, projects, key vaults, data stores, logging configuration.
- Assign severity. Severity 1 if the identity reached organisation, tenant or management group administration, can change logging, or touched production data stores.
6. Containment (by priority)
Contain in this order: stop the elevated sessions, freeze further IAM change, then remove the grants. Removing a policy while the attacker still holds a live session lets them put it back.
6.1 Stop active sessions and credentials
- AWS roles: revoke active sessions on each affected role. The IAM console's Revoke active sessions action attaches an inline policy named AWSRevokeOlderSessions that denies all actions for sessions whose aws:TokenIssueTime is before the revocation time. It needs iam:PutRolePolicy, affects every user of the role, cannot be used on service-linked roles, and does not touch long-term IAM user keys. Sessions from IAM Identity Center permission sets are revoked in Identity Center instead.
- AWS users and keys: set new or suspicious access keys to Inactive (UpdateAccessKey) before deleting, so you keep the key ID for log searches, and remove any new console password.
- Entra ID: revoke the user's sign-in sessions, disable the account, and remove credentials added to service principals in the window.
- Google Cloud: disable added service account keys and the service account itself if it is not business critical. Disable rather than delete: a deleted and recreated account is a new identity and existing bindings break.
6.2 Freeze further IAM change
- AWS: attach a pre-written containment SCP to the affected account or OU that denies iam:*, organizations:*, sts:AssumeRole into privileged roles and cloudtrail:StopLogging or DeleteTrail, with an exception for the responder role ARN. SCPs do not apply to the management account or to service-linked roles, so a compromise of the management account needs direct IAM action.
- Azure and Entra: remove standing role-assignment rights from the actor; require PIM approval for Privileged Role Administrator and User Access Administrator for the duration; check whether anyone has elevated access to User Access Administrator at root scope and switch it off.
- Google Cloud: apply an IAM deny policy at the folder or project that denies IAM policy changes and service account key creation to all principals except the responder group. Deny policies are evaluated before allow policies, so the actor's grants do not override them.
6.3 Remove the attacker's grants
- Detach every policy, role assignment, app role and group membership the actor added. Restore the prior default policy version where CreatePolicyVersion was used.
- Revert trust policy edits and delete roles the actor created, after exporting them as evidence.
- Remove app consents and owners added in the window. The Midnight Blizzard breach shows why: the actor used a legacy test OAuth application to grant itself the Exchange Online full_access_as_app role and created further applications under its control.
6.4 Decision points for the incident commander
| Decision | Choose the faster, disruptive option when | Choose the slower, targeted option when |
|---|---|---|
| Revoke all sessions of a shared role or only the actor's | The role is administrative, or the actor's session cannot be told apart from others | The role serves production traffic and the attacker's session is clearly identified by source and issue time |
| Account-wide IAM freeze or per-identity removal | More than one identity was escalated, or the actor could change logging | A single grant was made, it is already removed and logs show no follow-on use |
| Disable a privileged service account or workload identity | It holds new credentials you cannot account for | Its owner confirms all credentials and the outage cost is high; rotate instead and monitor |
Record every decision, the person who made it and the evidence it rested on in the decision log.
Rollback of containment: containment SCPs and deny policies are reversible by detaching them. Record each one with its attach time in the decision log and remove them only after section 7 is complete.
7. Investigation and persistence hunt
- Preserve evidence first. Export AWS CloudTrail (management events, all regions, organisation trail), Entra audit and sign-in logs, Azure Activity Log, and Google Cloud Admin Activity audit logs to a separate evidence account. Google Admin Activity logs are always written and cannot be disabled; Data Access logs are off by default for most services, so their absence is not proof of no data access.
- Build the timeline from the first use of the original credential to the last action of every identity the actor touched, including role chains. See AWS Role Chaining Detection.
- Hunt for persistence using the checklist below across every region and every account the escalated identity could reach, not only where you saw activity.
- Check data access on stores the escalated identity could read, then hand findings to legal and privacy.
| Persistence to look for | AWS | Azure and Entra ID | Google Cloud |
|---|---|---|---|
| New identities | CreateUser, CreateRole | New users, applications and service principals | New service accounts |
| Extra credentials | CreateAccessKey, CreateLoginProfile | Add service principal credentials, federated credentials | CreateServiceAccountKey |
| Trust changes | UpdateAssumeRolePolicy, new OIDC or SAML providers | Federation and domain changes, new owners on apps | Workload identity pool and provider changes |
| Compute carrying privilege | Lambda functions or instances with new roles, in every enabled region | Automation runbooks and managed identities with new role assignments | Cloud Functions or VMs running as a privileged service account |
| Guardrail removal | Deleted permissions boundaries, detached SCPs, stopped trails | Changed diagnostic settings, removed PIM requirements | Deleted deny policies, changed log sinks |
The .env cloud extortion campaign is the pattern to expect: the actor used an exposed key to create a role named lambda-ex, attached the AWS managed AdministratorAccess policy and deployed a Lambda function to every other enabled region almost at once. A hunt limited to the home region would have missed most of it.
8. Recovery and rollback
- Restore IAM from a known good baseline, ideally the infrastructure as code state before the first malicious event. Diff the live state against it and review every difference with the service owner.
- Rotate secondary credentials the escalated identity could read: secrets manager values, key vault secrets, database passwords and CI tokens.
- Fix the root path. Remove the permission that allowed the escalation (for example iam:PassRole on *, roles/iam.serviceAccountTokenCreator at project level, or Application Administrator held by a workload).
- Lift containment guardrails one at a time, watching for errors and for reappearing grants.
- Close with a review within 10 working days that updates this playbook and the detection rules.
| Milestone | Target | Measured from |
|---|---|---|
| Escalation event to alert | [15 minutes] | IAM event time |
| Alert to sessions revoked | [30 minutes] | Alert time |
| Alert to IAM change frozen | [60 minutes] | Alert time |
| Persistence hunt complete, all regions | [24 hours] | Declaration |
| IAM restored to baseline | [72 hours] | Declaration |
9. Detection and exercises
- Alert on high-risk IAM events in all three clouds: the events in section 3, plus any IAM change by an identity that has never made one, any IAM change from outside your CI/CD and IaC pipelines, and any Azure elevate access event (Entra audit service "Azure RBAC (Elevated Access)").
- Exercise scenarios: a CI role attaches AdministratorAccess to itself; a developer adds a client secret to a privileged service principal; a Google service account with Token Creator at project level impersonates the deploy account.
- Metrics: median time from escalation event to revocation; percentage of privileged IAM changes that came through the pipeline; number of identities able to change IAM, per account; percentage of accounts with the containment SCP or deny policy pre-staged; persistence items found after the first clean-up (target zero).
10. Framework mapping
| Framework | Reference | How this playbook meets it |
|---|---|---|
| NIST CSF 2.0 | DE.CM-03, RS.AN-03, RS.MA-01, RC.RP-01, PR.AA-05 | Monitoring of IAM activity, root cause analysis, plan execution, recovery, entitlement review |
| NIST SP 800-53 Rev. 5 | IR-4, AU-6, AC-2(4), AC-6(5), CM-3 | Incident handling, log review, automated audit of account actions, privileged account limits, change control |
| NIST SP 800-61 Rev. 3 | Incident response as a CSF 2.0 profile | Preparation, response and lessons learned in sections 5 to 9 |
| MITRE ATT&CK v20 | T1078.004, T1098.001, T1098.003, T1136.003, T1484.002, T1548.005 | Section 3 classification |
Implementation guidance
- Start with the break-glass and containment artefacts: a responder role per account, the containment SCP, the Google deny policy and the Entra revocation steps, written and tested in a sandbox before anything else.
- Small organisations with one AWS account or one subscription can skip SCPs and use a permissions boundary on all non-responder roles plus direct revocation. Larger estates should centralise logs in a security account and run the hunt queries across the organisation.
- Prevention reduces the playbook's use: shrink the set of identities that can change IAM, use just-in-time elevation for people, and keep workloads off IAM write permissions. See the Least Privilege Techniques Guide and the AWS IAM Policies and Roles Guide.
- Common failure patterns: deleting keys before recording their IDs; removing the policy but not revoking sessions; hunting only the home region; trusting a deny that does not cover the management account; restoring IAM by hand instead of from code, which reintroduces drift.
Standards and references
- NIST: SP 800-61 Rev. 3, Incident Response Recommendations and Considerations for Cybersecurity Risk Management
- AWS: Revoke IAM role temporary security credentials
- AWS: Service control policies
- Microsoft Learn: Elevate access to manage all Azure subscriptions and management groups
- Microsoft Learn: Microsoft Entra audit log activity reference
- Google Cloud: Deny policies
- Google Cloud: Cloud Audit Logs overview
- MITRE ATT&CK: T1098 Account Manipulation
Related NHI Mgmt Group resources: Cloud Incident Response Guide · How to Investigate CloudTrail for a Compromised Access Key · AWS STS and AssumeRole Guide · Google Cloud IAM and Service Accounts Guide