RAWS playbook · Identity and access
Backdoor roles, keys and trust policies
The attacker adds access that survives rotation of the first stolen credential, such as a new IAM user or a second access key. Other runs add an account the attacker controls to a role trust policy, or register a SAML or OpenID Connect (OIDC) identity provider that a role trusts. Save an IAM snapshot first, then deny each backdoor principal before you delete anything.
Look here
| Log | Search for |
|---|---|
| CloudTrail, IAM users and keys | New users, keys and sign-in methods: CreateUser, CreateAccessKey, CreateLoginProfile, UpdateLoginProfile, CreateServiceSpecificCredential, UploadSSHPublicKey, EnableMFADevice, AddUserToGroup. IAM events land in us-east-1 |
| CloudTrail, roles and trust | New roles and changes to trust and permissions: CreateRole, UpdateAssumeRolePolicy, UpdateRole, AttachRolePolicy, PutRolePolicy, DeleteRolePermissionsBoundary, CreatePolicyVersion, SetDefaultPolicyVersion, AddRoleToInstanceProfile. Read account IDs in requestParameters.policyDocument |
| CloudTrail, federation | New or changed identity providers: CreateSAMLProvider, UpdateSAMLProvider, CreateOpenIDConnectProvider, AddClientIDToOpenIDConnectProvider, UpdateOpenIDConnectProviderThumbprint. IAM Roles Anywhere: CreateTrustAnchor, UpdateTrustAnchor, CreateProfile |
CloudTrail, sso.amazonaws.com | Permission sets and assignments added in IAM Identity Center: CreatePermissionSet, PutInlinePolicyToPermissionSet, AttachManagedPolicyToPermissionSet, CreateAccountAssignment, ProvisionPermissionSet, CreateTrustedTokenIssuer. User and group changes come from sso-directory.amazonaws.com and identitystore.amazonaws.com |
| CloudTrail, resource policies | Grants to principals in other accounts: AddPermission20150331v2 (Lambda AddPermission), PutBucketPolicy, PutKeyPolicy, CreateGrant, Secrets Manager PutResourcePolicy |
| IAM Access Analyzer | Roles trusted from outside the zone of trust: aws accessanalyzer list-findings-v2 --analyzer-arn <arn> --filter '{"status":{"eq":["ACTIVE"]},"resourceType":{"eq":["AWS::IAM::Role"]}}' |
| IAM snapshot | Every principal and policy, to compare with your infrastructure-as-code (IaC) state: aws iam get-account-authorization-details > <case>-iam.json |
| IAM credential report | Password, key and MFA state of every user. Run aws iam generate-credential-report first, then read it: aws iam get-credential-report --query Content --output text | base64 --decode |
| GuardDuty | Findings for new persistence and privilege changes: Persistence:IAMUser/AnomalousBehavior, PrivilegeEscalation:IAMUser/AnomalousBehavior, AttackSequence:IAM/CompromisedCredentials |
Contain
| # | Item |
|---|---|
| 1 | Save the IAM snapshot and credential report above before changing any principal. See Evidence |
| 2 | Deny each backdoor role with an inline deny-all policy, which also applies to live sessions. For a user, run put-user-policy with the same file: aws iam put-role-policy --role-name <role> --policy-name ir-deny-all --policy-document file://deny-all.json |
| 3 | Deactivate every access key the attacker created: aws iam update-access-key --user-name <user> --access-key-id <access-key-id> --status Inactive |
| 4 | Restore each changed trust policy: aws iam update-assume-role-policy --role-name <role> --policy-document file://known-good-trust.json |
| 5 | Revoke sessions issued before now on each role whose trust changed: aws iam put-role-policy --role-name <role> --policy-name AWSRevokeOlderSessions --policy-document file://revoke.json |
| 6 | Disable a rogue Roles Anywhere trust anchor: aws rolesanywhere disable-trust-anchor --trust-anchor-id <id> |
| 7 | Deny every role whose trust policy names a rogue SAML or OIDC provider. IAM has no way to disable a provider |
| 8 | Remove Identity Center assignments the attacker added destructive: aws sso-admin delete-account-assignment --instance-arn <arn> --target-id <account> --target-type AWS_ACCOUNT --permission-set-arn <arn> --principal-type USER --principal-id <id> |
| 9 | Delete a rogue OIDC provider once the evidence is saved destructive: aws iam delete-open-id-connect-provider --open-id-connect-provider-arn <arn> |
| 10 | Delete a rogue SAML provider once the evidence is saved destructive: aws iam delete-saml-provider --saml-provider-arn <arn> |
| 11 | Delete each backdoor role destructive. Detach its policies and remove it from instance profiles first, or the call fails: aws iam delete-role --role-name <role> |
Eradicate and recover
| # | Item |
|---|---|
| 1 | Diff IAM against the baseline and remove every user, key, inline policy, group membership and trust statement added in the window |
| 2 | After you set the known-good default on a changed managed policy, delete the attacker's version: aws iam delete-policy-version --policy-arn <arn> --version-id <version> |
| 3 | Remove Lambda permissions granted to unknown accounts: aws lambda remove-permission --function-name <function> --statement-id <sid> |
| 4 | Revoke KMS grants made to unknown accounts: aws kms revoke-grant --key-id <key> --grant-id <grant> |
| 5 | Resolve every active Access Analyzer finding. Archive only access you approved by name |
| 6 | Rotate the credential that started the incident. See Leaked IAM user access keys |
| 7 | Add an SCP (service control policy) that denies iam:CreateUser, iam:CreateAccessKey, iam:CreateOpenIDConnectProvider, iam:CreateSAMLProvider and iam:UpdateAssumeRolePolicy to every principal except your admin role |
Watch out
- A managed policy keeps up to five versions. Setting a good default leaves the attacker's version in place for anyone who can call
SetDefaultPolicyVersion, so delete it. - CloudTrail does not log denied cross-account
AssumeRolecalls in the target account. After you close a trust, your trail shows no failed attempts from the attacker's account. - An external access analyzer treats accounts inside its zone of trust as trusted. A trust added for another compromised member account produces no finding.
AWS documentation: IAM API actions, session revocation, policy versioning and credential reports; IAM Access Analyzer findings, resource types and filter keys; IAM Identity Center and Roles Anywhere API actions; Lambda CloudTrail logging; IAM CloudTrail integration; GuardDuty IAM finding types. Checked September 2026.