# SMTP Smuggling

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS红队专家）</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS＆HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上关注我们 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。

</details>

## 基本信息

这种类型的漏洞最初是在[**这篇文章中发现的**](https://sec-consult.com/blog/detail/smtp-smuggling-spoofing-e-mails-worldwide/)，文章中解释了当完成电子邮件时，可以利用SMTP协议解释方式的差异，允许攻击者在合法电子邮件的正文中走私更多电子邮件，从而允许冒充受影响域的其他用户（例如<admin@outlook.com>），绕过SPF等防御措施。

### 为什么

这是因为在SMTP协议中，要发送的电子邮件的**数据**由用户（攻击者）控制，攻击者可以发送经过特殊设计的数据，滥用解析器中的差异，从而在接收器中走私额外的电子邮件。看一下原始文章中的这个示例：

<figure><img src="/files/3JzmFoQ0uO7Gm1YF6dts" alt=""><figcaption><p><a href="https://sec-consult.com/fileadmin/user_upload/sec-consult/Dynamisch/Blogartikel/2023_12/SMTP_Smuggling-Overview__09_.png">https://sec-consult.com/fileadmin/user_upload/sec-consult/Dynamisch/Blogartikel/2023_12/SMTP_Smuggling-Overview__09_.png</a></p></figcaption></figure>

### 如何

为了利用这个漏洞，攻击者需要发送一些数据，使**出站SMTP服务器认为只有1封电子邮件，而入站SMTP服务器认为有多封电子邮件**。

研究人员发现，不同的**入站服务器将不同的字符视为电子邮件消息的数据结尾**，而出站服务器则不会。\
例如，常规的数据结尾是`\r\n.`。但是，如果入站SMTP服务器还支持`\n.`，攻击者可以在他的电子邮件中添加**该数据，并开始指示新的SMTP命令**，以像前面的图像中那样走私它。

当然，这只有在**出站SMTP服务器不将此数据**视为消息数据的结尾时才能起作用，因为在这种情况下，它将看到2封电子邮件而不是1封，因此最终这就是在这个漏洞中被滥用的不同步。

潜在的不同步数据：

* `\n.`
* `\n.`

还要注意，SPF被绕过，因为如果您从`user@outlook.com`的电子邮件中走私一封来自`admin@outlook.com`的电子邮件，**发件人仍然是`outlook.com`**。

## **参考资料**

* <https://sec-consult.com/blog/detail/smtp-smuggling-spoofing-e-mails-worldwide/>

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS红队专家）</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS＆HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)收藏品
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上关注我们 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hacktricks.xsx.tw/network-services-pentesting/pentesting-smtp/smtp-smuggling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
