Sep 9, 2026·3 min read·6 visits
Parser misalignment in Nodemailer allows attackers to bypass email validation and route sensitive emails to unauthorized domains using RFC 5322 comments.
A critical parser differential vulnerability exists in Nodemailer prior to version 9.1.0. An attacker can bypass recipient-domain validation checks by utilizing RFC 5322 comments, leading to unauthorized email routing.
A critical parser differential vulnerability, identified as GHSA-CC9R-2J5M-2M83, exists in Nodemailer versions prior to 9.1.0.\n\nThis vulnerability arises from a misaligned implementation of the Comments and Folding White Space (CFWS) specifications defined in RFC 5322.\n\nThe parsing discrepancy allows remote attackers to bypass application-level recipient-domain validation checks.\n\nSuccessful exploitation can result in the unauthorized delivery of sensitive transactional emails to an attacker-controlled destination.
Under RFC 5322, comments enclosed within parentheses represent Folding White Space (CFWS) and function as semantic delimiters.\n\nIn Nodemailer's unpatched custom address parser located in lib/addressparser/index.js, the tokenizer failed to treat the closing parenthesis of a comment as a delimiter when followed by non-break characters.\n\nInstead, the parser incorrectly applied a noBreak state across the comment boundary, causing it to join the preceding and succeeding text tokens together during reconstruction.\n\nFor example, the parser processes the input user@good-corp.com(comment)evil.com by discarding the comment but directly concatenating the domain strings into user@good-corp.comevil.com.
The vulnerability exists within the state machine of the custom Tokenizer in lib/addressparser/index.js.\n\nIn the vulnerable implementation, the tokenizer class did not recognize the closing parenthesis as a structural boundary.\n\njavascript\n// Vulnerable logic in lib/addressparser/index.js\nif (prevToken && prevToken.noBreak && data[state].length) {\n data[state][data[state].length - 1] += token.value;\n}\n\n\nThe official patch introduced in commit 902b63e935435c30f4025901c0902dce64cd8880 mitigates this behavior.\n\njavascript\n// Patched logic in lib/addressparser/index.js\nconst tail = data[state].length ? data[state][data[state].length - 1] : '';\nconst joinsAcrossComment = tail.slice(-1) === '@' || token.value.charAt(0) === '@';\n\nif (prevToken && prevToken.noBreak && data[state].length && (!prevToken.cfws || joinsAcrossComment)) {\n data[state][data[state].length - 1] += token.value;\n}\n\n\nAdditionally, the tokenizer now explicitly flags the closing parenthesis character with a cfws property:\n\njavascript\nif (chr === ')') {\n this.node.cfws = true;\n}\n
An attack requires the target application to utilize two different parsing engines: an RFC-conformant validator and Nodemailer.\n\nThe attacker first registers a domain matching the concatenated suffix, such as good-corp.comevil.com, and establishes a mail exchange server.\n\nNext, the attacker registers on the target application using the payload attacker@good-corp.com(signup)evil.com.\n\nThe application's primary validator analyzes the string, parses the comment, and confirms that the core recipient domain is good-corp.com.\n\nUpon passing validation, the application forwards the address to Nodemailer, which reconstructs the destination as attacker@good-corp.comevil.com and transmits the message to the attacker's mail server.\n\nmermaid\ngraph LR\n A["Input: user@good-corp.com(x)evil.com"] --> B["Validator Engine"]\n B -->|"Parsed: good-corp.com (Valid)"| C["Application Control"]\n C --> D["Nodemailer Engine"]\n D -->|"Parsed: good-corp.comevil.com"| E["Attacker Mailbox"]\n
The capability to redirect email delivery from authorized corporate domains to arbitrary external domains compromises critical business logic workflows.\n\nThis flaw allows attackers to intercept sensitive communications, such as password reset links, multi-factor authentication tokens, and billing invoices.\n\nBecause the vulnerability operates silently at the parser level, standard transaction logs may show successful delivery without flagging security exceptions.\n\nThe analytical CVSS v3.1 score for this vulnerability is 9.1 (Critical), reflecting low attack complexity and high confidentiality and integrity impacts.
The primary remediation is upgrading Nodemailer to version 9.1.0 or later to ensure proper tokenization of CFWS.\n\nIf upgrading is not immediately feasible, applications should implement input-hardening rules to filter out parentheses in input fields containing email addresses.\n\njavascript\n// Hardened validation rule to reject comments in email fields\nif (/[()]/.test(emailInput)) {\n throw new Error('Invalid characters in email address');\n}\n\n\nUsing a single, unified parser for both validation and transmission phases prevents the emergence of parser differentials.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
nodemailer Nodemailer | < 9.1.0 | 9.1.0 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-436 |
| Attack Vector | Network |
| CVSS | 9.1 (Critical) |
| Impact | Unauthorized email routing and interception of sensitive credentials |
| Exploit Status | PoC available |
The software uses two or more different parsers to process the same input, leading to inconsistent interpretations of boundaries and structural delimiters.
A resource consumption vulnerability exists in the multer library version 2.2.0 when utilizing the disk storage engine. When a remote client aborts or truncates an in-progress file upload, multer removes the partial file from the disk but fails to properly close the active write stream. This behavior leaves the underlying file descriptor open in the operating system, allowing a remote attacker to systematically exhaust the server's file descriptor limits and trigger a Denial of Service.
CVE-2026-77078 is a critical denial of service vulnerability in the multer Node.js package, allowing unauthenticated remote attackers to crash the runtime process using a single crafted multipart/form-data HTTP payload.
A path traversal vulnerability (CWE-22) in the Microsoft TypeSpec compiler core and associated emitter packages permits unvalidated user input to escape the designated output directory, resulting in arbitrary JSON and YAML file creation or modification on the host system.
An algorithmic complexity vulnerability in Nodemailer before version 9.1.0 allows remote attackers to block the Node.js event loop. This denial of service is triggered by processing large or complex lists of email addresses, leading to quadratic resource consumption.
Nodemailer (prior to version 9.1.0) is vulnerable to an IDN/Punycode domain allow-list bypass due to an interpretation conflict between legacy RFC-3492 codecs and modern UTS-46 Unicode parsers.
A missing authorization vulnerability (CWE-862) exists in n8n where AI Agent workflows executing as tools bypass the Sub-Workflow Caller Policy settings, allowing authenticated users with agent creation privileges to invoke unauthorized sub-workflows across project boundaries.