Missing SSL host check in SMTP

Description

Missing SSL host check in SMTP can compromise the security of email communications. This vulnerability arises when SSL certificates are not properly validated to ensure they originate from the anticipated host, potentially allowing attackers to pose as legitimate entities by leveraging valid SSL certificates from other hosts.

Remediations

  • Do configure your email client to verify the server's identity. This step is crucial to prevent attackers from impersonating a trusted server, which could lead to redirection or spoofing attacks.
    Email email = new Email();
    email.setSSLOnConnect(true);
    email.setSSLCheckServerIdentity(true);

Associated CWE

OWASP Top 10

Configuration

To skip this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --skip-rule=java_lang_missing_smtp_ssl_host_check

To run only this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --only-rule=java_lang_missing_smtp_ssl_host_check