Junglewise Threat Intelligence

CVE-2021-20327: MongoDB mongodb-client-encryption improper certificate validation

CVE-2021-20327 · Severity: low · CVSS 3.1 · Published 2021-04-12

Vendors: npm, MongoDB.

Executive brief

MongoDB's client-side encryption library for Node.js failed to properly validate the certificate of Key Management Service (KMS) servers used to protect encrypted database fields. An attacker with network access between an application and the KMS service could intercept and eavesdrop on encryption keys, bypassing the encryption protection entirely. This affects applications using MongoDB's client-side field-level encryption feature outside of major cloud providers.

Technical details

The mongodb-client-encryption module version 1.2.0 contains an improper certificate validation vulnerability (CWE-295) where the TLS connection to KMS endpoints was configured with `rejectUnauthorized: false`, disabling certificate verification. An attacker in an adjacent network position could perform a man-in-the-middle attack to intercept KMS traffic and extract encryption keys used for client-side field-level encryption (CSFLE). The vulnerability requires network-level access and a privileged MITM position but has no authentication or user interaction barriers. The fix, released in version 1.2.1, enables proper TLS certificate validation and correct Server Name Indication (SNI) handling.

Affected products

  • MongoDB mongodb-client-encryption 1.2.0

Timeline

  • 2021-02-25: disclosed: NVD publication date
  • 2021-04-12: advisory: GHSA advisory published
  • 2021: patched: Fixed in version 1.2.1

References