Vulnerabilities in pkg:npm/cdk

PACKAGE
Advisory Identifier: GHSA-v63m-x9r9-8gqp
Advisory Summary

CVE-2025-2598 is a MODERATE (CVSS 5.5) aws cdk cli prints aws vulnerability (CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere) affecting Aws cdk libraries in the npm ecosystem. The issue involves aws cdk cli prints aws credentials retrieved by custom credential plugins. Remediation is available by upgrading affected packages to version 2.178.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/cdk

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/cdk. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-v63m-x9r9-8gqp CVE-2025-2598 MODERATE AWS CDK CLI prints AWS credentials retrieved by custom credential plugins

CVE-2025-2598 at a Glance

CVE Identifier CVE-2025-2598
GHSA Identifier GHSA-v63m-x9r9-8gqp
Severity MODERATE
CVSS v3.1 Base Score 5.5
CWE Classification CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere
Affected Product Aws cdk
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.5

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

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

How to Fix CVE-2025-2598

To remediate this vulnerability, upgrade all affected Aws cdk 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 fixed: 2.178.2
npm install aws-cdk@2.178.2
cdk fixed: 2.178.2
npm install cdk@2.178.2
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

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-2598, inspect your project dependencies using npm:

npm ls aws-cdk

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

Note: The npm ls aws-cdk 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-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere, where the product does not properly prevent sensitive system-level information from being accessed by unauthorized actors who do not have the same level of access to the underlying system as the product does. In Aws cdk, 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) [1] is an open-source software development framework for defining cloud infrastructure in code and provisioning it through AWS CloudFormation. The AWS CDK CLI [2] is a command line tool for interacting with CDK applications. Customers can use the CDK CLI to create, manage, and deploy their AWS CDK projects. An issue exists in the AWS CDK CLI where, under certain conditions, AWS credentials may be returned in the console output. Plugins that return an `expiration `property in the credentials object are affected by this issue. Plugins that omit the `expiration` property are not affected. ## Impact When customers run AWS CDK CLI commands with credential plugins and configure those plugins to return temporary credentials by including an `expiration` property, the AWS credentials retrieved by the plugin may be returned in the console output. Any user with access where the CDK CLI was ran would have access to this output. The following are examples of configuring a custom credential plugin: _Via command line option:_ `cdk deploy --plugin /path/to/plugin` _Via configuration file [3]:_ ```json { "plugin": "/path/to/plugin" } ``` Plugins that return an `expiration` property in the credentials object, such as the following example, are affected: ```console return { accessKeyId: '<access-key>', secretAccessKey: '<secret-access-key>', sessionToken: '<session-token>', expiration: <date>, }; ``` The `expiration` property indicates that the provided credentials are temporary. Please refer to our "AWS CDK CLI Library" guide for more information about custom credential plugins [4]. ## Impacted versions: >=2.172.0 and <2.178.2 ## Patches The issue has been addressed in version 2.178.2 [5]. We recommend upgrading to the latest version and ensuring any forked or derivative code is patched to incorporate the new fixes. ## Workarounds If you are unable to upgrade to version 2.178.2 or later, you can downgrade to version 2.171.1. If you are unable to downgrade, but have access to the code of the credential plugin you use, you can remove the `expiration` property from the object returned by the plugin. For example, change the code from returning this: ```javascript return { accessKeyId: assumeRoleOutput.Credentials.AccessKeyId, secretAccessKey: assumeRoleOutput.Credentials.SecretAccessKey, sessionToken: assumeRoleOutput.Credentials.SessionToken, // Expiration indicates to the CLI that this is temporary expiration: assumeRoleOutput.Credentials.Expiration, }; ``` To return this: ```javascript return { accessKeyId: assumeRoleOutput.Credentials.AccessKeyId, secretAccessKey: assumeRoleOutput.Credentials.SecretAccessKey, sessionToken: assumeRoleOutput.Credentials.SessionToken, }; ``` Note that this will prevent the CDK CLI from refreshing the credentials when needed, and may cause your workflow to fail on an expired credentials error. ## References [1] https://docs.aws.amazon.com/cdk/v2/guide/home.html [2] https://docs.aws.amazon.com/cdk/v2/guide/cli.html [3] https://docs.aws.amazon.com/cdk/v2/guide/cli.html#cli-config [4] https://www.npmjs.com/package/@aws-cdk/cli-plugin-contract [5] https://github.com/aws/aws-cdk/releases/tag/v2.178.2

CVE-2025-2598 Affected Aws cdk Versions

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

References

Frequently Asked Questions

