ghsa-5pq3-h73f-66hr
Vulnerability from github
Summary
The AWS Cloud Development Kit (CDK) is an open-source framework for defining cloud infrastructure using code. Users use it to create their own applications, which are converted to AWS CloudFormation templates during deployment to a user's AWS account. AWS CDK contains pre-built components called "constructs," which are higher-level abstractions providing defaults and best practices. This approach enables developers to use familiar programming languages to define complex cloud infrastructure more efficiently than writing raw CloudFormation templates.
The AWS CodePipeline construct deploys CodePipeline, a managed service that orchestrates software release processes through a series of stages, each comprising one or more actions executed by CodePipeline. To perform these actions, CodePipeline assumes IAM roles with permissions necessary for each step, allowing it to interact with AWS services and resources on behalf of the user.
An issue exists where, when using CDK to create a CodePipeline with the CDK Construct Library, CDK creates an AWS Identity and Access Management (AWS IAM) trust policy with overly broad permissions. Any user with unrestricted sts:AssumeRole permissions could assume that trust policy. This issue does not affect users who supply their own role for CodePipeline.
Impact
To leverage the issue, an actor has to be authenticated in the account and have an unrestricted sts:AssumeRole permission. The permissions an actor could leverage depend on the actions added to the pipeline. Possible permissions include actions on services such as CloudFormation, CodeCommit, Lambda, and ECS, as well as access to the S3 bucket holding pipeline build artifacts (see documentation).
Users can review their AWS CloudTrail logs for when the role was assumed to determine if this was expected.
Impacted versions: <v2.189.0
Patches
The patches are included in the CDK Construct Library release v2.189.0. We recommend upgrading to the latest version and ensuring any forked or derivative code is patched to incorporate the new fixes.
When new CDK applications using the latest version are initialized, they will use the new behavior with more restrictive permissions.
Existing applications must upgrade to the latest version, change the feature flag (@aws-cdk/pipelines:reduceStageRoleTrustScope) and (@aws-cdk/pipelines:reduceCrossAccountActionRoleTrustScope) to true and redeploy the application to apply this fix and use the new behavior with more restrictive permissions.
Workarounds
You can explicitly supply the role for your CodePipeline and follow the policy recommendations detailed in CodePipeline documentation.
References
If you have any questions or comments about this advisory please contact AWS/Amazon Security via our vulnerability reporting page or directly via email to aws-security@amazon.com. Please do not create a public GitHub issue.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "aws-cdk-lib"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "2.189.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-276"
],
"github_reviewed": true,
"github_reviewed_at": "2025-03-24T15:45:39Z",
"nvd_published_at": null,
"severity": "LOW"
},
"details": "### Summary\n\nThe [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/cdk/) is an open-source framework for defining cloud infrastructure using code. Users use it to create their own applications, which are converted to AWS CloudFormation templates during deployment to a user\u0027s AWS account. AWS CDK contains pre-built components called \"constructs,\" which are higher-level abstractions providing defaults and best practices. This approach enables developers to use familiar programming languages to define complex cloud infrastructure more efficiently than writing raw CloudFormation templates.\n\nThe [AWS CodePipeline](https://aws.amazon.com/codepipeline/) construct deploys CodePipeline, a managed service that orchestrates software release processes through a series of stages, each comprising one or more actions executed by CodePipeline. To perform these actions, CodePipeline assumes IAM roles with permissions necessary for each step, allowing it to interact with AWS services and resources on behalf of the user.\n\nAn issue exists where, when using CDK to create a CodePipeline with the CDK Construct Library, CDK creates an AWS Identity and Access Management (AWS IAM) trust policy with overly broad permissions. Any user with unrestricted sts:AssumeRole permissions could assume that trust policy. This issue does not affect users who supply their own role for CodePipeline.\n\n### Impact\nTo leverage the issue, an actor has to be authenticated in the account and have an unrestricted sts:AssumeRole permission. The permissions an actor could leverage depend on the actions added to the pipeline. Possible permissions include actions on services such as CloudFormation, CodeCommit, Lambda, and ECS, as well as access to the S3 bucket holding pipeline build artifacts ([see documentation](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline_actions-readme.html)). \n\nUsers can review their AWS CloudTrail logs for when the role was assumed to determine if this was expected. \n\n#### Impacted versions: \u003cv2.189.0\n\n### Patches\nThe patches are included in the CDK Construct Library release [v2.189.0](https://github.com/aws/aws-cdk/releases/tag/v2.189.0). We recommend upgrading to the latest version and ensuring any forked or derivative code is patched to incorporate the new fixes. \n\nWhen new CDK applications using the latest version are initialized, they will use the new behavior with more restrictive permissions.\n\nExisting applications must upgrade to the latest version, change the [feature flag](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md) (@aws-cdk/pipelines:reduceStageRoleTrustScope) and (@aws-cdk/pipelines:reduceCrossAccountActionRoleTrustScope) to true and redeploy the application to apply this fix and use the new behavior with more restrictive permissions.\n\n### Workarounds\nYou can explicitly supply the role for your [CodePipeline](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline-readme.html#cross-account-codepipelines) and follow the policy recommendations detailed in [CodePipeline documentation](https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-create-cross-account.html).\n\n### References\n[Original reporting issue.](https://github.com/aws/aws-cdk/issues/33709)\n\n\n\nIf you have any questions or comments about this advisory please contact AWS/Amazon Security via our [vulnerability reporting page](https://aws.amazon.com/security/vulnerability-reporting) or directly via email to [aws-security@amazon.com](mailto:aws-security@amazon.com). Please do not create a public GitHub issue.",
"id": "GHSA-5pq3-h73f-66hr",
"modified": "2025-04-10T02:02:59Z",
"published": "2025-03-24T15:45:39Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/aws/aws-cdk/security/advisories/GHSA-5pq3-h73f-66hr"
},
{
"type": "WEB",
"url": "https://github.com/aws/aws-cdk/issues/33709"
},
{
"type": "WEB",
"url": "https://github.com/aws/aws-cdk/commit/a64b01cc2969822bb92d7bd72152ecb2ccf1c1cf"
},
{
"type": "PACKAGE",
"url": "https://github.com/aws/aws-cdk"
},
{
"type": "WEB",
"url": "https://github.com/aws/aws-cdk/releases/tag/v2.184.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "AWS CDK CodePipeline: trusted entities are too broad"
}
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.