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 →
- Identify the instance and role from the finding.
- Revoke active sessions: in IAM console "Revoke active sessions" on the role, which adds a deny policy on
aws:TokenIssueTime. - Review CloudTrail for actions by that role from the external IP.
- Isolate the instance (restrictive security group), snapshot disks for forensics.
- 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.
More on Cloud IAM and Compliance
You find an IAM policy with `"Action": "*", "Resource": "*"` attached to an application role. How do you right-size it?BeginnerYour company has 40 AWS accounts with no central controls. How do you set up preventive guardrails?IntermediateYour company must pass SOC 2 Type II in six months. What does DevOps own, and how do you automate evidence?IntermediateA partner needs access to one S3 bucket in your account. How do you set up cross-account access safely?IntermediateSomeone logged in with the AWS root user last night. How do you react, and how should you have known?BeginnerHow do you collect logs from 40 accounts so an attacker in one account cannot delete them?Intermediate