CVE-2025-59937
JSON

8.2high

go-mail has insufficient address encoding when passing mail addresses to the SMTP client

Severity
8.2high CVSS:4.0 by GitHub_M
Exploit likelihood
0.54% (higher than 46% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-wpwj-69cm-q9c5GO-2025-3988

Description

go-mail is a comprehensive library for sending mails with Go. In versions 0.7.0 and below, due to incorrect handling of the mail.Address values when a sender- or recipient address is passed to the corresponding MAIL FROM or RCPT TO commands of the SMTP client, there is a possibility of wrong address routing or even ESMTP parameter smuggling. For successful exploitation, it is required that the user's code allows for arbitrary mail address input (i. e. through a web form or similar). If only static mail addresses are used (i. e. in a config file) and the mail addresses in use do not consist of quoted local parts, this should not affect users. This issue is fixed in version 0.7.1

Affected

Product or packageVersionsReported by
wneessen go-mail< 0.7.1CVE List
github.com/wneessen/go-mail (Go)before 0.7.1GitHub Advisory Database, Go Vulnerability Database
pebcak go-mailbefore 0.7.1NVD

All scores

GitHub_M8.2high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
NVD9.1critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

Classification

CWE-88

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

go-mail is a comprehensive library for sending mails with Go. In versions 0.7.0 and below, due to incorrect handling of the mail.Address values when a sender- or recipient address is passed to the corresponding MAIL FROM or RCPT TO commands of the SMTP client, there is a possibility of wrong address routing or even ESMTP parameter smuggling. For successful exploitation, it is required that the user's code allows for arbitrary mail address input (i. e. through a web form or similar). If only static mail addresses are used (i. e. in a config file) and the mail addresses in use do not consist of quoted local parts, this should not affect users. This issue is fixed in version 0.7.1

GitHub Advisory Database
Impact

Due to incorrect handling of the mail.Address values when a sender- or recipient address is passed to the corresponding MAIL FROM or RCPT TO commands of the SMTP client, this could lead to a possible wrong address routing or even to ESMTP parameter smuggling.

Vulnerability details

Instead of making use of the String() method of mail.Address, which takes care of proper escaping and quotation of mail address, we used the Address value of the mail.Address which is the raw value when passing it to our SMTP client.

This meant, if a mail address like this was set: "toni.tester@example.com> ORCPT=admin@admin.com"@example.com for a sender or recipient, instead of the correctly quoted/escaped address, the SMTP client would get the raw value passed which would translate into something like this being passed to the SMTP server: RCPT TO:<toni.tester@example.com> ORCPT=admin@admin.com@example.com>.

Since ORCTP is a valid command for the SMTP server, the mail would be routed to the wrong address. Additionally, other SMTP commands could potientially be smuggled in using this method causing unexpected behaviour.

Exploitation requirements

For successful exploitation of this vulnerability it is required that the user's code is allowing for arbitrary mail address input (i. e. through a web form or similar). If only static mail addresses are used (i. e. in a config file) and the mail addresses in use do not consist of quoted local parts, this should not affect your code.

Patches

The vulnerability has been fixed with PR #496 and the fix has been shipped with the go-mail v0.7.1 release.

Issue #495 holds the full report and discussion.

Go Vulnerability Database

Insufficient address encoding when passing mail addresses to the SMTP client in github.com/wneessen/go-mail

NVD (es)

go-mail es una completa biblioteca para enviar correos con Go. En las versiones 0.7.0 e inferiores, debido a un manejo incorrecto de los valores de mail.Address cuando una dirección de remitente o destinatario se pasa a los comandos MAIL FROM o RCPT TO correspondientes del cliente SMTP, existe la posibilidad de un enrutamiento de dirección incorrecto o incluso contrabando de parámetros ESMTP. Para una explotación exitosa, se requiere que el código del usuario permita la entrada arbitraria de direcciones de correo (es decir, a través de un formulario web o similar). Si solo se utilizan direcciones de correo estáticas (es decir, en un archivo de configuración) y las direcciones de correo en uso no consisten en partes locales entre comillas, esto no debería afectar a los usuarios. Este problema está solucionado en la versión 0.7.1

References

Related

Sources

SourceRecordLicence
CVE ListCVE-2025-59937 changed 2025-09-30CVE Terms of Use
GitHub Advisory DatabaseGHSA-wpwj-69cm-q9c5 changed 2026-09-10CC-BY-4.0
Go Vulnerability DatabaseGO-2025-3988 changed 2026-02-04CC-BY-4.0
NVDCVE-2025-59937 changed 2026-10-09Public domain