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

> AWS CDK CLI leaks AWS credentials to console output when using specific credential plugins, requiring an upgrade to secure sensitive data.

- **Severity:** Medium 5.7 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Mar 2025
- **Updated:** 14 Oct 2025
- **Also known as:** GHSA-v63m-x9r9-8gqp

## What is CVE-2025-2598?

CVE-2025-2598 is a medium-severity vulnerability in AWS Cloud Development Kit Command Line Interface, published on 21 Mar 2025. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

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.

Weakness: CWE-497 (Exposure of Sensitive System Information to an Unauthorized Control Sphere)

## Which versions are affected by CVE-2025-2598?

4 open source packages ship an affected version, including aws-cdk and cdk. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `aws-cdk` | npm | From 2.172.0 | 2.178.2 |
| `aws-cdk` | npm | From 2.172.0 | 2.178.2 |
| `cdk` | npm | From 2.172.0 | 2.178.2 |
| `cdk` | npm | From 2.172.0 | 2.178.2 |

Products: Amazon Aws Cloud Development Kit.

## How do I fix CVE-2025-2598?

Upgrade aws-cdk to 2.178.2 or later.

## Is CVE-2025-2598 being exploited?

There is no known exploitation of CVE-2025-2598 in the wild and no public exploit code.

Public exploit code:

- Testing if AWS exploit CVE-2025-2598 still works (github_poc): https://github.com/Catnip-Express-Maxim/AWSTESTEXPLOIT
- In theory, we exploit cve-2025-2598. Hope it works (github_poc): https://github.com/SallyXVIII/Final-Proj

## Other vulnerabilities in AWS Cloud Development Kit Command Line Interface

- [CVE-2023-35165](https://insights.sbomify.com/CVE-2023-35165/): AWS CDK EKS overly permissive trust policies (medium 6.6)
- [CVE-2024-45037](https://insights.sbomify.com/CVE-2024-45037/): AWS CDK RestApi not generating authorizationScope correctly in resultant CFN template (medium 6.4)
- [CVE-2025-23206](https://insights.sbomify.com/CVE-2025-23206/): IAM OIDC custom resource allows connection to unauthorized OIDC provider in aws-cdk (low 1.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-2598 and fix it if it is affected.

What it is: CVE-2025-2598 is a medium-severity vulnerability in AWS Cloud Development Kit Command Line Interface, published on 21 Mar 2025. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-2598 in the wild and no public exploit code.

Affected packages and fixed versions:
- aws-cdk (npm): affected from 2.172.0; fixed in 2.178.2
- aws-cdk (npm): affected from 2.172.0; fixed in 2.178.2
- cdk (npm): affected from 2.172.0; fixed in 2.178.2
- cdk (npm): affected from 2.172.0; fixed in 2.178.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-2598/ (Markdown: https://insights.sbomify.com/CVE-2025-2598/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-2598
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-2598
- OSV: https://osv.dev/vulnerability/CVE-2025-2598

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-2598/
Summaries are generated and may contain mistakes; the official description above is the record.
