[deps] Tools: Update MailKit to 4.16.0 [SECURITY]#7502
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7502 +/- ##
=======================================
Coverage 59.11% 59.11%
=======================================
Files 2078 2078
Lines 91535 91535
Branches 8142 8142
=======================================
Hits 54111 54111
Misses 35496 35496
Partials 1928 1928 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
harr1424
approved these changes
Apr 20, 2026
harr1424
pushed a commit
that referenced
this pull request
Apr 20, 2026
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> (cherry picked from commit 327290c)
harr1424
added a commit
that referenced
this pull request
Apr 20, 2026
…ess option enabled (#7511) * fix sync bug (#7509) (cherry picked from commit 7c20581) * [deps] Tools: Update MailKit to 4.16.0 [SECURITY] (#7502) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> (cherry picked from commit 327290c) --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.
This PR contains the following updates:
4.15.0→4.16.0GitHub Vulnerability Alerts
GHSA-9j88-vvj5-vhgr
Summary
A STARTTLS Response Injection vulnerability in MailKit allows a Man-in-the-Middle attacker to inject arbitrary protocol responses across the plaintext-to-TLS trust boundary, enabling SASL authentication mechanism downgrade (e.g., forcing PLAIN instead of SCRAM-SHA-256). The internal read buffer in
SmtpStream,ImapStream, andPop3Streamis not flushed when the underlying stream is replaced withSslStreamduring STARTTLS upgrade, causing pre-TLS attacker-injected data to be processed as trusted post-TLS responses. This is the same vulnerability class as CVE-2021-23993 (Thunderbird), CVE-2021-33515 (Dovecot), and CVE-2011-0411 (Postfix).Details
The
Streamproperty inSmtpStream(line 84-86),ImapStream, andPop3Streamis a simple auto-property with no buffer reset:During the STARTTLS upgrade in
SmtpClient.cs(lines 1372-1389):A MitM appends extra data after the
"220 Ready\r\n"STARTTLS response. Both arrive in one TCP read intoSmtpStream's 4096-byte internal buffer.ReadResponse()parses"220 Ready"and stops — the injected data remains atinputIndex. AfterStream.Stream = tls, the buffer is not cleared. WhenEhlo()callsReadResponse(), it checksinputIndex == inputEnd— this is FALSE (injected data exists), so it processes the buffered pre-TLS data without reading from the new TLS stream.The same pattern exists in
ImapClient.cs(lines 1485-1509) andPop3Client.cs.Attack flow:
Suggested fix: Reset buffer indices when the stream is replaced:
PoC
Self-contained C# PoC — creates a fake SMTP server that injects a crafted EHLO response into the STARTTLS reply:
Result against MailKit 4.12.0:
Impact
Any application using MailKit with
SecureSocketOptions.StartTlsorStartTlsWhenAvailable(the default) is vulnerable. A network Man-in-the-Middle attacker can inject arbitrary SMTP/IMAP/POP3 responses that cross the plaintext-to-TLS trust boundary, enabling SASL authentication mechanism downgrade and capability manipulation. All three protocols (SMTP, IMAP, POP3) share the same vulnerable pattern. All MailKit versions through 4.12.0 are affected.Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:NRelease Notes
jstedfast/MailKit (MailKit)
v4.16.0Compare Source
(issue #1989)
(issue #1993)
v4.15.1Compare Source
to contain CRLF sequences which can be used to inject SMTP commands in the SmtpClient when it sends
MAIL FROMorRCPT TOcommands.Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.