CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-268H-HP4C-CRQ3

GHSA-268h-hp4c-crq3: CRLF Injection via List-* Header Comments in Nodemailer

Alon Barad
Alon Barad
Software Engineer

Jun 15, 2026·8 min read·20 visits

Executive Summary (TL;DR)

A CRLF injection vulnerability in Nodemailer <= 8.0.8 allows remote attackers to inject arbitrary email headers by placing newline characters inside dynamic List-* header comments. This occurs because 'prepared' headers bypass Nodemailer's standard sanitization pipeline.

GHSA-268h-hp4c-crq3 is a Carriage Return Line Feed (CRLF) injection vulnerability in the Nodemailer npm package affecting versions up to and including 8.0.8. The library allows arbitrary email header injection when parsing user-controlled comments within list headers (such as List-Unsubscribe or List-ID). This occurs because list headers bypass standard validation by utilizing an internal 'prepared' flag, causing unsanitized newlines to be emitted directly into the outgoing RFC822 mail stream. This exploit allows remote attackers to inject custom, unauthorized mail headers, disrupting signature checks, bypassing filters, or spoofing parameters.

Vulnerability Overview

Nodemailer is an open-source library for Node.js applications that facilitates outbound email transmission via SMTP or transport streams. To support standard newsletter and list features, Nodemailer includes native parsing for List-* headers as defined in RFC 2369 and RFC 2919. These headers, such as List-Unsubscribe, List-Help, and List-ID, allow modern mail clients to display standardized administrative buttons (e.g., Unsubscribe) above the main message body.\n\nThe attack surface is exposed when applications dynamically populate list parameters with user-provided metadata, such as comment descriptors or user-specific unsubscribe configurations. While standard mail headers in Nodemailer undergo rigorous input sanitation to strip or normalize control sequences, list headers are handled by a specialized compilation pipeline. This pipeline flags the resulting values as trusted, pre-compiled payloads, effectively preventing downstream sanitation filters from executing validation routines on these parameters.\n\nIf an attacker can control the comment portion of a list header configuration (e.g., list.unsubscribe.comment or list.id.comment), they can inject Carriage Return (\r) and Line Feed (\n) sequences. These control sequences act as raw layout boundaries in the final RFC822 output stream. Because the message structure splits fields strictly based on CRLF boundaries, the parser treats the trailing portion of the comment as a standalone, root-level message header. This security flaw is classified as CWE-93 (Improper Neutralization of CRLF Sequences).

Root Cause Analysis

The root cause resides in the differential handling of headers inside the Nodemailer compiler core. Specifically, the vulnerability manifests when constructing list headers in lib/mailer/mail-message.js and subsequently generating the stream layout in lib/mime-node/index.js. Standard header fields undergo an escaping pipeline where literal raw control characters are converted into spaces or safely wrapped using RFC 2047 MIME encoding. In contrast, list headers are compiled via the internal helper _getListHeaders(this.data.list).\n\nDuring compilation in lib/mailer/mail-message.js (lines 241-296), each configured list entry is parsed into a structured header object. For instance, the compilation of the List-ID comment field checks if the parameter is plain text using mimeFuncs.isPlainText(comment). If this is evaluated as true, the parser wraps the comment in parentheses and embeds it into the header value directly. However, the evaluation relies solely on the characters falling within printable ASCII ranges and completely fails to neutralize or reject raw CRLF (\\r\\n) sequences.\n\nCrucially, when these list header structures are finalized, they are returned with a specifier configuration of { prepared: true, foldLines: true, value: ... }. The prepared attribute is an internal flag instructing Nodemailer's MIME layout generator to skip regular sanitization, parsing, and escaping processes under the assumption that the value was already normalized. In lib/mime-node/index.js (lines 323-351), the layout engine detects this flag and calls mimeFuncs.foldLines(key + ': ' + value) directly. The unsanitized payload, containing the raw CRLF sequences, is outputted into the outgoing RFC822 transport stream, executing the injection.

Code Analysis

