Skip to content

MongoDB Client with SSL Hostname Verification Disabled

Description

The MongoDB client has SSL hostname verification disabled, which can lead to man-in-the-middle attacks. This is a security risk because it allows an attacker to impersonate the MongoDB server.

Examples

Insecure Code

java
$SETTINGS.invalidHostNameAllowed(true)

Secure Code

java
$SETTINGS.invalidHostNameAllowed(false)

Remediation

Enable SSL hostname verification by setting invalidHostNameAllowed to false.

Rule Details

FieldValue
IDCODE-0292
CategoryCrypto
SeverityCRITICAL
CWECWE-295
ConfidenceHIGH
ImpactHIGH
LikelihoodHIGH
ExploitabilityEASY
Tagsmongodb, ssl, tls
OWASPN/A

References