Repository navigation
Verify SMTP server hostname on SSL/TLS connections - #527
Merged
NicoPiel merged 1 commit intoNov 18, 2026
Merged
Conversation
NicoPiel
requested review from
a team,
gibson9583,
jonbartels,
kayyagari,
kpalang,
mgaffigan,
ssrowe and
tonygermano
October 28, 2026 13:53
mgaffigan
approved these changes
Oct 28, 2026
mgaffigan
left a comment
Contributor
There was a problem hiding this comment.
This would be exploitable with MITM. Probably needs a CVE filed.
jonbartels
approved these changes
Nov 17, 2026
jonbartels
left a comment
Contributor
There was a problem hiding this comment.
Approved. Needs a note in the release notes so that users using SMTP that would somehow not pass the server identity check to fix that BEFORE upgrading.
tonygermano
force-pushed
the
fix/smtp-hostname-verification
branch
from
November 18, 2026 18:33
fbfc446 to
dc6587c
Compare
tonygermano
removed their request for review
November 18, 2026 18:38
commons-email only checks the certificate chain by default, so any valid certificate was accepted regardless of host. Enable server identity checking wherever SSL or STARTTLS is configured. Signed-off-by: Nico Piel <nico.piel@hotmail.de> Signed-off-by: Tony Germano <tony@germano.name>
NicoPiel
force-pushed
the
fix/smtp-hostname-verification
branch
from
November 18, 2026 21:38
dc6587c to
cfde7ec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Calls
email.setSSLCheckServerIdentity(true)wherever SMTP is set up with SSL or STARTTLS:DefaultSmtpConfiguration(SMTP Sender connector)DefaultConfigurationController(server email settings / test email)ServerSMTPConnectionWhy
SonarQube flags these as
java:S5527(6 critical issues). By default commons-email checks the certificate chain but never matches the certificate to the host. So anyone in the network path with any valid certificate could intercept SMTP traffic, including the login credentials.Reviewer notes
./gradlew :server:compileJavaon JDK 17. No automated tests cover these paths, and I haven't tested it against a real TLS mail server.🤖 Generated with Claude Code