Improper Certificate Validation
Apache Sling Commons Messaging Mail provides a simple layer on top of JavaMail/Jakarta Mail for OSGi to send mails via SMTPS. To reduce the risk of "man in the middle" attacks additional server identity checks must be performed when accessing mail servers. For compatibility reasons these additional checks are disabled by default in JavaMail/Jakarta Mail. The SimpleMailService in Apache Sling Commons Messaging Mail 1.0 lacks an option to enable these checks for the shared mail session. A user could enable these checks nevertheless by accessing the session via the message created by SimpleMessageBuilder and setting the property mail.smtps.ssl.checkserveridentity to true. Apache Sling Commons Messaging Mail 2.0 adds support for enabling server identity checks and these checks are enabled by default. - https://javaee.github.io/javamail/docs/SSLNOTES.txt - https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html - https://github.com/eclipse-ee4j/mail/issues/429
CWE-295 - Improper Certificate Validation
The authenticity component of a web system stems from the ability to validate “Digital certificates”, which (i) establish trust between two or more entities sharing data over a network; (ii) ensure data at rest and transit is secure from unauthorized access; and (iii) check the identity of the actors that interact with the system. An application with absent or ineffective certificate validation mechanisms allows malicious users, impersonating trusted hosts, to manipulate the communication path between the client and the host, resulting in unauthorized access to data and to the application’s internal environment, and potentially enabling man-in-the-middle attacks.