SMTP smuggling lets an attacker send a spoofed message that passes SPF and DMARC, because two mail servers in a relay chain disagree about where one message ends and the next SMTP command begins. The weakness sits in how mail transfer agents (MTAs) handle non-standard line endings around the end-of-data marker, not in any single product, so the fix is a combination of patching, strict line-ending settings and checking every hop in your mail flow. This guide explains the issue conceptually, lists the published fixes and settings for each affected MTA, sets out what DMARC can and cannot do here, and covers detection. It is written for email administrators and security engineers who run or depend on Internet-facing MTAs. It deliberately contains no attack sequences. For the wider email security picture, see the Email Security Guide.
Key takeaways
- It is a disagreement, not a single bug. Smuggling needs an outbound server that passes a non-standard end-of-data sequence through and an inbound server that accepts it as the real end of the message.
- SPF and DMARC can pass. The smuggled message really leaves a legitimate provider's outbound server, so SPF passes for the forged domain and that is enough for DMARC to pass.
- RFC 5321 already forbids the root cause. Servers must not treat a bare line feed as a line terminator; the only end-of-data indication is a line containing only a full stop, terminated by CRLF.
- Patches exist for the main open-source MTAs. Postfix, Sendmail and Exim have published fixes and settings; managed services and gateways have their own vendor guidance.
- Check the whole chain. Researchers note that combinations of servers can create the condition even when each one looks fine alone, so test gateways, relays, backup MX and partner-hosted services together.
What SMTP smuggling is
SMTP smuggling was published by Timo Longin of SEC Consult on 18 December 2023, ahead of a talk at the 37C3 conference. CERT/CC followed with Vulnerability Note VU#302671 on 16 January 2024. SEC Consult compares it to HTTP request smuggling: content that one server treats as part of a message body is treated by the next server as new protocol commands. See the HTTP Request Smuggling Guide for the web equivalent.
In outline, without the exact byte sequences:
- An attacker holds an account at a sending mail provider and submits a message whose body contains a malformed end-of-data marker followed by text that looks like a second SMTP transaction.
- The provider's outbound MTA does not recognise the malformed marker as the end of the message, so it relays the whole body unchanged.
- The receiving MTA does recognise the malformed marker as the end of the first message, and reads the remaining text as fresh commands: a new sender, new recipients and a new message.
- That second message arrives over the provider's real connection, from the provider's real IP addresses, with whatever From domain the attacker chose among domains that provider sends for.
SEC Consult reported that GMX and Ionos outbound servers allowed smuggling from roughly 1.35 million Ionos-hosted domains (fixed by GMX in August 2023), and that Exchange Online outbound servers allowed spoofing of domains using Exchange Online (fixed by Microsoft in October 2023). Postfix, Sendmail and other inbound servers in their default configurations at the time were the receiving side.
Why end-of-data handling matters
SMTP sends message content after the DATA command, and the end of the content is signalled in-band. RFC 5321 section 4.1.1.4 defines the end of mail data as a line containing only a period, so the sequence is CRLF, full stop, CRLF. Section 2.3.8 says conforming implementations must not recognise any other character or sequence as a line terminator, and section 4.1.1.4 says SMTP servers must not accept lines ending only in LF, even in the name of improved robustness.
Many UNIX-derived servers historically tolerated bare LF or bare CR to stay compatible with sloppy clients. That tolerance is the gap: if the inbound server accepts a variant marker that the outbound server does not treat as special, the two disagree. Two related SMTP features change the picture:
| Feature | What it does | Relevance to smuggling |
|---|---|---|
| PIPELINING (RFC 2920) | Lets a client send several commands without waiting for each reply | Smuggled commands arrive in one burst; strict pipelining checks can detect commands sent out of turn |
| CHUNKING and BDAT (RFC 3030) | Sends message content in counted chunks instead of a terminated DATA stream | No in-band end-of-data marker; SEC Consult found inbound servers that support BDAT harder to target |
| Bare CR or LF in content | Characters outside a CRLF pair, forbidden in message bodies by RFC 5322 | The raw material of smuggling; normalising or rejecting them closes the gap on each side |
The fix therefore has two halves. Outbound servers should not relay stray CR or LF characters unchanged, and inbound servers should accept only the standard end-of-data sequence.
Affected MTA categories
MTAs and services are listed alphabetically. Status is taken from each vendor's or project's published material and the CERT/CC note; check the linked source for anything newer.
| MTA or service | Role in the research | Published fix or setting | Reference |
|---|---|---|---|
| aiosmtpd (Python) | Inbound | Upgrade to 1.4.5 or later | CVE-2024-27305 |
| Cisco Secure Email Gateway and Cloud Gateway | Inbound | Configurable CR and LF handling; Cisco's statement to CERT/CC recommends the default option that cleans bare CR and LF; the researcher's tracking page describes a Reject option that drops non-compliant messages | Cisco bug CSCwh10142 |
| Exim | Inbound | Fixed in 4.97.1 (and 4.98); versions up to 4.97 affected when both PIPELINING and CHUNKING are offered | CVE-2023-51766 |
| Microsoft Exchange Online | Outbound | Fixed by Microsoft in the service in October 2023, per SEC Consult | Service-side fix |
| Postfix | Inbound and outbound settings | Fixes in 3.8.4, 3.7.9, 3.6.13 and 3.5.23 (opt-in) and stronger options from 3.8.5, 3.7.10, 3.6.14, 3.5.24; on by default from 3.9 | CVE-2023-51764 |
| Sendmail | Inbound | Fixed in sendmail 8.18.1, which enforces stricter RFC compliance and may reject mail from non-compliant senders | CVE-2023-51765 |
| SurgeMail | Inbound | Configuration setting as a quick fix; upgrade to 7.7l3 or later | Vendor knowledge base |
Hosted mailbox providers and gateways fix their own platforms, so for those the customer-side work is confirming the vendor's position and configuring any CR and LF handling option the product exposes. For self-hosted MTAs the fix is yours to apply.
Patching and configuration
Each MTA below gets the vendor's own settings. Upgrade first, then set the line-ending controls, then test with legitimate senders before enforcing.
Cisco Secure Email
- Setting: review the CR and LF handling option in the mail flow and listener configuration. The researcher's tracking page reports that Cisco's updated handling can add an X-header when an invalid end-of-data sequence is received, which content filters can act on, says Clean still enables smuggling and treats Allow with that header as the better choice, and describes Reject as dropping messages that do not fully follow the RFCs; Cisco's own statement to CERT/CC takes a different view and recommends Clean.
- Action: choose the option with your Cisco support guidance for your release, and confirm the downstream mail server enforces strict end-of-data handling if bare characters are passed to it.
Exim
- Upgrade: install 4.97.1 or later, or a distribution package with the backported fix.
- Workaround if you cannot upgrade: the Exim advisory says to disable CHUNKING advertisement for incoming connections, or disable PIPELINING advertisement, so that a smuggled command trips Exim's synchronisation check.
Microsoft Exchange Online
- Status: SEC Consult reports Microsoft fixed outbound handling in October 2023, so tenants need no change for that path.
- Action: where Exchange Online relays through your own gateways or third-party connectors, include those hops in your chain test, because a combination of servers can still reintroduce the condition.
Postfix
- Inbound: set
smtpd_forbid_bare_newline = normalize(default from Postfix 3.9;yesis a compatibility alias). This requires the standard end-of-data sequence and treats other bare LF lines as CRLF. The stricterrejectvalue rejects any bare LF with the code insmtpd_forbid_bare_newline_reject_code(550 by default), and can break web applications, health checks and BDAT clients sending non-canonical MIME. - Exclusions:
smtpd_forbid_bare_newline_exclusionsdefaults to$mynetworks, so trusted internal senders keep working. Keep it narrow. - Pipelining:
smtpd_forbid_unauth_pipelining = yes(default from 3.9) disconnects clients that break pipelining rules with "554 5.5.0 Error: SMTP protocol synchronization". - Outbound:
cleanup_replace_stray_cr_lf = yesreplaces stray CR or LF characters in content with spaces to prevent outbound smuggling, before any DKIM signature is added. - Visibility: from Postfix 3.9,
smtpd_forbid_bare_newline = noteis available as a logging-oriented option, which helps you find non-compliant senders before moving to reject.
Sendmail
- Upgrade: move to sendmail 8.18.1 or later, which the Sendmail Consortium told CERT/CC enforces stricter RFC compliance.
- Action: expect some non-compliant senders to be rejected after the upgrade; identify them from logs and fix or exclude them deliberately rather than rolling back.
Mail server hardening beyond smuggling, such as relay restrictions and TLS, is covered in the Exim and Postfix Mail Server Hardening Guide and the SMTP Security, STARTTLS and MTA-STS Guide.
Rollout order
- Inventory every hop: MX hosts, backup MX, inbound gateways, internal relays, application relays and partner-hosted services that accept mail for your domains.
- Record versions and settings for each, against the table above.
- Patch in a pilot hop first, then the rest.
- Turn on logging-only modes (Postfix
note, gateway headers) for one to two weeks and list senders that send bare line endings. - Enforce normalise or reject, with narrow exclusions for named internal systems.
- Test the chain with the researcher's published test tooling in an authorised test window against your own systems only.
- Roll back by reverting the single setting on the affected hop if legitimate mail fails, and log the exclusion you add instead of leaving enforcement off.
DMARC limits
DMARC is still essential, but it does not stop SMTP smuggling. DMARC passes when SPF or DKIM passes and aligns with the From domain. A smuggled message leaves the legitimate provider's servers, so SPF passes for any domain that authorises that provider, and alignment holds. SEC Consult notes DKIM is not what makes the attack work.
| Control | Helps against smuggling? | Why |
|---|---|---|
| SPF with a shared provider include | No | The smuggled message comes from authorised IPs |
| DMARC p=reject | Limited | Passes via aligned SPF; still blocks ordinary direct spoofing |
| DKIM-only alignment policy | Partly | If your receiving policy relies on aligned DKIM from your own signing keys, a smuggled message without your signature stands out |
| Dedicated sending IPs or subdomains | Partly | Narrow SPF reduces the set of servers that can send as you |
| Inbound strict end-of-data handling | Yes | Removes the receiving side of the disagreement |
| Outbound normalisation of stray CR and LF | Yes | Removes the sending side of the disagreement |
See the DMARC, SPF and DKIM Guide for alignment and policy detail.
Detection
- MTA logs: Postfix bare LF notes and rejections; "SMTP protocol synchronization" disconnects in Postfix and Exim; gateway headers or log entries for invalid end-of-data sequences.
- Message pairs: two messages accepted on the same connection where the second has a different envelope sender and recipients from the first, from a large shared provider.
- Authentication results: messages with SPF pass and DMARC pass but no aligned DKIM signature from a domain that always DKIM-signs its mail.
- User reports: phishing reports of mail that appears to come from your own or a partner's domain with passing authentication.
Metrics that show the controls are working:
- Percentage of Internet-facing MTA hops on a fixed version with strict end-of-data handling enforced.
- Number of senders on bare line ending exclusion lists, trending down.
- Count of bare LF and synchronisation events per week, investigated within your triage target.
- Days since the last full mail chain smuggling test.
- Share of your own sending domains with DKIM on all outbound mail.
Common failure patterns
- Patching the MX but not the backup MX: CERT/CC specifically calls out backup MX records and partner-hosted services. An unpatched secondary is still a receiving path.
- Upgrading Postfix 3.5 to 3.8 without setting the parameter: on those branches the fix is opt-in. Only Postfix 3.9 and later enforce it by default.
- Reject everywhere on day one: monitoring agents, web forms and BDAT clients that send bare LF start bouncing, and the setting is rolled back entirely. Start with normalise or note.
- Treating DMARC pass as proof of origin: analysts close a report because authentication passed, when the message came through a smuggling path.
- Testing hops in isolation: each server passes alone, but a gateway in front of an MTA creates a new disagreement. Test the chain as mail actually flows.
Framework mapping
| Control area | NIST SP 800-53 Rev 5 | NIST CSF 2.0 | Other |
|---|---|---|---|
| Patch MTAs and gateways | SI-2 | PR.PS-02, ID.RA-01 | CIS Controls v8.1 Control 7 |
| Strict line-ending and pipelining settings | CM-6 | PR.PS-01 | CIS Controls v8.1 Control 9 |
| Inbound mail filtering | SI-8 | DE.CM-01 | ISO/IEC 27001:2022 A.5.14 Information transfer |
| Log review for bare LF and sync events | SI-4 | DE.CM-01 | ATT&CK T1566 Phishing (the delivery outcome) |
Practitioner checklist
- List every host that accepts or relays mail for your domains, including backup MX and partner services.
- Confirm Postfix is on 3.9, or on a fixed 3.5 to 3.8 release with
smtpd_forbid_bare_newlineset to yes (normalize or reject on 3.8.5, 3.7.10, 3.6.14, 3.5.24 and later). - Confirm Exim is 4.97.1 or later, or apply the CHUNKING or PIPELINING workaround.
- Confirm Sendmail is 8.18.1 or later.
- Review Cisco Secure Email CR and LF handling and other gateway options against vendor guidance.
- Enable outbound stray CR and LF normalisation on relays you operate.
- Run logging-only modes first, then enforce with narrow, documented exclusions.
- Sign all outbound mail with DKIM and review whether SPF includes are broader than needed.
- Alert on bare LF and synchronisation events and review them weekly.
- Run an authorised chain test after any mail flow change.
Standards and references
- IETF: RFC 5321 Simple Mail Transfer Protocol
- CERT/CC: VU#302671 SMTP end-of-data uncertainty can be abused to spoof emails
- SEC Consult: SMTP Smuggling, Spoofing E-Mails Worldwide
- SEC Consult: SMTP Smuggling vendor tracking site
- Postfix: postconf(5) configuration parameters
- Exim: CVE-2023-51766 advisory
Related NHI Mgmt Group resources: Email Security Guide · DMARC, SPF and DKIM Guide · SMTP Security, STARTTLS and MTA-STS Guide · Exim and Postfix Mail Server Hardening Guide