Executive brief
AWS CDK's IAM OIDC custom resource handler disables TLS certificate validation when connecting to OIDC providers to download CA thumbprints. This allows attackers on the network to intercept and redirect connections to unauthorized OIDC providers through man-in-the-middle attacks. While CDK users define the OIDC provider URLs, the disabled validation increases risk if those URLs are compromised or misconfigured.
Technical details
The vulnerability is a TLS verification bypass (CWE-347) in the IAM OIDC custom resource handler. The tls.connect method in aws-cdk/packages/@aws-cdk/custom-resource-handlers/lib/aws-iam/oidc-handler/external.ts sets rejectUnauthorized: false, which disables validation against trusted certificate authorities. An attacker capable of network interception (MITM) could redirect OIDC provider connections to an unauthorized server. The code executes in a Lambda environment, which provides some mitigation. The fix is available in CDK v2.177.0 and later; users must also enable the feature flag '@aws-cdk/aws-iam:oidcRejectUnauthorizedConnections' set to true in their cdk.context.json or cdk.json configuration.
Affected products
- AWS Cloud Development Kit before 2.177.0
Timeline
- 2025-01-17: disclosed: Advisory published
- 2025-02-22: patched: Patch released in CDK v2.177.0