|
| 1 | +include::../attributes.txt[] |
| 2 | + |
| 3 | +[.topic] |
| 4 | +[#cross-service-confused-deputy-prevention] |
| 5 | += Cross-service confused deputy prevention in Amazon EKS |
| 6 | +:info_titleabbrev: Cross-service confused deputy prevention |
| 7 | + |
| 8 | +The confused deputy problem is a security issue where an entity that doesn't have permission to perform an action can coerce a more-privileged entity to perform the action. In {aws}, cross-service impersonation can result in the confused deputy problem. Cross-service impersonation can occur when one service (the <emphasis>calling service</emphasis>) calls another service (the <emphasis>called service</emphasis>). The calling service can be manipulated to use its permissions to act on another customer's resources in a way it should not otherwise have permission to access. To prevent this, {aws} provides tools that help you protect your data for all services with service principals that have been given access to resources in your account. |
| 9 | + |
| 10 | +We recommend using the link:IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourcearn[`aws:SourceArn`, type="documentation"], link:IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceaccount[`aws:SourceAccount`, type="documentation"] global condition context keys in resource policies to limit the permissions that Amazon Elastic Kubernetes Service (Amazon EKS) gives another service to the resource. |
| 11 | + |
| 12 | +`aws:SourceArn`:: |
| 13 | +Use `aws:SourceArn` to associate only one resource with cross-service access. |
| 14 | + |
| 15 | +`aws:SourceAccount`:: |
| 16 | +Use `aws:SourceAccount` to let any resource in that account be associated with the cross-service use. |
| 17 | + |
| 18 | +The most effective way to protect against the confused deputy problem is to use the `aws:SourceArn` global condition context key with the full ARN of the resource. If you don't know the full ARN of the resource or if you are specifying multiple resources, use the `aws:SourceArn` global context condition key with wildcard characters (`*`) for the unknown portions of the ARN. For example, `{arn-aws}[.replaceable]``servicename``:*:[.replaceable]``123456789012``:*`. |
| 19 | + |
| 20 | +If the `aws:SourceArn` value does not contain the account ID, such as an Amazon S3 bucket ARN, you must use both `aws:SourceAccount` and `aws:SourceArn` to limit permissions. |
| 21 | + |
| 22 | +[#cross-service-confused-deputy-cluster-role] |
| 23 | +== Amazon EKS cluster role cross-service confused deputy prevention |
| 24 | +:info_titleabbrev: Amazon EKS cluster role |
| 25 | + |
| 26 | +An Amazon EKS cluster IAM role is required for each cluster. Kubernetes clusters managed by Amazon EKS use this role to manage nodes and the link:https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.7/guide/service/annotations/#legacy-cloud-provider[legacy Cloud Provider] uses this role to create load balancers with Elastic Load Balancing for services. |
| 27 | +These cluster actions can only affect the same account, so we recommend that you limit each cluster role to that cluster and account. |
| 28 | +This is a specific application of the {aws} recommendation to follow the _principle of least privilege_ in your account. |
| 29 | + |
| 30 | +*Source ARN format* |
| 31 | + |
| 32 | +The value of `aws:SourceArn` must be the ARN of an EKS cluster in the format `{arn-aws}:eks:[.replacable]``region``:[.replacable]``account``:cluster/[.replacable]``cluster-name```. For example, `{arn-aws}:eks:us-east-1:123456789012:cluster/my-cluster` . |
| 33 | + |
| 34 | +*Trust policy format for EKS cluster roles* |
| 35 | + |
| 36 | +The following example shows how you can use the `aws:SourceArn` and `aws:SourceAccount` global condition context keys in Amazon EKS to prevent the confused deputy problem. |
| 37 | + |
| 38 | +[source,json,subs="verbatim,attributes,quotes"] |
| 39 | +---- |
| 40 | +{ |
| 41 | + "Version": "2012-10-17", |
| 42 | + "Statement": [ |
| 43 | + { |
| 44 | + "Effect": "Allow", |
| 45 | + "Principal": { |
| 46 | + "Service": "eks.amazonaws.com" |
| 47 | + }, |
| 48 | + "Action": "sts:AssumeRole", |
| 49 | + "Condition": { |
| 50 | + "ArnLike": { |
| 51 | + "aws:SourceArn": "{arn-aws}:eks:[.replaceable]`us-west-2`:[.replaceable]`123456789012`:cluster/[.replaceable]`my-cluster`" |
| 52 | + }, |
| 53 | + "StringEquals": { |
| 54 | + "aws:SourceAccount": "123456789012" |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + ] |
| 59 | +} |
| 60 | +---- |
0 commit comments