Security fixes in SMTP_SSL and SMTP_TLS strategies#104
Security fixes in SMTP_SSL and SMTP_TLS strategies#104bbottema merged 1 commit intobbottema:masterfrom
Conversation
|
It's worth noting that while having a certificate identity validation mechanism is required the STARTTLS/SMTPS RFCs, it's only "strongly recommended" by Oracle, who left it off "for compatibility with earlier releases of JavaMail". 🤦♂️ This is very dangerous default behavior - and it's no surprise that developers might miss this while building software on top of JavaMail.
|
- The SMTP_PLAIN transport strategy now attempts an (insecure) STARTTLS
upgrade where possible, but will always permit plaintext fallback to
preserve backwards-compatibility with unencrypted SMTP.
The opportunistic STARTTLS handshake in SMTP_PLAIN does not validate
the server certificate's issuer or identity; therefore, it does not
protect against active network attackers.
The STARTTLS handshake, in this transport strategy, is merely a best-effort
encryption mechanism to defend against passive network eavesdroppers.
- The SMTP_SSL and SMTP_TLS transport strategies now validate certificates
by setting JavaMail's `mail.<protocol>.ssl.checkserveridentity` property
to true.
Previously, no identity validation was performed, leaving SMTPS and
STARTTLS connections vulnerable to man-in-the-middle attacks. Without
identity validation, JavaMail accepts _any_ certificate issued by a
JVM-trusted CA, regardless of the identity encoded in the certificate.
- The SMTP_TLS transport strategy now requires STARTTLS support by setting
JavaMail's `mail.smtp.starttls.required` property to true.
Previously, STARTTLS support was not required, enabling a man-in-the-middle
attack whereby an attacker could strip the STARTTLS request from an SMTP
connection, causing JavaMail to fall back to plaintext SMTP for
authentication and email transport.
The SMTP_SSL and SMTP_TLS transport strategies now validate certificates
by setting JavaMail's
mail.<protocol>.ssl.checkserveridentitypropertyto true.
Previously, no identity validation was performed, leaving SMTPS and
STARTTLS connections vulnerable to man-in-the-middle attacks. Without
identity validation, JavaMail accepts any certificate issued by a
JVM-trusted CA, regardless of the identity encoded in the certificate.
The SMTP_TLS transport strategy now requires STARTTLS support by setting
JavaMail's
mail.smtp.starttls.requiredproperty to true.Previously, STARTTLS support was not required, enabling a man-in-the-middle
attack whereby an attacker could strip the STARTTLS request from an SMTP
connection, causing JavaMail to fall back to plaintext SMTP for
authentication and email transport.