# CVE-2024-45037: AWS CDK RestApi not generating authorizationScope correctly in resultant CFN template

> AWS CDK users may inadvertently grant Cognito users broader API access than intended due to incorrect authorization scope generation in CloudFormation templates.

- **Severity:** Medium 6.4 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 27 Aug 2024
- **Updated:** 27 Aug 2024
- **Also known as:** GHSA-qj85-69xf-2vxq

## What is CVE-2024-45037?

CVE-2024-45037 is a medium-severity missing authorization vulnerability in aws-cdk, published on 27 Aug 2024. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

The AWS Cloud Development Kit (CDK) is an open-source framework for defining cloud infrastructure using code. Customers use it to create their own applications which are converted to AWS CloudFormation templates during deployment to a customer’s AWS account. CDK contains pre-built components called "constructs" that are higher-level abstractions providing defaults and best practices. This approach enables developers to use familiar programming languages to define complex cloud infrastructure more efficiently than writing raw CloudFormation templates. We identified an issue in AWS Cloud Development Kit (CDK) which, under certain conditions, can result in granting authenticated Amazon Cognito users broader than intended access. Specifically, if a CDK application uses the "RestApi" construct with "CognitoUserPoolAuthorizer" as the authorizer and uses authorization scopes to limit access. This issue does not affect the availability of the specific API resources. Authenticated Cognito users may gain unintended access to protected API resources or methods, leading to potential data disclosure, and modification issues.  Impacted versions: >=2.142.0;<=2.148.0. A patch is included in CDK versions >=2.148.1. Users are advised to upgrade their AWS CDK version to 2.148.1 or newer and re-deploy their application(s) to address this issue.

Weakness: CWE-863 (Incorrect Authorization)

## Which versions are affected by CVE-2024-45037?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `aws-cdk` | npm | From 2.142.0 | 2.148.1 |
| `aws-cdk` | npm | From 2.142.0 | 2.148.1 |

Products: Amazon Aws Cloud Development Kit.

## How do I fix CVE-2024-45037?

Upgrade aws-cdk to 2.148.1 or later.

## Is CVE-2024-45037 being exploited?

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

## Other vulnerabilities in aws-cdk

- [CVE-2023-35165](https://insights.sbomify.com/CVE-2023-35165/): AWS CDK EKS overly permissive trust policies (medium 6.6)
- [CVE-2025-2598](https://insights.sbomify.com/CVE-2025-2598/): AWS CDK CLI prints AWS credentials retrieved by custom credential plugins (medium 5.7)
- [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-2024-45037 and fix it if it is affected.

What it is: CVE-2024-45037 is a medium-severity missing authorization vulnerability in aws-cdk, published on 27 Aug 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-45037 in the wild and no public exploit code.

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

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-2024-45037/ (Markdown: https://insights.sbomify.com/CVE-2024-45037/index.md)
```

## Sources

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

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