CloudTrail shows a new IAM role with AdministratorAccess was created in prod at 2 AM by a user nobody recognises. What do you do?

AdvancedScenarioSecurity incidents
Answer

Situation read → Probably persistence after a compromise: the attacker creates their own admin path so rotating the original key doesn't lock them out.

What I'd do →

  1. Contain the new role: attach an explicit deny-all inline policy (faster and safer than deleting, and it keeps evidence), and revoke its active sessions.
  2. Identify the creator from the CloudTrail event (userIdentity, source IP, access key). Disable that principal.
  3. Pull the full trail for that principal and the new role: other roles, users, keys, trust policies updated to trust external accounts, Lambda functions, new regions used.
aws cloudtrail lookup-events --lookup-attributes AttributeKey=Username,AttributeValue=svc-legacy \
  --start-time 2026-11-08T00:00:00Z
  1. Remove every persistence mechanism you find, then rotate the credentials that led in.
  2. Prevent: SCPs limiting IAM changes in prod to the pipeline role, alerts (EventBridge) on CreateRole, AttachRolePolicy and CreateAccessKey in prod, and GuardDuty.

Why → Attackers create several backdoors; removing only one leaves them inside.

Interview tip → Look for trust policies pointing at external account IDs; it's a common hidden backdoor.

All Real-World Interview questions Roadmap: Interview readiness

More on Security incidents