Sep 30, 2026·7 min read·15 visits
A parser logic flaw in Nodemailer allows attackers to inject secondary domains and spaces into email envelopes, leading to routing bypasses and email interception.
Nodemailer versions prior to 10.0.9 are vulnerable to a parser differential bug. When processing a quoted local-part followed by an RFC 5322 comment and trailing characters, the internal addressparser module fails to order its normalization routine correctly. This error results in the generation of malformed envelope recipient addresses containing injected whitespace and secondary domains, allowing attackers to bypass routing restrictions and exfiltrate sensitive emails.
The Nodemailer package is a widely adopted library within the Node.js ecosystem for sending emails via SMTP. The library abstracts transport-layer complexities, managing connection pooling, TLS handshakes, and RFC-compliant parsing of headers and email addresses. To handle recipient fields properly, Nodemailer relies on an internal parsing component known as the addressparser module, located in src/addressparser/index.ts.
The addressparser module is responsible for tokenizing and validating input address strings, transforming them into structured objects containing distinct 'name' and 'address' elements. This module must handle various RFC 5322 specifications, including quoted local-parts and comments. Because email addresses frequently contain arbitrary inputs, this parsing boundary represents a primary attack surface for input validation and routing control flaws.
Under GHSA-G57G-F23G-4646, a parser logic vulnerability exists in Nodemailer's address parsing routing. When processing a quoted local-part followed by an RFC 5322 comment and trailing non-comment text, the parser fails to reconstruct the tokens in the correct order. This failure allows an attacker to inject arbitrary characters, such as spaces and secondary domains, directly into the generated SMTP envelope recipient address, leading to potential routing control bypass or SMTP injection.
The root cause of GHSA-G57G-F23G-4646 is a parser differential order-of-operations bug combined with a tokenizer defect when handling quoted local-parts. Under the RFC 5322 standard, email addresses can include comments enclosed in parentheses, which are syntactically ignored during SMTP transmission. Additionally, local-parts can be enclosed in double quotes to allow whitespace and special characters that are otherwise restricted.
When the parser processes a quoted local-part, it handles the text path by storing the raw mailbox text inside a temporary array (data.text) instead of the final destination (data.address). To remove comments or extraneous display names, the parser invokes an internal helper function called _recoverAddrSpec(data). In the vulnerable implementation, this function was executed before the quotes were restored back onto the local-part via _quoteLocalPart(data).
Because the local-part was evaluated in its unquoted state, the recovery logic in _recoverAddrSpec(data) could not differentiate between legitimate whitespace inside a quoted string and trailing metadata left behind after comment stripping. This confusion caused the parser to merge the trailing payload into the final address-spec. Furthermore, empty quoted strings ("") were dropped entirely by the tokenizer, leaving no text token to record that the string was originally quoted, which led to incorrect stripping of domain markers.
The logic error resides in the _handleAddress function within src/addressparser/index.ts. In the vulnerable code path, the address structure is evaluated first, and the quoting logic is applied as a post-processing step on the finalized address structure. This order of execution prevents the parser from preserving state information when processing RFC 5322 comments.
// VULNERABLE CODE PATH FLOW
_recoverAddrSpec(data);
if (addressFromQuotedText && address.address) {
address.address = _quoteLocalPart(address.address);
}In this vulnerable flow, if an input of '"user"@good-corp.com(x)evil.com' is parsed, the parser extracts 'user' as the local-part, but when resolving the address specification, it fails to separate 'evil.com' because the quotes are not yet present on the local-part. This results in the address 'user@good-corp.com evil.com' being generated.
The patch modifies this flow by applying the quoting function immediately if addressFromQuotedText is true, ensuring that the address specification recovery helper operates on a fully quoted and normalized local-part. This allows the parser to identify the whitespace and correctly separate the secondary domain into the display name field.
// PATCHED CODE PATH FLOW
if (addressFromQuotedText && data.text) {
// Put quotes back on first so recovery can tell whitespace from wreckage
data.address = _quoteLocalPart(data.text);
data.text = '';
}
_recoverAddrSpec(data);Additionally, the patch resolves the empty quoted string flaw by checking if the previous tokens represent a double-quote sequence (""). This sets the opensAfterEmptyQuotedString variable, ensuring that the quoting context is properly maintained even if the tokenizer yields no token for the empty string itself.
An attack utilizing GHSA-G57G-F23G-4646 requires the target application to accept user-provided email addresses, perform domain validation, and subsequently pass the validated address to Nodemailer. The exploitation flow targets the differential between the application's strict validator and Nodemailer's vulnerable parser.
First, the attacker registers or submits an input containing a payload such as "user"@good-corp.com(x)evil.com. A standard, RFC-compliant email validator in the application parser processes this input according to correct specifications, resolving the destination domain as good-corp.com (ignoring the comment and wreckage) and approving the input because it matches an authorized domain whitelist.
Second, the approved address is passed directly to Nodemailer. Due to the parser differential, Nodemailer's addressparser fails to discard the trailing text and constructs the following malformed SMTP command:
RCPT TO:<user@good-corp.com evil.com>
Depending on the downstream Mail Transfer Agent (MTA) or SMTP server, the injected whitespace can result in two outcomes. In the first outcome, the MTA splits the recipient parameters on the space character, generating two delivery targets and routing a copy of the email to evil.com. In the second outcome, the MTA's parser reads the last domain as the active routing target, delivering the entire email directly to the attacker-controlled server at evil.com.
The primary impact of GHSA-G57G-F23G-4646 is a severe compromise of email routing security, leading to information disclosure and authentication bypass. In modern web architectures, automated transactional emails—such as password reset tokens, multi-factor authentication (MFA) codes, and financial invoices—are frequently routed to users based on database or application-level rules. If an attacker can manipulate the recipient envelope via parser differentials, they can intercept these communications.
Consider an enterprise application that restricts notifications to internal employees via domain-level whitelisting (e.g., @good-corp.com). By exploiting this vulnerability, an external actor can bypass the whitelist and force the SMTP server to route copies of internal emails to an external mailbox. This allows unauthenticated actors to retrieve password reset links or session tokens, resulting in privilege escalation.
Furthermore, the injection of whitespace in SMTP headers introduces risk of SMTP parameter injection. Attackers can leverage the space character to append additional SMTP verbs or parameters (such as delivery status notifications or custom routing flags) to the RCPT TO envelope command. This can lead to auxiliary diagnostic exploits or service disruptions on the hosting mail server.
The recommended remediation for GHSA-G57G-F23G-4646 is to upgrade Nodemailer to version 10.0.9 or higher. This version corrects the order of operations within the address parser, guaranteeing that quoted local-parts are fully reconstructed before comment-handling logic executes. Downstream packages must update their dependency trees immediately.
If upgrading Nodemailer is not immediately feasible due to legacy system constraints, teams must implement defensive input validation filters upstream. Applications should deploy a strict sanitization step that rejects any input addresses containing double-quote pairs ("") or parentheses ((, )) before passing them to the mail utility.
// Temporary upstream validation workaround
function isSafeEmail(email) {
// Reject common characters used in RFC 5322 parser exploits
const dangerousPatterns = /[()"]/;
return !dangerousPatterns.test(email);
}Additionally, security teams should configure downstream Mail Transfer Agents (MTAs) to strictly reject any RCPT TO command that contains spaces or invalid syntax. Restricting the MTA parser's tolerance for non-standard envelope structures serves as a robust defense-in-depth measure against injection attempts.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
nodemailer Nodemailer | < 10.0.9 | 10.0.9 |
| Attribute | Detail |
|---|---|
| Vulnerability Type | Parser Differential / SMTP Parameter Injection |
| CWE ID | CWE-20 |
| Attack Vector | Network / Input-driven |
| Affected Component | src/addressparser/index.ts |
| Exploit Status | Proof of Concept |
| Remediation Status | Official Patch Available (v10.0.9) |
Improper Input Validation
CVE-2026-126304 is a symlink path traversal vulnerability (CWE-59) in the Natural Language Toolkit (NLTK) versions 3.10.0 prior to 3.10.4. The YCOECorpusReader class constructs internal sub-readers for the 'psd' and 'pos' subdirectories using FileSystemPathPointer.join(), which relies exclusively on lexical string-prefix validation rather than canonical path resolution. An attacker who supplies a crafted YCOE corpus containing symbolic links in place of the 'psd' or 'pos' subdirectories can bypass directory confinement and read arbitrary files from sibling corpora or sensitive directories within the NLTK data sandbox.
CVE-2026-128077 (GHSA-r99w-jh2x-3mg9) is an authorization bypass and interpretation conflict vulnerability affecting Nuxt and its underlying @nuxt/nitro-server package in versions 4.6.0 through 4.6.3. When an incoming HTTP request path begins with a double forward slash (e.g., //x/admin), the WHATWG URL parser within the Nuxt server-side page renderer interprets the initial segment as a network host/authority and resolves the remaining path (/admin) against the application's page router. Because Nitro server middleware, route-scoped serverHandlers, and Nitro routeRules evaluate the unparsed request path (//x/admin), path-based access controls, redirects, and security header policies configured for /admin fail to match and are bypassed.
Prior to version 2.10.2, the sqlite3-ruby gem explicitly cast 64-bit Ruby string lengths (long) to 32-bit signed integers (int) when invoking the underlying SQLite C API. On 64-bit platforms, providing a string of 4 GiB (2^32 bytes) or larger causes integer truncation, instructing SQLite to process only a prefix of the string. This flaw affects SQL query preparation, bound parameter values, and return values from custom Ruby-defined SQL functions and aggregates, allowing trailing SQL clauses such as WHERE restrictions to be silently dropped under specific conditions.
CVE-2026-128068 (GHSA-cpgf-5mjf-73p7) is a Regular Expression Denial of Service (ReDoS) vulnerability in the rails-html-sanitizer Ruby gem affecting versions 1.0.3 through 1.7.1. The flaw resides in the Rails::HTML::PermitScrubber#scrub_attribute method, which uses the multiline regular expression /^\s*[^#\s].*/m to enforce local-only URI fragment references on SVG elements. On Ruby runtimes prior to version 3.2 (CRuby <= 3.1 and JRuby), evaluating an attribute value composed of repeated newline and whitespace characters without a hash character triggers quadratic backtracking O(n^2). Applications are only vulnerable if their sanitization allowlist is explicitly configured to permit SVG reference elements such as <use> alongside href or xlink:href attributes.
CVE-2026-126360 (GHSA-mf5v-w3w3-f6cg) is an algorithmic complexity vulnerability (Regular Expression Denial of Service) in the trace context propagation logic of the opentelemetry-api package within the OpenTelemetry Python ecosystem. In versions prior to 1.45.2, the TraceContextTextMapPropagator.extract() method utilizes a regular expression susceptible to quadratic-time backtracking when parsing malformed W3C traceparent headers containing long sequences of whitespace followed by an embedded newline character. In Python applications—particularly those using single-threaded asynchronous event loops—an unauthenticated remote attacker transmitting payloads over newline-preserving carriers can monopolize CPU execution and induce application-level Denial of Service.
CVE-2026-126359 (GHSA-3gg2-335m-rxc6) is an improper input neutralization vulnerability (CWE-79) in the Hono web framework (`honojs/hono`). Versions from 3.12.0 prior to 4.13.16 evaluate and escape interpolated strings in the `hono/css` helper individually before concatenating template chunks and stripping CSS comments. When a `<` character and a `/style>` sequence are split across template boundaries, adjacent interpolations, or separated by a CSS comment, the sanitizer fails to escape the closing tag sequence. During Server-Side Rendering (SSR), the `<Style />` component outputs an unescaped `</style>` delimiter, permitting an attacker to break out of the CSS raw text context and execute arbitrary HTML and JavaScript in the victim's browser.