GHSA-qq4x-c6h6-rfxh: Aws cdk lib Aws-cdk-lib Has Insertion Of Sensitive Vulnerability

MODERATE
CVSS 6.5
Published
Advisory Summary

GHSA-qq4x-c6h6-rfxh is a MODERATE (CVSS 6.5) aws-cdk-lib has insertion of sensitive vulnerability (General Security Weakness) affecting Aws cdk lib libraries in the npm ecosystem. The issue involves aws-cdk-lib has insertion of sensitive information into log file vulnerability when using cognito userpoolclient construct. Remediation is available by upgrading affected packages to version 2.187.0.

GHSA-qq4x-c6h6-rfxh at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-qq4x-c6h6-rfxh
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification General Security Weakness
Affected Product Aws cdk lib
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-qq4x-c6h6-rfxh

To remediate this vulnerability, upgrade all affected Aws cdk lib dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

aws-cdk-lib fixed: 2.187.0
npm install aws-cdk-lib@2.187.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls aws-cdk-lib

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-qq4x-c6h6-rfxh, inspect your project dependencies using npm:

npm ls aws-cdk-lib

Analyze the terminal output to locate any version of Aws cdk lib in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.187.0), your application is affected.

Note: The npm ls aws-cdk-lib command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under General Security Weakness. In Aws cdk lib, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary The [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/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](https://docs.aws.amazon.com/cdk/v2/guide/constructs.html)" 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. The CDK [Cognito UserPool](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPool.html) construct deploys an AWS cognito user pool. An [Amazon Cognito user pool](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools.html) is a user directory for web and mobile app authentication and authorization. Customers can deploy a client under this user pool through construct ‘[UserPoolClient](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPoolClient.html)’ or through helper method '[addClient](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPool.html#addwbrclientid-options)'. A user pool client resource represents an Amazon [Cognito user pool client](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-client-apps.html) which is a configuration within a user pool that interacts with one mobile or web application authenticating with Amazon Cognito. When users of the 'cognito.UserPoolClient' construct generate a secret value for the application client in AWS CDK, they can then reference the generated secrets in their stack. The CDK had an issue where, when the custom resource performed an SDK API call to 'DescribeCognitoUserPoolClient' to retrieve the generated secret, the full response was logged in the associated lambda function's log group. Any user authenticated in the account where logs of the custom resource are accessible and who has read-only permission could view the secret written to those logs. This issue does not affect customers who are generating the secret value outside of the CDK as the secret is not referenced or logged. ### Impact To leverage this issue, an actor has to be authenticated in the account where logs of the custom resource Custom::DescribeCognitoUserPoolClient are accessible and have read-only permission for lambda function logs. Users can review access to their log group through AWS CloudTrail logs to detect any unexpected access to read the logs. **Impacted versions: >2.37.0 and <=2.187.0** ### Patches The patches are included in the AWS CDK Library release v2.187.0. We recommend upgrading to the latest version and ensuring any forked or derivative code is patched to incorporate the new fixes. To fully address this issue, users should rotate the secret by generating a new secret stored in AWS Secrets Manager. References to the secret will use the new secret on update. When new CDK applications using the latest version are initialized, they will use the new behavior with updated logging. Existing applications must upgrade to the latest version, change the [feature flag](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md) (@aws-cdk/cognito:logUserPoolClientSecretValue) to false, redeploy the application to apply this fix and use the new implementation with updated logging behavior. ### Workarounds Users can override the implementation changing Logging to be Logging.withDataHidden(). For example define class CustomUserPoolClient extends UserPoolClient and  in the new class define get userPoolClientSecret() to use Logging.withDataHidden(). Example export class CustomUserPoolClient extends UserPoolClient { private readonly customUserPool : UserPool; private readonly customuserPoolClientId : string; constructor(scope: Construct, id: string, props: UserPoolClientProps) { super(scope, id, props); this.customUserPool = new UserPool(this, 'pool', { removalPolicy: RemovalPolicy.DESTROY, }); const client = this.customUserPool.addClient('client', { generateSecret: true }); } // Override the userPoolClientSecret getter to always return the secret public get userPoolClientSecret(): SecretValue { // Create the Custom Resource that assists in resolving the User Pool Client secret const secretValue = SecretValue.resourceAttribute(new AwsCustomResource( this, 'DescribeCognitoUserPoolClient', { resourceType: 'Custom::DescribeCognitoUserPoolClient', onUpdate: { region: cdk.Stack.of(this).region, service: 'CognitoIdentityServiceProvider', action: 'describeUserPoolClient', parameters: { UserPoolId: this.customUserPool.userPoolId, ClientId: this.customUserPool, }, physicalResourceId: PhysicalResourceId.of(this.userPoolClientId), // Disable logging of sensitive data logging: Logging.withDataHidden(), }, policy: AwsCustomResourcePolicy.fromSdkCalls({ resources: [this.customUserPool.userPoolArn], }), installLatestAwsSdk: false, }, ).getResponseField('UserPoolClient.ClientSecret')); return secretValue; } } ### References If you have any questions or comments about this advisory please contact AWS/Amazon Security via our [vulnerability reporting page](https://aws.amazon.com/security/vulnerability-reporting) or directly via email to [aws-security@amazon.com](mailto:aws-security@amazon.com). Please do not create a public GitHub issue.

GHSA-qq4x-c6h6-rfxh Affected Aws cdk lib Versions

1 component(s)
Fixed Versions:
2.187.0
Product / Package Ecosystem Affected Versions Fixed Version
aws-cdk-lib
npm
≥ 2.37.0
< 2.187.0
2.187.0

References

Frequently Asked Questions

What is GHSA-qq4x-c6h6-rfxh?
GHSA-qq4x-c6h6-rfxh is a security vulnerability in Aws cdk lib involving aws-cdk-lib has Insertion of Sensitive Information into Log File vulnerability when using Cognito UserPoolClient Construct under General Security Weakness.
Which Aws cdk lib versions are affected?
Affected versions include releases prior to 2.187.0 across affected packages: aws-cdk-lib.
What version fixes GHSA-qq4x-c6h6-rfxh?
Upgrading to 2.187.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is aws-cdk-lib affected?
Yes, aws-cdk-lib is affected in releases prior to 2.187.0. Upgrade your dependency to 2.187.0 or later.
What is the CVSS score of GHSA-qq4x-c6h6-rfxh?
GHSA-qq4x-c6h6-rfxh has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with GHSA-qq4x-c6h6-rfxh?
GHSA-qq4x-c6h6-rfxh is classified under General Security Weakness.
How can I check npm dependencies for GHSA-qq4x-c6h6-rfxh?
Run the dependency tree command: 'npm ls aws-cdk-lib'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-qq4x-c6h6-rfxh",
  "modified" : "2025-03-31T22:37:42Z",
  "published" : "2025-03-31T22:37:42Z",
  "aliases" : [ ],
  "summary" : "aws-cdk-lib has Insertion of Sensitive Information into Log File vulnerability when using Cognito UserPoolClient Construct",
  "details" : "### Summary\nThe [AWS Cloud Development Kit (CDK)](https://aws.amazon.com/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](https://docs.aws.amazon.com/cdk/v2/guide/constructs.html)\" 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.\n\nThe CDK [Cognito UserPool](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPool.html) construct deploys an AWS cognito user pool. An [Amazon Cognito user pool](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools.html) is a user directory for web and mobile app authentication and authorization. Customers can deploy a client under this user pool through construct ‘[UserPoolClient](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPoolClient.html)’ or through helper method '[addClient](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.UserPool.html#addwbrclientid-options)'. A user pool client resource represents an Amazon [Cognito user pool client](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-client-apps.html) which is a configuration within a user pool that interacts with one mobile or web application authenticating with Amazon Cognito. \n\n\nWhen users of the 'cognito.UserPoolClient' construct generate a secret value for the application client in AWS CDK, they can then reference the generated secrets in their stack. The CDK had an issue where, when the custom resource performed an SDK API call to 'DescribeCognitoUserPoolClient' to retrieve the generated secret, the full response was logged in the associated lambda function's log group. Any user authenticated in the account where logs of the custom resource are accessible and who has read-only permission could view the secret written to those logs. \n\nThis issue does not affect customers who are generating the secret value outside of the CDK as the secret is not referenced or logged.\n\n### Impact\nTo leverage this issue, an actor has to be authenticated in the account where logs of the custom resource Custom::DescribeCognitoUserPoolClient are accessible and have read-only permission for lambda function logs. \n\nUsers can review access to their log group through AWS CloudTrail logs to detect any unexpected access to read the logs.\n\n**Impacted versions: >2.37.0 and <=2.187.0**\n\n### Patches\nThe patches are included in the AWS CDK Library release v2.187.0. We recommend upgrading to the latest version and ensuring any forked or derivative code is patched to incorporate the new fixes. To fully address this issue, users should rotate the secret by generating a new secret stored in AWS Secrets Manager. References to the secret will use the new secret on update. \n\nWhen new CDK applications using the latest version are initialized, they will use the new behavior with updated logging. \n\nExisting applications must upgrade to the latest version, change the [feature flag](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md) (@aws-cdk/cognito:logUserPoolClientSecretValue) to false, redeploy the application to apply this fix and use the new implementation with updated logging behavior.\n\n### Workarounds\nUsers can override the implementation changing Logging to be Logging.withDataHidden(). For example define class CustomUserPoolClient extends UserPoolClient and  in the new class define get userPoolClientSecret() to use Logging.withDataHidden().\n\n\n\nExample\n\n    export class CustomUserPoolClient extends UserPoolClient {\n\n      private readonly customUserPool : UserPool;\n      private readonly customuserPoolClientId : string;\n      constructor(scope: Construct, id: string, props: UserPoolClientProps) {\n        super(scope, id, props);\n\n        this.customUserPool = new UserPool(this, 'pool', {\n          removalPolicy: RemovalPolicy.DESTROY,\n        });\n\n        const client = this.customUserPool.addClient('client', { generateSecret: true });\n      }\n\n\n\n      // Override the userPoolClientSecret getter to always return the secret\n      public get userPoolClientSecret(): SecretValue {\n        // Create the Custom Resource that assists in resolving the User Pool Client secret\n        const secretValue = SecretValue.resourceAttribute(new AwsCustomResource(\n          this,\n          'DescribeCognitoUserPoolClient',\n          {\n        resourceType: 'Custom::DescribeCognitoUserPoolClient',\n        onUpdate: {\n          region: cdk.Stack.of(this).region,\n          service: 'CognitoIdentityServiceProvider',\n          action: 'describeUserPoolClient',\n          parameters: {\n            UserPoolId: this.customUserPool.userPoolId,\n            ClientId: this.customUserPool,\n          },\n          physicalResourceId: PhysicalResourceId.of(this.userPoolClientId),\n          // Disable logging of sensitive data\n          logging: Logging.withDataHidden(),\n        },\n        policy: AwsCustomResourcePolicy.fromSdkCalls({\n          resources: [this.customUserPool.userPoolArn],\n        }),\n        installLatestAwsSdk: false,\n          },\n        ).getResponseField('UserPoolClient.ClientSecret'));\n        \n        return secretValue;\n      }\n    }\n\n\n\n### References\nIf you have any questions or comments about this advisory please contact AWS/Amazon Security via our [vulnerability reporting page](https://aws.amazon.com/security/vulnerability-reporting) or directly via email to [aws-security@amazon.com](mailto:aws-security@amazon.com). Please do not create a public GitHub issue.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "aws-cdk-lib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.37.0"
      }, {
        "fixed" : "2.187.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-cdk/security/advisories/GHSA-qq4x-c6h6-rfxh"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/aws-cdk/commit/d02e64aac18a72195ddcdb973defea7f32382c33"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aws/aws-cdk"
  } ],
  "database_specific" : {
    "cwe_ids" : [ ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-03-31T22:37:42Z",
    "nvd_published_at" : null
  }
}