Messaging Fundamentals Series

📨 Understanding SMTP Smuggling From a Top 1% Perspective — Even If SPF/DKIM/DMARC All Pass, It Means Nothing if the Message's Own Boundary Gets Forged

Introduction

This article is part of the Top 1% Series Complete Article Guide, and article 4.4 in the Messaging Series.

Prerequisite Knowledge

Getting the Big Picture

An SMTP message body is supposed to end with a fixed end-of-data sequence: <CR><LF>.<CR><LF> (a newline, a period, a newline). SMTP smuggling abuses a subtle discrepancy in how the sending MTA and the receiving MTA each interpret this sequence (for example, whether a bare LF period, without an accompanying CR, counts as valid end-of-data). Using this interpretation mismatch, you can hide an entirely separate, sender-forged second message inside one legitimate message’s body.

sequenceDiagram
    participant Attacker as Attacker
    participant Outbound as Sending MTA
    participant Inbound as Receiving MTA
    Attacker->>Outbound: Embed a forged message with a hidden bare-LF terminator inside a legitimate message's body
    Outbound->>Outbound: Doesn't treat the bare LF as an end marker, forwards it as one single message
    Outbound->>Inbound: Forwards what looks like a single message
    Inbound->>Inbound: Treats the bare LF as an end marker, splitting it into two separate messages
    Inbound->>Inbound: The outer message passes SPF/DKIM/DMARC; the inner, forged one reaches the inbox

Deep Dive Into the Fundamentals

Why SPF/DKIM/DMARC All Pass Anyway

What SPF/DKIM/DMARC verify is the outer envelope, genuinely sent over a legitimate connection. That outer envelope itself really did arrive from a legitimate sender, with legitimate authentication credentials, so it correctly passes every one of SPF/DKIM/DMARC’s checks. But the forged message hidden inside it is the result of the receiving MTA’s own independent interpretation — “this is actually a separate message” — and falls entirely outside the scope of SPF/DKIM/DMARC’s envelope-level verification to begin with.

Real-World Vulnerabilities Discovered: Postfix, Sendmail, Exim

In 2023, this attack technique was confirmed to actually succeed against several major MTA software packages: Postfix (CVE-2023-51764), Sendmail (CVE-2023-51765), and Exim (CVE-2023-51766). For Postfix, a fix is available by enabling the smtpd_forbid_bare_newline=yes setting, which stops treating a bare LF without a CR as a valid component of the end-of-data sequence, closing this interpretation mismatch directly.

An Attack With the Exact Same Structure as HTTP Request Smuggling

This attack carries the exact same structural problem as HTTP request smuggling, covered in the Load Balancing Department. Both abuse the exact same class of bug: two different implementations disagreeing on “where exactly does one message’s boundary lie.” Whether the protocol is HTTP or SMTP, this is the same more general design challenge — keeping message-boundary interpretation consistent across multiple implementations — showing up in a different form.

What a Pro Sees Here (Top 1% Understanding)

“Passing Authentication” Never Guarantees “the Message’s Boundary Was Correctly Interpreted”

The authentication mechanisms SPF/DKIM/DMARC verify whether “this envelope genuinely came from a legitimate sender” — they were never meant to verify whether “this message’s boundary gets interpreted consistently across every relay in the path.” The habit of clearly distinguishing what a given verification actually covers from what falls outside its scope is the perspective a top-1% engineer carries.

Common Misconceptions and Pitfalls

Troubleshooting Perspective

  1. A spoofed email arrives despite passing SPF/DKIM/DMARC entirely: Check whether a technique like SMTP smuggling, abusing a message-boundary interpretation mismatch, is being used.
  2. You want to check whether your organization’s MTA is vulnerable to this attack: Check your MTA software’s version, the relevant CVE, and the recommended configuration change.
  3. You want to apply a fix for this attack on Postfix: Set smtpd_forbid_bare_newline=yes, which stops treating a bare LF as a valid component of the end-of-data sequence.

Summary

Takeaways to Apply Today

  1. Check whether your organization’s MTA software already has the known fix for SMTP smuggling applied.
  2. Whenever something “passes authentication,” always dig one layer deeper to check exactly what that verification actually covers.

References

Comments

Feel free to leave thoughts, questions, or corrections below (sign in with a GitHub account to comment or react).