What is the confused deputy problem and how does ExternalId solve it?
AdvancedConceptIAM Advanced, STS and Multi-Account
Answer
A third-party SaaS that assumes a role in your account could be tricked by another customer into using their role ARN for your resources. The vendor generates a unique ExternalId per customer, you place it in the trust policy condition, and the vendor must pass it on AssumeRole.
"Condition": {"StringEquals": {"sts:ExternalId": "7b1f-customer-unique-id"}}
For AWS-service-to-service calls the equivalent protection is aws:SourceArn and aws:SourceAccount conditions (for example on SNS topic or S3 bucket policies for CloudTrail/Config).
More on IAM Advanced, STS and Multi-Account
Explain the IAM policy evaluation logic.AdvancedHow does cross-account access evaluation differ from same-account?AdvancedHow does `sts:AssumeRole` work, step by step?IntermediateWhat is the difference between AssumeRole, AssumeRoleWithWebIdentity and AssumeRoleWithSAML?IntermediateWhat is a permission boundary and when would you use one?IntermediateWhat do Service Control Policies do and not do?Intermediate