Guide · SMTP and headers
SMTP smuggling: what it is and how to fix it
SMTP smuggling is an email spoofing technique that works when two mail servers disagree about where a message ends. SMTP ends a message with a line holding only a period, the sequence <CRLF>.<CRLF>. If a sending service passes a non-standard variant such as <LF>.<CR><LF> through unchanged, and the receiving server treats that variant as the end of the message, the receiver reads the rest of the body as new SMTP commands and accepts a second, smuggled message. That message arrives from the sending service's IP address, so it can pass SPF-based DMARC checks for any domain hosted at that service. The technique was made public in December 2023, and CVEs were assigned for Postfix, Sendmail and Exim. The fix belongs in mail servers: update them, turn on strict line-ending handling where it is optional, and ask the providers that run your mail for their status.
- Reading time
- 8 min
How SMTP marks the end of a message
RFC 5321, section 2.3.8, says lines end in CR followed immediately by LF, and that conforming implementations "MUST NOT recognize or generate any other character or character sequence as a line terminator". SMTP clients must not send a bare CR or a bare LF except as part of that pair.
Section 4.1.1.4 defines the end of the mail data as a line containing only a period, the sequence <CRLF>.<CRLF>. It also rules out the lenient reading: accepting lines that end only in LF "has proven to cause more interoperability problems than it solves", servers must not do it, and <LF>.<LF> must not be treated as the end of the mail data.
Ordinary text cannot end a message early, because of the transparency rule in section 4.5.2: before sending a line that starts with a period, the client adds one more period, and the server removes it again. A message can only end early at a server that accepts a line ending other than CRLF, which is where the risk comes from.
How the attack works
Postfix's SMTP smuggling page describes it as a composition of two email services that handle non-standard line endings differently:
| Role | What goes wrong |
|---|---|
| Sending service (A) | Accepts a message from an authenticated user that contains a non-standard end-of-data sequence in the middle, and forwards it verbatim. |
| Receiving server (B) | Treats the non-standard sequence as the real end of the message, then reads the text after it as SMTP commands. |
Both halves are needed. Service B ends up receiving two messages when service A sent only one: the first with the content before the non-standard sequence, the second with whatever followed it. Postfix's page says the vulnerability goes back decades to Sendmail allowing the non-standard LF line ending next to CRLF, a behavior other servers, Postfix and Exim among them, copied for compatibility.
Why the spoofed message passes SPF and DMARC
According to Postfix's page, the attacker can spoof a message from any MAIL FROM address whose domain is hosted at service A, to any recipient whose domain is hosted at service B. The spoofed message passes SPF-based DMARC checks at service B because its MAIL FROM domain is hosted at service A and it arrives from an IP address that belongs to service A.
Nothing about your DNS records is broken in that case. SPF checks whether the connecting server may use the MAIL FROM domain (envelope sender vs From), and here it is one of the servers you authorized. A p=reject policy (DMARC from none to reject) does not stop a message that passes. The weakness is in how the two servers parse the message, so the defense is to fix the servers.
The three CVEs
NVD published all three on 24 December 2023. Each description says remote attackers can use a published exploitation technique to inject messages with a spoofed MAIL FROM address, bypassing an SPF protection mechanism.
| CVE | Software | Affected, per NVD | Fix, per the project |
|---|---|---|---|
| CVE-2023-51764 | Postfix | Through 3.8.5, unless configured with the workaround settings | smtpd_forbid_bare_newline; see the next section |
| CVE-2023-51765 | Sendmail | Through 8.17.2, in certain configurations | 8.18.1 accepts only CRLF . CRLF as the end of a message |
| CVE-2023-51766 | Exim | Before 4.97.1, in certain PIPELINING/CHUNKING configurations | 4.97.1 or later |
Sendmail. The release notes for 8.18.1 (2024/01/31) say it accepts only CRLF as a line end, and so only CRLF . CRLF as the end of a message, and no longer accepts a CR or LF outside that pair. The new srv_features options O, U and G turn those checks off; the notes recommend doing that only for trusted networks.
Exim. Exim's advisory lists the fixed versions 4.97.1 and 4.98. If you cannot install one, it says to ask your package maintainer for a backported fix. As a workaround it gives disabling the CHUNKING advertisement, or the PIPELINING advertisement, for incoming connections (the EHLO guide shows where a server lists its extensions).
Postfix settings
Postfix has two settings for this, documented in postconf(5):
smtpd_forbid_bare_newlinecontrols lines that end in LF alone.normalizerequires the standard end-of-data sequence and otherwise treats a bare LF as CRLF;rejectrefuses any command or message content with a bare LF;yesis a compatibility alias fornormalize;nokeeps the old behavior. The default isnormalizein Postfix 3.9 and later andnobefore 3.9.smtpd_forbid_unauth_pipeliningdisconnects clients that break SMTP's command pipelining rules. It is on by default in Postfix 3.9 and later, and available but off in 3.8.1, 3.7.6, 3.6.10 and 3.5.20.
The yes and no settings arrived in Postfix 3.8.4, 3.7.9, 3.6.13 and 3.5.23; normalize and reject in 3.8.5, 3.7.10, 3.6.14 and 3.5.24. On those older branches the protection is optional and off by default, so an updated package is not enough on its own. The settings Postfix recommends are:
smtpd_forbid_bare_newline = normalize
smtpd_forbid_bare_newline_exclusions = $mynetworksThe exclusion keeps clients in your trusted networks working if they send non-standard line endings. Postfix warns that reject is more likely to refuse legitimate mail, for example from web applications or load balancer health checks. For any Postfix version, its page also gives a short-term workaround that rejects unauthorized command pipelining and removes CHUNKING from the EHLO reply. Patches for releases that are no longer supported are linked from Postfix's download page.
A checklist for mail admins
- List every server that receives mail. MX hosts, inbound gateways and filters, relays between internal systems, backup MX hosts and standby servers. Note the software and the exact package version of each.
- Compare packages with your distribution's tracker. Distributions backport fixes, so the upstream version number can mislead. Debian's tracker and Ubuntu's list the status and fixed package version for each release.
- Check the effective settings after updating. On Postfix before 3.9, turn on
smtpd_forbid_bare_newline. On Sendmail 8.18.1 or later, make sure O, U or G are not set outside trusted networks. Keep exclusions limited to networks you control. - Ask the providers that run your mail. For a hosted inbox, gateway or sending service, ask for its advisory or status for these CVEs and whether you need to change anything. You can only patch the servers you run.
- Do not trust every scanner verdict. Postfix's page on false smuggling claims says some test tools report patterns that an attacker cannot make an email service send.
What senders can do
These are our recommendations. If you only send through email service providers, you have no server to patch. But each service authorized in your SPF record sends from addresses that pass SPF for your domain, so any of them that forwarded a non-standard end-of-data sequence could play the role of service A. Keep that record to the services you still use, ask each one for its status on SMTP smuggling, and keep SPF, DKIM and DMARC in place: an enforced DMARC policy still stops ordinary spoofing from servers you never authorized. A spoofed message that reaches people in your name can also draw complaints that affect your sender reputation.
Questions
Is SMTP smuggling a flaw in SPF or DMARC?
No. SPF and DMARC give the correct answer for what they check: the message did come from a server authorized for the MAIL FROM domain. The flaw is that a receiving server accepted a non-standard end of message, which RFC 5321 forbids.
Does a stricter DMARC policy protect my domain?
Not against this. Postfix's page says the spoofed message passes SPF-based DMARC checks at the receiving service, so a quarantine or reject policy is never applied to it. Patching and configuring the receiving servers is what stops it.
I updated Postfix. Am I protected?
Postfix 3.9 and later turn the protection on by default. On 3.8.5, 3.7.10, 3.6.14 and 3.5.24, and the earlier fixed versions, the long-term protection is an option that is off by default: set smtpd_forbid_bare_newline, then confirm the value the server actually uses.
Will the stricter settings block legitimate mail?
normalize keeps compatibility with many clients that mix line endings: it still accepts bare LF line endings and only requires the standard end-of-data sequence, so it fails only with clients that do not end the message with <CRLF>.<CRLF>. reject refuses more. For both, Postfix's examples exclude trusted networks with smtpd_forbid_bare_newline_exclusions.
Related
- STARTTLS vs implicit TLS: submission and relay between servers.
- ARC for forwarded email: why authentication results change on the way.
Related guides
- SMTP envelope sender vs. From header: which address goes where?
- Moving DMARC from p=none to p=reject
- EHLO vs. HELO: what the SMTP greeting actually tells you
- STARTTLS vs. implicit TLS: which mode belongs on ports 587 and 465?
- What does ARC-Seal mean in a forwarded email?
- All guides
Sources
- RFC Editor: RFC 5321, Simple Mail Transfer Protocol: section 2.3.8 (lines and bare CR or LF), section 4.1.1.4 (end of mail data; no LF-only line endings) and section 4.5.2 (transparency).
- Postfix: SMTP Smuggling (last update 22 January 2024): how the attack works, its impact on SPF-based DMARC, the workarounds, the fixed versions and recommended settings.
- Postfix: postconf(5):
smtpd_forbid_bare_newline, its values, defaults and versions,smtpd_forbid_bare_newline_exclusionsandsmtpd_forbid_unauth_pipelining; checked 30 November 2026. - Postfix: False vulnerability claims based on non-viable attack patterns (last update 8 January 2024): test tools that report non-viable patterns.
- NVD: CVE-2023-51764, CVE-2023-51765 and CVE-2023-51766: descriptions, affected versions and publication date; checked 30 November 2026.
- Sendmail: Release notes: version 8.18.1 (2024/01/31), line endings and the
srv_featuresoptions O, U and G. - Exim: CVE-2023-51766: conditions, fixed versions and workarounds; checked 30 November 2026.
- Debian security tracker: CVE-2023-51764, CVE-2023-51765 and CVE-2023-51766, and Ubuntu: CVE-2023-51764: fixed package versions per release; checked 30 November 2026.
How we wrote this: drafted by the email-validation.org team with the help of AI writing tools, from our product documentation and the sources linked in the text.