Vulnerabilities in pkg:maven/org.mongodb/mongodb-driver
PACKAGECVE-2021-20328 is a MODERATE (CVSS 6.8) improper certificate validation vulnerability (CWE-295: Improper Certificate Validation) affecting Mongodb driver libraries in the Maven ecosystem. The issue involves improper certificate validation in mongodb. Remediation is available by upgrading affected packages to version 3.11.3, 3.12.8, 4.0.6, 4.1.2, 4.2.1.
pkg:maven/org.mongodb/mongodb-driver
Vulnerability advisories affecting package pkg:maven/org.mongodb/mongodb-driver. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-rghw-6px2-fgwc | CVE-2021-20328 | MODERATE | Improper Certificate Validation in MongoDB |
CVE-2021-20328 at a Glance
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).
How to Fix CVE-2021-20328
To remediate this vulnerability, upgrade all affected Mongodb driver dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.11.3</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.12.8</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.0.6</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.11.3</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.12.8</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-legacy</artifactId>
<version>4.0.6</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-legacy</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-legacy</artifactId>
<version>3.11.3</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-legacy</artifactId>
<version>3.12.8</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>3.12.8</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>3.11.3</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-legacy</artifactId>
<version>4.2.1</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.mongodb
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2021-20328, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.mongodb
Analyze the terminal output to locate any version of Mongodb driver in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.11.3), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.mongodb command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
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 driver, 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
CVE-2021-20328 Affected Mongodb driver Versions
14 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.mongodb:mongodb-driver
|
Maven |
≥ 3.11.0
< 3.11.3
|
3.11.3
|
|
org.mongodb:mongodb-driver
|
Maven |
≥ 3.12.0
< 3.12.8
|
3.12.8
|
|
org.mongodb:mongodb-driver-sync
|
Maven |
≥ 4.0.0
< 4.0.6
|
4.0.6
|
|
org.mongodb:mongodb-driver-sync
|
Maven |
≥ 4.1.0
< 4.1.2
|
4.1.2
|
|
org.mongodb:mongodb-driver-sync
|
Maven |
≥ 4.2.0
< 4.2.1
All 1 versions
4.2.0
|
4.2.1
|
|
org.mongodb:mongo-java-driver
|
Maven |
≥ 3.11.0
< 3.11.3
|
3.11.3
|
|
org.mongodb:mongo-java-driver
|
Maven |
≥ 3.12.0
< 3.12.8
|
3.12.8
|
|
org.mongodb:mongodb-driver-legacy
|
Maven |
≥ 4.0.0
< 4.0.6
|
4.0.6
|
|
org.mongodb:mongodb-driver-legacy
|
Maven |
≥ 4.1.0
< 4.1.2
|
4.1.2
|
|
org.mongodb:mongodb-driver-legacy
|
Maven |
≥ 3.11.0
< 3.11.3
|
3.11.3
|
|
org.mongodb:mongodb-driver-legacy
|
Maven |
≥ 3.12.0
< 3.12.8
|
3.12.8
|
|
org.mongodb:mongodb-driver-sync
|
Maven |
≥ 3.12.0
< 3.12.8
|
3.12.8
|
|
org.mongodb:mongodb-driver-sync
|
Maven |
≥ 3.11.0
< 3.11.3
|
3.11.3
|
|
org.mongodb:mongodb-driver-legacy
|
Maven |
≥ 4.2.0
< 4.2.1
All 1 versions
4.2.0
|
4.2.1
|
References
Frequently Asked Questions
What is CVE-2021-20328?
Which Mongodb driver versions are affected?
What version fixes CVE-2021-20328?
Is mongodb-driver affected?
Is mongodb-driver-sync affected?
What is the CVSS score of CVE-2021-20328?
What CWE is associated with CVE-2021-20328?
How can I check Maven dependencies for CVE-2021-20328?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-rghw-6px2-fgwc",
"modified" : "2024-02-13T19:27:59Z",
"published" : "2022-05-24T22:28:56Z",
"aliases" : [ "CVE-2021-20328" ],
"summary" : "Improper Certificate Validation in MongoDB",
"details" : "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.",
"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" : "Maven",
"name" : "org.mongodb:mongodb-driver"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.11.0"
}, {
"fixed" : "3.11.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.11.2"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.12.0"
}, {
"fixed" : "3.12.8"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.12.7"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-sync"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.0.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.0.5"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-sync"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.1.0"
}, {
"fixed" : "4.1.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.1.1"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-sync"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.2.0"
}, {
"fixed" : "4.2.1"
} ]
} ],
"versions" : [ "4.2.0" ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongo-java-driver"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.11.0"
}, {
"fixed" : "3.11.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.11.2"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongo-java-driver"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.12.0"
}, {
"fixed" : "3.12.8"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.12.7"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-legacy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.0.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.0.5"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-legacy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.1.0"
}, {
"fixed" : "4.1.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.1.1"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-legacy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.11.0"
}, {
"fixed" : "3.11.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.11.2"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-legacy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.12.0"
}, {
"fixed" : "3.12.8"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.12.7"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-sync"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.12.0"
}, {
"fixed" : "3.12.8"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.12.7"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-sync"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.11.0"
}, {
"fixed" : "3.11.3"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.11.2"
}
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.mongodb:mongodb-driver-legacy"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.2.0"
}, {
"fixed" : "4.2.1"
} ]
} ],
"versions" : [ "4.2.0" ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-20328"
}, {
"type" : "WEB",
"url" : "https://jira.mongodb.org/browse/JAVA-4017"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-295" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-22T18:49:12Z",
"nvd_published_at" : "2021-02-25T17:15:00Z"
}
}