To understand the vulnerable code path, we examine how the list headers are constructed in lib/mailer/mail-message.js before being passed to lib/mime-node/index.js. The vulnerable compilation logic for list headers is as follows:\n\njavascript\n// Vulnerable snippet in lib/mailer/mail-message.js\n// For list properties, headers are dynamically generated and marked as 'prepared'\nlet value = this._getListHeaders(this.data.list);\n\n// Inside _getListHeaders implementation:\nif (item.comment) {\n // The library only checks if the comment is plain text\n // but does not sanitize or strip actual CRLF characters\n if (mimeFuncs.isPlainText(item.comment)) {\n commentStr = '(' + item.comment + ')';\n } else {\n commentStr = mimeFuncs.encodeWord(item.comment);\n }\n}\n\n// The resulting compiled list headers are added with the prepared flag:\nthis.message.addHeader(listHeader.key, {\n prepared: true,\n foldLines: true,\n value: formattedValue + (commentStr ? ' ' + commentStr : '')\n});\n\n\nWhen the MIME generator in lib/mime-node/index.js processes headers, it checks the configuration of the incoming header object. Regular headers undergo strict sanitization, but prepared headers bypass validation completely, as illustrated below:\n\njavascript\n// Inside lib/mime-node/index.js\n_postProcessHeaders(headers) {\n // ...\n if (header.prepared) {\n // Security Bypass: No CRLF validation or sanitization is conducted\n // The raw string is folded and pushed directly to the header output block\n this._headers.push(mimeFuncs.foldLines(header.key + ': ' + header.value));\n } else {\n // Safe path: Sanitizes raw header strings to prevent boundary injection\n let sanitizedValue = this._sanitizeHeaderValue(header.value);\n this._headers.push(mimeFuncs.foldLines(header.key + ': ' + sanitizedValue));\n }\n // ...\n}\n\n\nThis implementation path demonstrates that the prepared attribute establishes an implicit trust boundary. Because Nodemailer treats internal helpers as secure components, any omission of validation in the upstream _getListHeaders function leads to an unmitigated injection path. The patch in version 8.0.9 addresses this by sanitizing CRLF sequences in _getListHeaders before compiling the comment into the final output value.

Exploitation Methodology

Exploiting GHSA-268h-hp4c-crq3 requires an application flow that passes dynamic user input into the comment fields of a list header configuration. The attacker inserts a Carriage Return (\r) and Line Feed (\n) sequence followed by the target header field they wish to inject. Since MIME messages rely on CRLF as structural delimiters between discrete headers, the injected CRLF sequences terminate the List-* header early and initiate a new header context.\n\nConsider an application that allows users to define custom list titles or unsubscribe notes, which are then passed to Nodemailer's sendMail parameters. An attacker can set the comment parameter to the following payload:\n\nmy-comment\\r\\nX-Injected-Header: InjectedValue\n\nWhen Nodemailer compiles the list header, it builds the string representation inside parentheses: (my-comment\\r\\nX-Injected-Header: InjectedValue). Because this is marked as prepared: true, the literal value is written directly to the output stream. The physical output sequence appears as:\n\nhttp\nList-Unsubscribe: <https://example.com/unsubscribe> (my-comment\r\nX-Injected-Header: InjectedValue)\r\n\n\nTo downstream SMTP servers and email clients, this payload is parsed as two distinct headers: a truncated List-Unsubscribe header and a standalone X-Injected-Header. The payload does not corrupt the remaining structure of the mail envelope, making the injection clean and difficult to detect without inspecting raw message sources. This bypass is highly reliable as it relies strictly on RFC822 layout parsers that are structurally bound to split headers on CRLF boundaries.

Impact Assessment

