Vulnerabilities in pkg:npm/mongodb-client-encryption

PACKAGE
Advisory Identifier: GHSA-rjmf-p882-645m
Advisory Summary

CVE-2021-20327 is a MODERATE (CVSS 6.8) improper certificate validation vulnerability (CWE-295: Improper Certificate Validation) affecting Mongodb client encryption libraries in the npm ecosystem. The issue involves mongodb-client-encryption vulnerable to improper certificate validation. Remediation is available by upgrading affected packages to version 1.2.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/mongodb-client-encryption

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/mongodb-client-encryption. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-rjmf-p882-645m CVE-2021-20327 MODERATE mongodb-client-encryption vulnerable to Improper Certificate Validation

CVE-2021-20327 at a Glance

CVE Identifier CVE-2021-20327
GHSA Identifier GHSA-rjmf-p882-645m
Severity MODERATE
CVSS v3.1 Base Score 6.8
CWE Classification CWE-295: Improper Certificate Validation
Affected Product Mongodb client encryption
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 6.8

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

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

How to Fix CVE-2021-20327

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

mongodb-client-encryption fixed: 1.2.1
npm install mongodb-client-encryption@1.2.1
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 mongodb-client-encryption

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2021-20327, inspect your project dependencies using npm:

npm ls mongodb-client-encryption

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

Note: The npm ls mongodb-client-encryption 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 CWE-295: Improper Certificate Validation, where the product does not validate, or incorrectly validates, a certificate. In Mongodb client encryption, 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

A specific version of the Node.js mongodb-client-encryption module does not perform correct validation of the KMS server’s certificate. This vulnerability in combination with a privileged network position active MITM attack could result in interception of traffic between the Node.js driver and the KMS service rendering client-side field level encryption (CSFLE) ineffective. This issue was discovered during internal testing and affects mongodb-client-encryption module version 1.2.0, which was available from 2021-Jan-29 and deprecated in the NPM Registry on 2021-Feb-04. This vulnerability does not impact driver traffic payloads with CSFLE-supported key services from applications residing inside the AWS, GCP, and Azure nework fabrics due to compensating controls in these environments. This issue does not impact driver workloads that don’t use Field Level Encryption. This issue affect MongoDB Node.js Driver mongodb-client-encryption module version 1.2.0

CVE-2021-20327 Affected Mongodb client encryption Versions

1 component(s)
Fixed Versions:
1.2.1
Product / Package Ecosystem Affected Versions Fixed Version
mongodb-client-encryption
npm
≥ 1.2.0
< 1.2.1
All 1 versions
1.2.0
1.2.1

References

Frequently Asked Questions

What is CVE-2021-20327?
CVE-2021-20327 is a security vulnerability in Mongodb client encryption involving mongodb-client-encryption vulnerable to Improper Certificate Validation under CWE-295: Improper Certificate Validation.
Which Mongodb client encryption versions are affected?
Affected versions include releases prior to 1.2.1 across affected packages: mongodb-client-encryption.
What version fixes CVE-2021-20327?
Upgrading to 1.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mongodb-client-encryption affected?
Yes, mongodb-client-encryption is affected in releases prior to 1.2.1. Upgrade your dependency to 1.2.1 or later.
What is the CVSS score of CVE-2021-20327?
CVE-2021-20327 has a CVSS v3.1 base score of 6.8 (MODERATE) with vector string CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2021-20327?
CVE-2021-20327 is classified under CWE-295: Improper Certificate Validation (The product does not validate, or incorrectly validates, a certificate.).
How can I check npm dependencies for CVE-2021-20327?
Run the dependency tree command: 'npm ls mongodb-client-encryption'. 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-rjmf-p882-645m",
  "modified" : "2024-09-16T22:04:44Z",
  "published" : "2021-04-12T18:51:17Z",
  "aliases" : [ "CVE-2021-20327" ],
  "summary" : "mongodb-client-encryption vulnerable to Improper Certificate Validation",
  "details" : "A specific version of the Node.js mongodb-client-encryption module does not perform correct validation of the KMS server’s certificate. This vulnerability in combination with a privileged network position active MITM attack could result in interception of traffic between the Node.js driver and the KMS service rendering client-side field level encryption (CSFLE) ineffective. This issue was discovered during internal testing and affects mongodb-client-encryption module version 1.2.0, which was available from 2021-Jan-29 and deprecated in the NPM Registry on 2021-Feb-04. This vulnerability does not impact driver traffic payloads with CSFLE-supported key services from applications residing inside the AWS, GCP, and Azure nework fabrics due to compensating controls in these environments. This issue does not impact driver workloads that don’t use Field Level Encryption. This issue affect MongoDB Node.js Driver mongodb-client-encryption module version 1.2.0",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:A/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "mongodb-client-encryption"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.2.0"
      }, {
        "fixed" : "1.2.1"
      } ]
    } ],
    "versions" : [ "1.2.0" ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-20327"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mongodb/libmongocrypt/commit/76365515ff8754b9f705e56428dd0d7efa7f541b"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mongodb/libmongocrypt"
  }, {
    "type" : "WEB",
    "url" : "https://jira.mongodb.org/browse/NODE-3125"
  }, {
    "type" : "WEB",
    "url" : "https://www.npmjs.com/advisories/1660"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-295" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-03-16T00:00:28Z",
    "nvd_published_at" : "2021-02-25T17:15:00Z"
  }
}