CVE-2021-20328 MongoDB Java driver client-side field level encryption not verifying KMS host name
Attackers with privileged network position can intercept traffic and bypass field-level encryption in MongoDB Java drivers due to missing KMS host name verification.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2021-20328?
CVE-2021-20328 is a medium-severity vulnerability in MongoDB Inc. mongo-java-driver, published on 25 Feb 2021. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Official 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.
Weakness: CWE-295
Which versions are affected by CVE-2021-20328?
28 open source packages ship an affected version, including org.mongodb:mongo-java-driver, org.mongodb:mongodb-driver and org.mongodb:mongodb-driver-legacy. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
org.mongodb:mongo-java-driver Maven | From 3.11.0 | 3.11.3 |
org.mongodb:mongo-java-driver Maven | From 3.11.0 | 3.11.3 |
org.mongodb:mongo-java-driver Maven | From 3.12.0 | 3.12.8 |
org.mongodb:mongo-java-driver Maven | From 3.12.0 | 3.12.8 |
org.mongodb:mongodb-driver Maven | From 3.11.0 | 3.11.3 |
org.mongodb:mongodb-driver Maven | From 3.11.0 | 3.11.3 |
22 more packages
org.mongodb:mongodb-driver Maven | From 3.12.0 | 3.12.8 |
org.mongodb:mongodb-driver Maven | From 3.12.0 | 3.12.8 |
org.mongodb:mongodb-driver-legacy Maven | From 3.11.0 | 3.11.3 |
org.mongodb:mongodb-driver-legacy Maven | From 3.11.0 | 3.11.3 |
org.mongodb:mongodb-driver-legacy Maven | From 3.12.0 | 3.12.8 |
org.mongodb:mongodb-driver-legacy Maven | From 3.12.0 | 3.12.8 |
org.mongodb:mongodb-driver-legacy Maven | From 4.0.0 | 4.0.6 |
org.mongodb:mongodb-driver-legacy Maven | From 4.0.0 | 4.0.6 |
org.mongodb:mongodb-driver-legacy Maven | From 4.1.0 | 4.1.2 |
org.mongodb:mongodb-driver-legacy Maven | From 4.1.0 | 4.1.2 |
org.mongodb:mongodb-driver-legacy Maven | From 4.2.0 | 4.2.1 |
org.mongodb:mongodb-driver-legacy Maven | From 4.2.0 | 4.2.1 |
org.mongodb:mongodb-driver-sync Maven | From 3.11.0 | 3.11.3 |
org.mongodb:mongodb-driver-sync Maven | From 3.11.0 | 3.11.3 |
org.mongodb:mongodb-driver-sync Maven | From 3.12.0 | 3.12.8 |
org.mongodb:mongodb-driver-sync Maven | From 3.12.0 | 3.12.8 |
org.mongodb:mongodb-driver-sync Maven | From 4.0.0 | 4.0.6 |
org.mongodb:mongodb-driver-sync Maven | From 4.0.0 | 4.0.6 |
org.mongodb:mongodb-driver-sync Maven | From 4.1.0 | 4.1.2 |
org.mongodb:mongodb-driver-sync Maven | From 4.1.0 | 4.1.2 |
org.mongodb:mongodb-driver-sync Maven | From 4.2.0 | 4.2.1 |
org.mongodb:mongodb-driver-sync Maven | From 4.2.0 | 4.2.1 |
Products include Mongodb Java Driver, Quarkus Quarkus.
How do I fix CVE-2021-20328?
Upgrade org.mongodb:mongo-java-driver to a fixed version for your release line: 3.11.3 or 3.12.8.
Is CVE-2021-20328 being exploited?
There is no known exploitation of CVE-2021-20328 in the wild and no public exploit code.
Other vulnerabilities in MongoDB Inc. mongo-java-driver
- CVE-2026-88032 Application denial of service via cancellation race in reactive client-side encryption in MongoDB Java Driver
- CVE-2026-18710 Cleartext Storage of Sensitive Information in MongoDB Driver Logging During Client Initialization
- CVE-2026-88033 GridFS data disclosure and deletion via query-operator injection in file IDs in the MongoDB Java Driver
Sources
Also known as GHSA-rghw-6px2-fgwc, UBUNTU-CVE-2021-20328.