GHSA-QC59-CXJ2-C2W4

GHSA-QC59-CXJ2-C2W4 is a low-severity security vulnerability in aws-cdk-lib (npm), affecting versions >= 2.172.0, < 2.189.1. It is fixed in 2.189.1.

Summary

The AWS Cloud Development Kit (AWS 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," which are organized into a hierarchical tree structure. One of the features of this framework is the ability to call "Aspects," 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 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:

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.

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:

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 or directly via email to [email protected]. 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.

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

GHSA-QC59-CXJ2-C2W4 has a CVSS score of 2.2 (Low). The vector is network-reachable, high privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.189.1); upgrading removes the vulnerable code path.

Affected versions

aws-cdk-lib (>= 2.172.0, < 2.189.1)

Security releases

aws-cdk-lib → 2.189.1 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

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:

{
  "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.

Frequently Asked Questions

  1. What is GHSA-QC59-CXJ2-C2W4? GHSA-QC59-CXJ2-C2W4 is a low-severity security vulnerability in aws-cdk-lib (npm), affecting versions >= 2.172.0, < 2.189.1. It is fixed in 2.189.1.
  2. How severe is GHSA-QC59-CXJ2-C2W4? GHSA-QC59-CXJ2-C2W4 has a CVSS score of 2.2 (Low). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of aws-cdk-lib are affected by GHSA-QC59-CXJ2-C2W4? aws-cdk-lib (npm) versions >= 2.172.0, < 2.189.1 is affected.
  4. Is there a fix for GHSA-QC59-CXJ2-C2W4? Yes. GHSA-QC59-CXJ2-C2W4 is fixed in 2.189.1. Upgrade to this version or later.
  5. Is GHSA-QC59-CXJ2-C2W4 exploitable, and should I be worried? Whether GHSA-QC59-CXJ2-C2W4 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether GHSA-QC59-CXJ2-C2W4 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix GHSA-QC59-CXJ2-C2W4? Upgrade aws-cdk-lib to 2.189.1 or later.

Other vulnerabilities in aws-cdk-lib

Stop the waste.
Protect your environment with Kodem.