HTTP Header Injection

Affecting nodemailer package, versions <6.6.1

Report new vulnerabilities
Do your applications use this vulnerable package? Test your applications

Overview

nodemailer is an Easy as cake e-mail sending from your Node.js applications

Affected versions of this package are vulnerable to HTTP Header Injection if unsanitized user input that may contain newlines and carriage returns is passed into an address object.

PoC:

const userEmail = 'foo@bar.comrnSubject: foobar'; // imagine this comes from e.g. HTTP request params or is otherwise user-controllable
await transporter.sendMail({
from: '...',
to: '...',
replyTo: {
name: 'Customer',
address: userEmail,
},
subject: 'My Subject',
text: message,
});

Remediation

Upgrade nodemailer to version 6.6.1 or higher.

References

CVSS Score

6.3
medium severity
  • Attack Vector
    Network
  • Attack Complexity
    Low
  • Privileges Required
    None
  • User Interaction
    Required
  • Scope
    Unchanged
  • Confidentiality
    Low
  • Integrity
    Low
  • Availability
    Low
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:L/E:P
Credit
Adam Williams
CVE
CVE-2021-23400
CWE
CWE-644
Snyk ID
SNYK-JS-NODEMAILER-1296415
Disclosed
24 May, 2021
Published
28 Jun, 2021