Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1yeDI4LXIyM3AtMnFjM84AAz8q

AWS CDK EKS overly permissive trust policies

If you are using the eks.Cluster or eks.FargateCluster construct we need you to take action. Other users are not affected and can stop reading.

Impact

The AWS Cloud Development Kit (CDK) allows for the definition of Amazon Elastic Container Service for Kubernetes (EKS) clusters. eks.Cluster and eks.FargateCluster constructs create two roles that have an overly permissive trust policy.

The first, referred to as the CreationRole, is used by lambda handlers to create the cluster and deploy Kubernetes resources (e.g KubernetesManifest, HelmChart, ...) onto it. Users with CDK version higher or equal to 1.62.0 (including v2 users) will be affected.

The second, referred to as the default MastersRole, is provisioned only if the mastersRole property isn't provided and has permissions to execute kubectl commands on the cluster. Users with CDK version higher or equal to 1.57.0 (including v2 users) will be affected.

Both these roles use the account root principal in their trust policy, which allows any identity in the account with the appropriate sts:AssumeRole permissions to assume it. For example, this can happen if another role in your account has sts:AssumeRole permissions on Resource: "*".

CreationRole

Users with CDK version higher or equal to 1.62.0 (including v2 users). The role in question can be located in the IAM console. It will have the following name pattern:

*-ClusterCreationRole-* 

MastersRole

Users with CDK version higher or equal to 1.57.0 (including v2 users) that are not specifying the mastersRole property. The role in question can be located in the IAM console. It will have the following name pattern:

*-MastersRole-*

Patches

The issue has been fixed in versions v1.202.0, v2.80.0. We recommend you upgrade to a fixed version as soon as possible. See Managing Dependencies in the CDK Developer Guide for instructions on how to do this.

The new versions no longer use the account root principal. Instead, they restrict the trust policy to the specific roles of lambda handlers that need it. This introduces some breaking changes that might require you to perform code changes. Refer to https://github.com/aws/aws-cdk/issues/25674 for a detailed discussion of options.

Workarounds

CreationRole

There is no workaround available for CreationRole.

MastersRole

To avoid creating the default MastersRole, use the mastersRole property to explicitly provide a role. For example:

new eks.Cluster(this, 'Cluster', { 
  ... 
  mastersRole: iam.Role.fromRoleArn(this, 'Admin', 'arn:aws:iam::xxx:role/Admin') 
}); 

References

https://github.com/aws/aws-cdk/issues/25674

If you have any questions or comments about this advisory we ask that you contact AWS/Amazon Security via our vulnerability reporting page or directly via email to [email protected]. Please do not create a public GitHub issue.

Permalink: https://github.com/advisories/GHSA-rx28-r23p-2qc3
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1yeDI4LXIyM3AtMnFjM84AAz8q
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: 11 months ago
Updated: 6 months ago


CVSS Score: 6.6
CVSS vector: CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H

Identifiers: GHSA-rx28-r23p-2qc3, CVE-2023-35165
References: Repository: https://github.com/aws/aws-cdk
Blast Radius: 24.2

Affected Packages