What is CVE-2025-2598?
CVE-2025-2598 is a security vulnerability in Aws cdk involving AWS CDK CLI prints AWS credentials retrieved by custom credential plugins under CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere.
Which Aws cdk versions are affected?
Affected versions include releases prior to 2.178.2 across affected packages: aws-cdk, cdk.
What version fixes CVE-2025-2598?
Upgrading to 2.178.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is aws-cdk affected?
Yes, aws-cdk is affected in releases prior to 2.178.2. Upgrade your dependency to 2.178.2 or later.
Is cdk affected?
Yes, cdk is affected in releases prior to 2.178.2. Upgrade your dependency to 2.178.2 or later.
What is the CVSS score of CVE-2025-2598?
CVE-2025-2598 has a CVSS v3.1 base score of 5.5 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2025-2598?
CVE-2025-2598 is classified under CWE-497: Exposure of Sensitive System Information to an Unauthorized Control Sphere (The product does not properly prevent sensitive system-level information from being accessed by unauthorized actors who do not have the same level of access to the underlying system as the product does.).
How can I check npm dependencies for CVE-2025-2598?
Run the dependency tree command: 'npm ls aws-cdk'. 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-v63m-x9r9-8gqp",
  "modified" : "2025-10-14T21:58:44Z",
  "published" : "2025-03-21T17:43:09Z",
  "aliases" : [ "CVE-2025-2598" ],
  "summary" : "AWS CDK CLI prints AWS credentials retrieved by custom credential plugins",
  "details" : "## Summary\n\nThe AWS Cloud Development Kit (AWS CDK) [1] is an open-source software development framework for defining cloud infrastructure in code and provisioning it through AWS CloudFormation. The AWS CDK CLI [2] is a command line tool for interacting with CDK applications. Customers can use the CDK CLI to create, manage, and deploy their AWS CDK projects. \n\nAn issue exists in the AWS CDK CLI where, under certain conditions, AWS credentials may be returned in the console output. Plugins that return an `expiration `property in the credentials object are affected by this issue. Plugins that omit the `expiration` property are not affected. \n\n## Impact\n\nWhen customers run AWS CDK CLI commands with credential plugins and configure those plugins to return temporary credentials by including an `expiration` property, the AWS credentials retrieved by the plugin may be returned in the console output. Any user with access where the CDK CLI was ran would have access to this output. \n\nThe following are examples of configuring a custom credential plugin: \n\n_Via command line option:_\n\n`cdk deploy --plugin /path/to/plugin`\n\n_Via configuration file [3]:_\n\n```json\n{\n  \"plugin\": \"/path/to/plugin\"\n}\n```\n\nPlugins that return an `expiration` property in the credentials object, such as the following example, are affected:\n\n```console\nreturn {\n    accessKeyId: '<access-key>',\n    secretAccessKey: '<secret-access-key>',\n    sessionToken: '<session-token>',\n    expiration: <date>,\n};\n```\n\nThe `expiration` property indicates that the provided credentials are temporary. \n\nPlease refer to our \"AWS CDK CLI Library\" guide for more information about custom credential plugins [4].\n\n## Impacted versions:  >=2.172.0 and <2.178.2\n\n## Patches\n\nThe issue has been addressed in version 2.178.2 [5]. 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\nIf you are unable to upgrade to version 2.178.2 or later, you can downgrade to version 2.171.1. If you are unable to downgrade, but have access to the code of the credential plugin you use, you can remove the `expiration` property from the object returned by the plugin.\n\nFor example, change the code from returning this:\n\n```javascript\nreturn {\n    accessKeyId: assumeRoleOutput.Credentials.AccessKeyId,\n    secretAccessKey: assumeRoleOutput.Credentials.SecretAccessKey,\n    sessionToken: assumeRoleOutput.Credentials.SessionToken,\n\n    // Expiration indicates to the CLI that this is temporary\n    expiration: assumeRoleOutput.Credentials.Expiration,\n};\n```\n\nTo return this:\n\n```javascript\nreturn {\n    accessKeyId: assumeRoleOutput.Credentials.AccessKeyId,\n    secretAccessKey: assumeRoleOutput.Credentials.SecretAccessKey,\n    sessionToken: assumeRoleOutput.Credentials.SessionToken,\n};\n```\n\nNote that this will prevent the CDK CLI from refreshing the credentials when needed, and may cause your workflow to fail on an expired credentials error. \n\n## References\n\n[1] https://docs.aws.amazon.com/cdk/v2/guide/home.html\n\n[2] https://docs.aws.amazon.com/cdk/v2/guide/cli.html\n\n[3] https://docs.aws.amazon.com/cdk/v2/guide/cli.html#cli-config\n\n[4] https://www.npmjs.com/package/@aws-cdk/cli-plugin-contract\n\n[5] https://github.com/aws/aws-cdk/releases/tag/v2.178.2",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "aws-cdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.172.0"
      }, {
        "fixed" : "2.178.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "cdk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.172.0"
      }, {
        "fixed" : "2.178.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-cdk/security/advisories/GHSA-v63m-x9r9-8gqp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-2598"
  }, {
    "type" : "WEB",
    "url" : "https://aws.amazon.com/security/security-bulletins/AWS-2025-005"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aws/aws-cdk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-cdk/releases/tag/v2.178.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-497" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-21T17:43:09Z",
    "nvd_published_at" : "2025-03-21T15:15:43Z"
  }
}