GHSA-qc59-cxj2-c2w4: Aws cdk lib Aws-cdk-lib's Aspect Order Change Causes Vulnerability

LOW
CVSS 2.2
CWE-279
Published
Advisory Summary

GHSA-qc59-cxj2-c2w4 is a LOW (CVSS 2.2) aws-cdk-lib's aspect order change causes vulnerability (CWE-279: Incorrect Execution-Assigned Permissions) affecting Aws cdk lib libraries in the npm ecosystem. The issue involves aws-cdk-lib's aspect order change causes different permissions boundary assigned to role. Remediation is available by upgrading affected packages to version 2.189.1.

GHSA-qc59-cxj2-c2w4 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-qc59-cxj2-c2w4
Severity LOW
CVSS v3.1 Base Score 2.2
CWE Classification CWE-279: Incorrect Execution-Assigned Permissions
Affected Product Aws cdk lib
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 2.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required High (PR:H)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix GHSA-qc59-cxj2-c2w4

To remediate this vulnerability, upgrade all affected Aws cdk lib dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

aws-cdk-lib fixed: 2.189.1
npm install aws-cdk-lib@2.189.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls aws-cdk-lib

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-qc59-cxj2-c2w4, inspect your project dependencies using npm:

npm ls aws-cdk-lib

Analyze the terminal output to locate any version of Aws cdk lib in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.189.1), your application is affected.

