Executive brief
Nodemailer is a popular Node.js library for sending emails via SMTP. A flaw in versions up to 8.0.4 allows attackers who can control the transport name configuration option to inject arbitrary SMTP commands by embedding carriage-return and line-feed characters. This could enable phishing attacks, email spoofing, and unauthorized message relaying through the target's SMTP server.
Technical details
The vulnerability is a CRLF injection in the SMTP connection initialization code (lib/smtp-connection/index.js). The transport name option is concatenated directly into the EHLO/HELO/LHLO SMTP commands without sanitization for \r\n sequences. When the SMTP server processes these injected newlines, each becomes a separate command; an attacker can inject MAIL FROM, RCPT TO, DATA, and email content to send fraudulent messages. The attack occurs before authentication and requires only the ability to control the name configuration parameter—for example, in multi-tenant SaaS platforms, admin panels with database-driven SMTP settings, or applications accepting external configuration. A fix is available in version 8.0.5, which strips CRLF characters from the name parameter.
Affected products
- Nodemailer Nodemailer up to and including 8.0.4
Timeline
- 2026-04-08: disclosed: GHSA-vvjj-xcjg-gr5g published
- 2026-04-08: patched: Fix released in version 8.0.5