Interview Prep/DevSecOps/Cloud IAM and Compliance

GuardDuty reports `UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS`. What happened and what do you do?

AdvancedScenarioCloud IAM and Compliance
Answer

Situation read → Temporary credentials from an EC2 instance role are being used from an IP outside AWS. Someone stole them, often via SSRF or a compromised host.

What I'd do →

  1. Identify the instance and role from the finding.
  2. Revoke active sessions: in IAM console "Revoke active sessions" on the role, which adds a deny policy on aws:TokenIssueTime.
  3. Review CloudTrail for actions by that role from the external IP.
  4. Isolate the instance (restrictive security group), snapshot disks for forensics.
  5. Find the root cause (SSRF, IMDSv1, RCE), enforce IMDSv2, patch, and redeploy from a clean image.

Why → Rotating the role does not invalidate issued session tokens; the token-issue-time deny does.

Interview tip → Knowing "revoke sessions" works via a date-condition deny is a strong signal.

All DevSecOps questions Roadmap: Policy as code

More on Cloud IAM and Compliance