Note: The npm ls aws-cdk-lib command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-279: Incorrect Execution-Assigned Permissions, where while it is executing, the product sets the permissions of an object in a way that violates the intended permissions that have been specified by the user. In Aws cdk lib, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The [AWS Cloud Development Kit (AWS CDK)](https://aws.amazon.com/cdk/) is an open-source software development framework for defining cloud infrastructure in code and provisioning it through AWS CloudFormation. In the CDK, developers organize their applications into reusable components called "[constructs](https://docs.aws.amazon.com/cdk/v2/guide/constructs.html)," which are organized into a hierarchical tree structure. One of the features of this framework is the ability to call "[Aspects](https://docs.aws.amazon.com/cdk/v2/guide/aspects.html)," which are mechanisms to set configuration options for all AWS Resources in a particular part of the hierarchy at once. Aspect execution happens in a specific order, and the last Aspect to execute controls the final values in the template. AWS CDK version [2.172.0](https://github.com/aws/aws-cdk/releases/tag/v2.172.0) introduced a new priority system for Aspects. Prior to this version, CDK would run Aspects based on hierarchical location. The new priority system takes precedence over hierarchical location, altering the invocation order of Aspects. Different priority classes were introduced: Aspects added by CDK APIs were classified as MUTATING (priority 200), while Aspects added directly by the user were classified as DEFAULT (priority 500) unless the user specified otherwise. As a result of this change, CDK apps that use a custom Aspect to assign a default permissions boundary and then use a built-in CDK method to override it on select resources could have unexpected permissions boundaries assigned. The following is an affected code sample: ```ts Aspects.of(stack).add(new CustomAspectThatAssignsDefaultPermissionsBoundaries()); // {1} PermissionsBoundary.of(lambdaFunc).apply(...); // {2} -- uses Aspects internally ``` In versions prior to 2.172.0, the Aspect added by {2} would invoke last and assign its permissions boundary to the Lambda function role. In versions 2.172.0 and after, the Aspect added by {2} would have priority 200 while the Aspect added by {1} would have priority 500 and therefore be invoked last. The Lambda function role would get the permissions boundary of {1} assigned, which may not be what users expect. ### Impact If an unexpected permissions boundary is selected for a role, it could lead to that role having insufficient permissions. Alternatively, this could lead to a role having wider permissions than intended; however, this could happen only in combination with an overly permissive role policy, as permissions boundaries do not grant permissions by themselves. Impacted versions: versions 2.172.0 up until 2.189.1 ### Patches In version 2.189.1, the behavior has been reverted to the behavior of pre-2.172.0. The new behavior is available through a feature flag: ```json { "context": { "@aws-cdk/core:aspectPrioritiesMutating": true } } ``` The patches are included in AWS CDK Library version 2.189.1 and after. We recommend upgrading to the latest version and ensuring any forked or derivative code is patched to incorporate the new fixes. ### Workarounds As a workaround, users can use the location hierarchy to order the invocation of Aspects. To do this, users can assign the custom Aspect a priority of MUTATING to ensure it has the same priority as the Aspect added by the CDK API, and that the location hierarchy is used for the order of invocation Aspects. The following code is an example: ```ts Aspects.of(stack).add(new CustomAspectThatAssignsDefaultPermissionsBoundaries(), { priority: AspectPriority.MUTATING, }); ``` ### References If you have any questions or comments about this advisory, we ask that you 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. ### Credit We would like to thank GoDaddy for collaborating on this issue through the coordinated vulnerability disclosure process.

GHSA-qc59-cxj2-c2w4 Affected Aws cdk lib Versions

1 component(s)
Fixed Versions:
2.189.1
Product / Package Ecosystem Affected Versions Fixed Version
aws-cdk-lib
npm
≥ 2.172.0
< 2.189.1
2.189.1

References

Frequently Asked Questions

What is GHSA-qc59-cxj2-c2w4?
GHSA-qc59-cxj2-c2w4 is a security vulnerability in Aws cdk lib involving aws-cdk-lib's aspect order change causes different Permissions Boundary assigned to Role under CWE-279: Incorrect Execution-Assigned Permissions.
Which Aws cdk lib versions are affected?
Affected versions include releases prior to 2.189.1 across affected packages: aws-cdk-lib.
What version fixes GHSA-qc59-cxj2-c2w4?
Upgrading to 2.189.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is aws-cdk-lib affected?
Yes, aws-cdk-lib is affected in releases prior to 2.189.1. Upgrade your dependency to 2.189.1 or later.
What is the CVSS score of GHSA-qc59-cxj2-c2w4?
GHSA-qc59-cxj2-c2w4 has a CVSS v3.1 base score of 2.2 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with GHSA-qc59-cxj2-c2w4?
GHSA-qc59-cxj2-c2w4 is classified under CWE-279: Incorrect Execution-Assigned Permissions (While it is executing, the product sets the permissions of an object in a way that violates the intended permissions that have been specified by the user.).
How can I check npm dependencies for GHSA-qc59-cxj2-c2w4?
Run the dependency tree command: 'npm ls aws-cdk-lib'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qc59-cxj2-c2w4",
  "modified" : "2025-04-15T14:48:49Z",
  "published" : "2025-04-15T14:48:49Z",
  "aliases" : [ ],
  "summary" : "aws-cdk-lib's aspect order change causes different Permissions Boundary assigned to Role",
  "details" : "### Summary\n\nThe [AWS Cloud Development Kit (AWS CDK)](https://aws.amazon.com/cdk/) is an open-source software development framework for defining cloud infrastructure in code and provisioning it through AWS CloudFormation. In the CDK, developers organize their applications into reusable components called \"[constructs](https://docs.aws.amazon.com/cdk/v2/guide/constructs.html),\" which are organized into a hierarchical tree structure. One of the features of this framework is the ability to call \"[Aspects](https://docs.aws.amazon.com/cdk/v2/guide/aspects.html),\" which are mechanisms to set configuration options for all AWS Resources in a particular part of the hierarchy at once. Aspect execution happens in a specific order, and the last Aspect to execute controls the final values in the template.\n\nAWS CDK version [2.172.0](https://github.com/aws/aws-cdk/releases/tag/v2.172.0) introduced a new priority system for Aspects. Prior to this version, CDK would run Aspects based on hierarchical location. The new priority system takes precedence over hierarchical location, altering the invocation order of Aspects. Different priority classes were introduced: Aspects added by CDK APIs were classified as MUTATING (priority 200), while Aspects added directly by the user were classified as DEFAULT (priority 500) unless the user specified otherwise. As a result of this change, CDK apps that use a custom Aspect to assign a default permissions boundary and then use a built-in CDK method to override it on select resources could have unexpected permissions boundaries assigned. \n\nThe following is an affected code sample:\n\n```ts\nAspects.of(stack).add(new CustomAspectThatAssignsDefaultPermissionsBoundaries());   // {1}\n\nPermissionsBoundary.of(lambdaFunc).apply(...);  // {2} -- uses Aspects internally\n```\n\nIn versions prior to 2.172.0, the Aspect added by {2} would invoke last and assign its permissions boundary to the Lambda function role.\n\nIn versions 2.172.0 and after, the Aspect added by {2} would have priority 200 while the Aspect added by {1} would have priority 500 and therefore be invoked last. The Lambda function role would get the permissions boundary of {1} assigned, which may not be what users expect. \n\n### Impact\n\nIf an unexpected permissions boundary is selected for a role, it could lead to that role having insufficient permissions. Alternatively, this could lead to a role having wider permissions than intended; however, this could happen only in combination with an overly permissive role policy, as permissions boundaries do not grant permissions by themselves.\n\nImpacted versions: versions 2.172.0 up until 2.189.1\n\n### Patches\n\nIn version 2.189.1, the behavior has been reverted to the behavior of pre-2.172.0. The new behavior is available through a feature flag:\n\n```json\n{\n  \"context\": {\n    \"@aws-cdk/core:aspectPrioritiesMutating\": true\n  }\n}\n```\n\nThe patches are included in AWS CDK Library version 2.189.1 and after. We recommend upgrading to the latest version and ensuring any forked or derivative code is patched to incorporate the new fixes. \n\n### Workarounds\n\nAs a workaround, users can use the location hierarchy to order the invocation of Aspects. To do this, users can assign the custom Aspect a priority of MUTATING to ensure it has the same priority as the Aspect added by the CDK API, and that the location hierarchy is used for the order of invocation Aspects.\n\nThe following code is an example:\n\n```ts\nAspects.of(stack).add(new CustomAspectThatAssignsDefaultPermissionsBoundaries(), {\n  priority: AspectPriority.MUTATING,\n});\n```\n\n### References\n\nIf you have any questions or comments about this advisory, we ask that you 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.\n\n### Credit\n\nWe would like to thank GoDaddy for collaborating on this issue through the coordinated vulnerability disclosure process.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "aws-cdk-lib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.172.0"
      }, {
        "fixed" : "2.189.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-cdk/security/advisories/GHSA-qc59-cxj2-c2w4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-cdk/commit/b7f4bc7aee1d99b70e4d9d3cedea53e910ee37ef"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aws/aws-cdk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-cdk/releases/tag/v2.189.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-279" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-04-15T14:48:49Z",
    "nvd_published_at" : null
  }
}