The impact of CRLF injection within an email rendering and delivery library is significant. First, an attacker can exploit this vulnerability to bypass spam and email security filter mechanisms. Many security appliances assess outbound or inbound email posture by evaluating structural headers. By injecting headers like X-Spam-Threshold, Precedence: bulk, or custom trust headers, attackers can systematically manipulate the spam classification scoring of their payloads, allowing phishing emails to reach the victim's inbox.\n\nSecond, the flaw can be leveraged for advanced social engineering and phishing attacks. Attackers can inject custom header fields such as Reply-To, Sender, or mail-client-specific priority configurations. This allows the attacker to alter the visually represented sender or reply destination in common mail applications, tricking recipients into sending sensitive information to unauthorized endpoints.\n\nThird, this injection can compromise cryptographic message integrity. Standard email signatures like DKIM (DomainKeys Identified Mail) sign specific headers or header structures to prove origin integrity. By injecting additional headers or altering existing ones, attackers can break DKIM signatures or cause downstream Mail Transfer Agents (MTAs) to discard or flag authentic mail as forged. If the injection contains multiple CRLF sequences, it can even prematurely terminate the header block, injecting arbitrary text or HTML into the message body itself.

Remediation and Defensive Countermeasures

To remediate this vulnerability, software developers must upgrade nodemailer to version 8.0.9 or higher. This release corrects the flaw by integrating sanitization steps within the list compiler, ensuring any list.*.comment option has carriage return and line feed characters neutralized or rejected prior to building the prepared header payload.\n\nIf an immediate upgrade of the package is not feasible due to regression risks or environment constraints, developers must implement input-validation wrappers to cleanse inputs before passing them to the Nodemailer parameters. A strict sanitization regex should be applied to any user-controlled comment inputs to strip out Carriage Return and Line Feed control characters. The following sanitization implementation is recommended for legacy deployments:\n\njavascript\nfunction sanitizeListComment(comment) {\n if (typeof comment !== 'string') {\n return comment;\n }\n // Strip carriage returns and line feeds to neutralize injection vector\n return comment.replace(/[\\r\\n]+/g, '');\n}\n\n// Implement within mail configuration flow\nconst mailOptions = {\n from: 'no-reply@example.com',\n to: 'user@example.com',\n subject: 'Unsubscribe Confirmation',\n list: {\n unsubscribe: {\n url: 'https://example.com/unsubscribe',\n comment: sanitizeListComment(req.body.userComment)\n }\n }\n};\n\n\nIn addition to local sanitization, security teams should configure Web Application Firewalls (WAFs) and application runtimes to inspect incoming request parameters for raw or URL-encoded carriage returns (%0D, %0A, \\r, \\n) targeting parameters destined for email construction modules. This multi-layered defense minimizes the likelihood of exploitation.

Technical Appendix

CVSS Score
5.4/ 10

Affected Systems

Applications running Nodemailer <= 8.0.8 utilizing dynamic List-* headers.

Affected Versions Detail

Product
Affected Versions
Fixed Version
nodemailer
nodemailer
<= 8.0.88.0.9
AttributeDetail
CWE IDCWE-93
Attack VectorNetwork (Remote)
CVSS Score5.4
Exploit Statuspoc
ImpactArbitrary Email Header Injection
Fixed Version8.0.9

MITRE ATT&CK Mapping

T1566Phishing
Initial Access
T1071Application Layer Protocol
Command and Control

Vulnerability Timeline

Vulnerability Discovered & Security Advisory Published
2026-06-15
Nodemailer v8.0.9 Patched Release Made Available
2026-06-15

References & Sources

  • [1]GitHub Security Advisory GHSA-268h-hp4c-crq3
  • [2]Nodemailer Code Repository

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•1 day ago•CVE-2026-128087
3.7

CVE-2026-128087: Premature Key Exchange Callback Invocation Prior to Host Key Verification in russh

CVE-2026-128087 (GHSA-9264-jvgf-6w2f) is an incorrect behavior order (CWE-696) and improper authorization (CWE-863) vulnerability in the russh Rust SSH library, affecting versions 0.55.0 through 0.65.0. During the initial SSH key exchange (KEX) handshake, the client state machine invokes the client::Handler::kex_done() callback—providing the negotiated raw shared secret bytes—prior to validating the remote server's host key or certificate via check_server_key(). Consequently, an untrusted or rogue SSH server can complete cryptographic key agreement and force a connecting client to execute side-effecting application logic inside kex_done() before the server's identity is checked and rejected.

Amit Schendel
Amit Schendel
8 views•10 min read
•2 days ago•CVE-2026-128082
7.5

CVE-2026-128082: Uncontrolled Recursion and Denial of Service in AutoMapper via Constructor Parameter Mapping

CVE-2026-128082 (GHSA-6vhm-j9h7-f9gh) is an uncontrolled recursion vulnerability (CWE-674) in AutoMapper, a convention-based object-object mapper for .NET. When mapping nested or self-referential types into destination models that rely on parameterized constructors, C# positional records, or recursive ConstructUsing expressions, AutoMapper evaluates child constructor arguments prior to incrementing the parent's recursion depth counter. This ordering flaw bypasses both explicit MaxDepth limits and the default depth limit of 64. An unauthenticated remote attacker can supply deeply nested input payloads to affected endpoints, exhausting the thread call stack and triggering an uncatchable System.StackOverflowException that terminates the hosting .NET process.

Amit Schendel
Amit Schendel
8 views•11 min read
•2 days ago•CVE-2026-128080
5.8

CVE-2026-128080: Sensitive Query Parameter Disclosure on Incoming Server Spans in OpenTelemetry JavaScript (@opentelemetry/instrumentation-http)

An information exposure vulnerability in the @opentelemetry/instrumentation-http package for OpenTelemetry JavaScript versions 0.204.0 prior to 0.222.0 causes incoming HTTP server spans to record raw, unredacted query string parameters under the url.query attribute. While outgoing client spans applied built-in and user-configured query parameter redaction, incoming server spans bypassed this sanitization completely, resulting in the transmission of sensitive credentials such as pre-signed cloud URLs and API tokens to external observability backends.

Alon Barad
Alon Barad
7 views•10 min read
•2 days ago•CVE-2026-128089
7.5

CVE-2026-128089: Uncontrolled Resource Consumption in dnspython WKS Record Parser

CVE-2026-128089 is an uncontrolled resource consumption vulnerability in the dnspython toolkit for Python, affecting all versions prior to 2.9.2. When parsing Well-Known Service (WKS) records from text via dns.rdtypes.IN.WKS.WKS.from_text(), the parser fails to validate that numeric service port identifiers fall within the RFC 1035 valid range of 0 through 65535. An attacker capable of supplying untrusted zone files or RDATA text strings containing an arbitrarily large service port integer can force the parser to allocate an unbounded bitmap array using an inefficient linear append loop, resulting in severe CPU exhaustion, application hangs, or Out-Of-Memory (OOM) process termination.

Amit Schendel
Amit Schendel
8 views•10 min read
•2 days ago•CVE-2026-126347
3.1

CVE-2026-126347: Open Redirect via Triple-Slash Redirect Paths in Tornado RedirectHandler

CVE-2026-126347 (GHSA-5cjw-f85j-cv6r) is an open redirect vulnerability (CWE-601) in Tornado, an asynchronous Python networking library and web framework. The flaw resides in tornado.web.RedirectHandler when dynamic URL redirection templates incorporate unvalidated user input. Due to a parser differential between RFC 3986 (used by Python's urllib.parse.urlsplit) and the WHATWG URL Standard (used by modern web browsers), inputs containing three or more leading slashes bypass Tornado 6.6.0's validation logic, allowing unauthenticated attackers to redirect users to arbitrary external domains.

Alon Barad
Alon Barad
8 views•11 min read
•2 days ago•CVE-2026-128123
5.9

CVE-2026-128123: Uncaught Exception and Denial of Service in SvelteKit @sveltejs/adapter-node

A Denial of Service (DoS) vulnerability exists in @sveltejs/adapter-node versions 5.5.7 and 6.0.0-next.0 through 6.0.0. When a SvelteKit server route returns a direct response from a fetch() call with a Content-Type of text/event-stream, the Node.js adapter attempts to mutate the response headers to disable proxy buffering. Because headers returned directly by the WHATWG Fetch API carry an immutable guard, this mutation throws an unhandled TypeError, terminating the underlying Node.js process and denying service to all active and subsequent clients.

Alon Barad
Alon Barad
8 views•9 min read