CVE-2025-2598: AWS CDK CLI prints AWS credentials retrieved by custom credential plugins

Published Mar 21, 2025
·
Updated

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

Other sources

When the AWS Cloud Development Kit (AWS CDK) Command Line Interface (AWS CDK CLI) is used with a credential plugin which returns an expiration property with the retrieved AWS credentials, the credentials are printed to the console output. To mitigate this issue, users should upgrade to version 2.178.2 or later and ensure any forked or derivative code is patched to incorporate the new fixes.

MITRE

Affected Software

4 affected componentsFixes available
AWS Cloud Development Kit Command Line Interface<2.178.2
npm/cdk>=2.172.0<2.178.2
2.178.2
npm/aws-cdk>=2.172.0<2.178.2
2.178.2
Amazon AWS Cloud Development Kit>=2.172.0<2.178.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/cdk to a version that resolves this vulnerability.

    Fixed in 2.178.2
  2. Upgrade

    Upgrade npm/aws-cdk to a version that resolves this vulnerability.

    Fixed in 2.178.2
  3. Upgrade

    Upgrade AWS CDK CLI to a version that resolves this vulnerability.

    Fixed in 2.178.2
  4. Upgrade

    Upgrade AWS CDK CLI to a version that resolves this vulnerability.

    Fixed in 2.171.1
  5. Configuration

    In the credential plugin code you use, remove the `expiration` property from the object returned by the plugin.

    Custom credential plugin expiration property in the credentials object = removed
  6. Compensating control

    Assume that any user with access where the AWS CDK CLI was run may have access to credential data printed to the console output; restrict access to console output/logs and the execution environment accordingly.

Event History

Mar 21, 2025
CVE Published
via MITRE·02:14 PM
Data Sourced
via MITRE·02:14 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·03:15 PM
Affected Software
Advisory Published
via GitHub·05:43 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-2598?

CVE-2025-2598 is classified as a security vulnerability that exposes sensitive AWS credentials in command line output.

2

How do I fix CVE-2025-2598?

To fix CVE-2025-2598, you should upgrade the AWS Cloud Development Kit Command Line Interface to version 2.178.2 or later.

3

What software is affected by CVE-2025-2598?

CVE-2025-2598 specifically affects the AWS Cloud Development Kit Command Line Interface prior to version 2.178.2.

4

What is the impact of CVE-2025-2598?

The impact of CVE-2025-2598 includes the potential exposure of AWS credentials, which can lead to unauthorized access to AWS resources.

5

How does CVE-2025-2598 occur?

CVE-2025-2598 occurs when the AWS CDK CLI is used with a credential plugin that outputs AWS credentials containing an expiration property to the console.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203