npm:@aws-cdk/aws-eks
Dependent packages: 38
Dependent repositories: 400
Downloads: 42,989 last month
Affected Version Ranges: >= 1.57.0, < 1.202.0
Fixed in: 1.202.0
All affected versions: 1.57.0, 1.58.0, 1.59.0, 1.60.0, 1.61.0, 1.61.1, 1.62.0, 1.63.0, 1.64.0, 1.64.1, 1.65.0, 1.66.0, 1.67.0, 1.68.0, 1.69.0, 1.70.0, 1.71.0, 1.72.0, 1.73.0, 1.74.0, 1.75.0, 1.76.0, 1.77.0, 1.78.0, 1.79.0, 1.80.0, 1.81.0, 1.82.0, 1.83.0, 1.84.0, 1.85.0, 1.86.0, 1.87.0, 1.87.1, 1.88.0, 1.89.0, 1.90.0, 1.90.1, 1.91.0, 1.92.0, 1.93.0, 1.94.0, 1.94.1, 1.95.0, 1.95.1, 1.95.2, 1.96.0, 1.97.0, 1.98.0, 1.99.0, 1.100.0, 1.101.0, 1.102.0, 1.103.0, 1.104.0, 1.105.0, 1.106.0, 1.106.1, 1.107.0, 1.108.0, 1.108.1, 1.109.0, 1.110.0, 1.110.1, 1.111.0, 1.112.0, 1.113.0, 1.114.0, 1.115.0, 1.116.0, 1.117.0, 1.118.0, 1.119.0, 1.120.0, 1.121.0, 1.122.0, 1.123.0, 1.124.0, 1.125.0, 1.126.0, 1.127.0, 1.128.0, 1.129.0, 1.130.0, 1.131.0, 1.132.0, 1.133.0, 1.134.0, 1.135.0, 1.136.0, 1.137.0, 1.138.0, 1.138.1, 1.138.2, 1.139.0, 1.140.0, 1.141.0, 1.142.0, 1.143.0, 1.144.0, 1.145.0, 1.146.0, 1.147.0, 1.148.0, 1.149.0, 1.150.0, 1.151.0, 1.152.0, 1.153.0, 1.153.1, 1.154.0, 1.155.0, 1.156.0, 1.156.1, 1.157.0, 1.158.0, 1.159.0, 1.160.0, 1.161.0, 1.162.0, 1.163.0, 1.163.1, 1.163.2, 1.164.0, 1.165.0, 1.166.1, 1.167.0, 1.168.0, 1.169.0, 1.170.0, 1.170.1, 1.171.0, 1.172.0, 1.173.0, 1.174.0, 1.175.0, 1.176.0, 1.177.0, 1.178.0, 1.179.0, 1.180.0, 1.181.0, 1.181.1, 1.182.0, 1.183.0, 1.184.0, 1.184.1, 1.185.0, 1.186.0, 1.186.1, 1.187.0, 1.188.0, 1.189.0, 1.190.0, 1.191.0, 1.192.0, 1.193.0, 1.194.0, 1.195.0, 1.196.0, 1.197.0, 1.198.0, 1.198.1, 1.199.0, 1.200.0, 1.201.0
All unaffected versions: 0.8.0, 0.8.1, 0.8.2, 0.9.0, 0.9.1, 0.9.2, 0.10.0, 0.11.0, 0.12.0, 0.13.0, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.17.0, 0.18.0, 0.18.1, 0.19.0, 0.20.0, 0.21.0, 0.22.0, 0.23.0, 0.24.0, 0.24.1, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 0.26.0, 0.27.0, 0.28.0, 0.29.0, 0.30.0, 0.31.0, 0.32.0, 0.33.0, 0.34.0, 0.35.0, 0.36.0, 0.36.1, 0.36.2, 0.37.0, 0.38.0, 0.39.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.6.1, 1.7.0, 1.8.0, 1.9.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.13.0, 1.13.1, 1.14.0, 1.15.0, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.17.0, 1.17.1, 1.18.0, 1.19.0, 1.20.0, 1.21.0, 1.21.1, 1.22.0, 1.23.0, 1.24.0, 1.25.0, 1.26.0, 1.27.0, 1.28.0, 1.29.0, 1.30.0, 1.31.0, 1.32.0, 1.32.1, 1.32.2, 1.33.0, 1.33.1, 1.34.0, 1.34.1, 1.35.0, 1.36.0, 1.36.1, 1.37.0, 1.38.0, 1.39.0, 1.40.0, 1.41.0, 1.42.0, 1.42.1, 1.43.0, 1.44.0, 1.45.0, 1.46.0, 1.47.0, 1.47.1, 1.48.0, 1.49.0, 1.49.1, 1.50.0, 1.51.0, 1.52.0, 1.53.0, 1.54.0, 1.55.0, 1.56.0, 1.202.0, 1.203.0, 1.204.0
npm:aws-cdk-lib
Dependent packages: 1,837
Dependent repositories: 4,665
Downloads: 6,286,049 last month
Affected Version Ranges: >= 2.0.0, < 2.80.0
Fixed in: 2.80.0
All affected versions: 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 2.11.0, 2.12.0, 2.13.0, 2.14.0, 2.15.0, 2.16.0, 2.17.0, 2.18.0, 2.19.0, 2.20.0, 2.21.0, 2.21.1, 2.22.0, 2.23.0, 2.24.0, 2.24.1, 2.25.0, 2.26.0, 2.27.0, 2.28.0, 2.28.1, 2.29.0, 2.29.1, 2.30.0, 2.31.0, 2.31.1, 2.31.2, 2.32.0, 2.32.1, 2.33.0, 2.34.0, 2.34.1, 2.34.2, 2.35.0, 2.36.0, 2.37.0, 2.37.1, 2.38.0, 2.38.1, 2.39.0, 2.39.1, 2.40.0, 2.41.0, 2.42.0, 2.42.1, 2.43.0, 2.43.1, 2.44.0, 2.45.0, 2.46.0, 2.47.0, 2.48.0, 2.49.0, 2.49.1, 2.50.0, 2.51.0, 2.51.1, 2.52.0, 2.52.1, 2.53.0, 2.54.0, 2.55.0, 2.55.1, 2.56.0, 2.56.1, 2.57.0, 2.58.0, 2.58.1, 2.59.0, 2.60.0, 2.61.0, 2.61.1, 2.62.0, 2.62.1, 2.62.2, 2.63.0, 2.63.1, 2.63.2, 2.64.0, 2.65.0, 2.66.0, 2.66.1, 2.67.0, 2.68.0, 2.69.0, 2.70.0, 2.71.0, 2.72.0, 2.72.1, 2.73.0, 2.74.0, 2.75.0, 2.75.1, 2.76.0, 2.77.0, 2.78.0, 2.79.0, 2.79.1
All unaffected versions: 2.80.0, 2.81.0, 2.82.0, 2.83.0, 2.83.1, 2.84.0, 2.85.0, 2.86.0, 2.87.0, 2.88.0, 2.89.0, 2.90.0, 2.91.0, 2.92.0, 2.93.0, 2.94.0, 2.95.0, 2.95.1, 2.96.0, 2.96.1, 2.96.2, 2.97.0, 2.97.1, 2.98.0, 2.99.0, 2.99.1, 2.100.0, 2.101.0, 2.101.1, 2.102.0, 2.102.1, 2.103.0, 2.103.1, 2.104.0, 2.105.0, 2.106.0, 2.106.1, 2.107.0, 2.108.0, 2.108.1, 2.109.0, 2.110.0, 2.110.1, 2.111.0, 2.112.0, 2.113.0, 2.114.0, 2.114.1, 2.115.0, 2.116.0, 2.116.1, 2.117.0, 2.118.0, 2.119.0, 2.120.0, 2.121.0, 2.121.1, 2.122.0, 2.123.0, 2.124.0, 2.125.0, 2.126.0, 2.127.0, 2.128.0, 2.129.0, 2.130.0, 2.131.0, 2.132.0, 2.132.1, 2.133.0, 2.134.0, 2.135.0, 2.136.0, 2.136.1, 2.137.0, 2.138.0, 2.139.0, 2.139.1, 2.140.0, 2.141.0, 2.142.0