IAM OIDC custom resource allows connection to unauthorized OIDC provider
LowCVE-2025-23206 · Published Jan 17, 2025
### Impact Users who use IAM OIDC custom resource provider package will download CA Thumbprints as part of the custom resource workflow, https://github.com/aws/aws-cdk/blob/d16482fc8a4a3e1f62751f481b770c09034df7d2/packages/%40aws-cdk/custom-resource-handlers/lib/aws-iam/oidc-handler/external.ts#L34. However, the current `tls.connect` method will always set `rejectUnauthorized: false` which is a potential security concern. CDK should follow the best practice and set `rejectUnauthorized: true`. However, this could be a breaking change for existing CDK applications and we should fix this with a feature flag. Note that this is marked as low severity Security advisory because the issuer url is provided by CDK users who define the CDK application. If they insist on connecting to a unauthorized OIDC provider, CDK should not disallow this. Additionally, the code block is run in a Lambda environment which mitigate the MITM attack. As a best practice, CDK should still fix this issue under a feature flag to avoid regression. ``` packages/@aws-cdk/custom-resource-handlers/lib/aws-iam/oidc-handler/external.ts ❯❱ problem-based-packs.insecure-transport.js-node.bypass-tls-verification.bypass-t...
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| aws-cdk Product | < 2.177.0 | 2.177.0 |
Details and references
### Impact Users who use IAM OIDC custom resource provider package will download CA Thumbprints as part of the custom resource workflow, https://github.com/aws/aws-cdk/blob/d16482fc8a4a3e1f62751f481b770c09034df7d2/packages/%40aws-cdk/custom-resource-handlers/lib/aws-iam/oidc-handler/external.ts#L34. However, the current `tls.connect` method will always set `rejectUnauthorized: false` which is a potential security concern. CDK should follow the best practice and set `rejectUnauthorized: true`. However, this could be a breaking change for existing CDK applications and we should fix this with a feature flag. Note that this is marked as low severity Security advisory because the issuer url is provided by CDK users who define the CDK application. If they insist on connecting to a unauthorized OIDC provider, CDK should not disallow this. Additionally, the code block is run in a Lambda environment which mitigate the MITM attack. As a best practice, CDK should still fix this issue under a feature flag to avoid regression. ``` packages/@aws-cdk/custom-resource-handlers/lib/aws-iam/oidc-handler/external.ts ❯❱ problem-based-packs.insecure-transport.js-node.bypass-tls-verification.bypass-tls-verification Checks for setting the environment variable NODE_TLS_REJECT_UNAUTHORIZED to 0, which disables TLS verification. This should only be used for debugging purposes. Setting the option rejectUnauthorized to false bypasses verification against the list of trusted CAs, which also leads to insecure transport. ``` ### Patches The patch is in progress. To mitigate, upgrade to CDK v2.177.0 (Expected release date 2025-02-22). Once upgraded, please make sure the feature flag '@aws-cdk/aws-iam:oidcRejectUnauthorizedConnections' is set to true in `cdk.context.json` or `cdk.json`. More details on feature flag setting is [here](https://docs.aws.amazon.com/cdk/v2/guide/featureflags.html). ### Workarounds N/A ### References https://github.com/aws/aws-cdk/issues/32920
- Severity from
- GitHub (reviewed advisory)
More AWS advisories
All AWS| Date | Advisory | Severity | Fixed in |
|---|---|---|---|
| Mar 312025 | Insertion of Sensitive Information into Log File in aws-cdk-lib when using Cognito UserPoolClient Construct | Medium6.5 | 2.187.0 |
| Mar 312025 | Path Traversal in AWS SAM CLI allows file copy to local cache | Medium6.5 | 1.134.0 |
| Mar 312025 | Path Traversal in AWS SAM CLI allows file copy to build container | Medium6.5 | 1.133.0 |
| Mar 222025 | AWS CDK CodePipeline: trusted entities are too broad | Low3.8 | 2.189.0 |
| Mar 212025 | AWS CDK CLI prints AWS credentials retrieved by custom credential plugins | Medium5.7 | 2.178.2+1 more |
| Nov 142024 | Undefined behavior at process exit | Low | v1.5.9+1 more |