Medium, CVSS 6.5NuGetPublished
MailKit has STARTTLS Response Injection via unflushed stream buffer that enables SASL mechanism downgrade
CVE-2026-41319 · GHSA-9j88-vvj5-vhgr
- Affected
- NuGet mailkit < 4.16.0
- Fixed in
- 4.16.0· Vendor fix available
- Issue
- 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, and Pop3Stream is not flushed when the underlying stream is replaced with SslStream during 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 Stream property in SmtpStream (line 84-86), ImapStream, and Pop3Stream is 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 into SmtpStream's 4096-byte internal buffer.…
Recommended action: Upgrade to 4.16.0 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.