Why did I receive the GuardDuty finding type alert UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS for my Amazon EC2 instance?
Amazon GuardDuty detected alerts for the UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS finding type.
"Amazon GuardDuty detected alerts for the UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS finding type.Short descriptionThe GuardDuty finding type UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS indicates that AWS credentials that were created exclusively for an Amazon Elastic Compute Cloud (Amazon EC2) instance through an instance launch role are being used from an external IP address.ResolutionFollow the instructions to view and analyze your GuardDuty findings. Then, in the findings detail pane, note the external IP address and IAM user name.The external IP address is safeIf the external IP address is owned by you or someone that you trust, then you can auto-archive the findings with a suppression rule.The external IP address is maliciousIf the external IP address is malicious, then you can deny all permissions to the IAM user.Note: Permissions for the IAM user are denied for all EC2 instances.Create an IAM policy with an explicit deny to block access to the EC2 instance for the IAM user similar to the following:Note: Replace your-roleID and your-role-session-name with the Principal ID.{  "Version": "2012-10-17",  "Statement": [    {      "Effect": "Deny",      "Action": [        "*"      ],      "Resource": [        "*"      ],      "Condition": {        "StringEquals": {          "aws:userId": "your-roleId:your-role-session-name"        }      }    }  ]}Follow the instructions for remediating a compromised EC2 instance.Note: As a security best practice, be sure to require the use of IMDSv2 on an existing instance.Follow"